SlideShare a Scribd company logo
Writing Docker
monitoring agent with Go
ainoya
About me
• Naoki Ainoya( ainoya)
• iOS(new!)/Server/Infra engineer
• Swift/Scala/Go/Docker
• Recruit Marketing Partners Co, Ltd.
A tiny deployment pipeline tool
Written in Go
walter-cd/walter
Open source project
Introduction of Fune
• An event emitter triggered by Docker Event API
• The agent process (fune-agent) communicates with docker
daemon via its socket
• https://github.com/ainoya/fune
Docker daemon
Funeagent
ConttainerA
ConttainerB
ConttainerC
Nginx/Redis
vulcand(etcd)
Slack notification etc..
Listens docker
events API
notifies each containers are
created/died/stopped/started
Emits pluggable
actions
Your
arbitrary docker ecosystem
ECS/k8s/fleet/etc..
Docker Host
Deploy containers
Overview of Fune
• Docker Events API provides a lifecycle of container
as JSON format
• create/start/die/stop
Overview of Fune
fune-agent listens these events
Docker daemon
Funeagent
ConttainerA
ConttainerB
ConttainerC
Listens docker
events API
notifies each containers are
created/died/stopped/started
Your
arbitrary docker ecosystem
ECS/k8s/fleet/etc..
Docker Host
Deploy containers
Overview of Fune
fune-agent emits Action

when received Docker events

from event
Docker daemon
Funeagent
ConttainerA
ConttainerB
Nginx/Redis
vulcand(etcd)
Slack notification etc..
Listens docker
events API
notifies each containers are
created/died/stopped/started
Emits pluggable
actions
Your
arbitrary docker ecosystem
ECS/k8s/fleet/etc..
Docker Host
Deploy containers
Overview of Fune
Docker daemon
Funeagent
ConttainerA
ConttainerB
Nginx/Redis
vulcand(etcd)
Slack notification etc..
Listens docker
events API
notifies each containers are
created/died/stopped/started
Emits pluggable
actions
Your
arbitrary docker ecosystem
ECS/k8s/fleet/etc..
Docker Host
Deploy containers
• Action, for example;
• Set/Del a container information to Redis as
FQDN/IP:Port pair for proxy
• Slack notification
• More details are next time :)
Today I talk about:
• Some tips I learned with writing fune
• Studied a lot of stuffs from coreos/etcd
Setup project
• Standard structure for 

working with Godeps correctly
• /src/github.com/ainoya/fune
./${GOPATH}/src
!"" 9fans.net
#   %"" go
!"" code.google.com
#   %"" p
!"" github.com
#   !"" ainoya/fune
#   !"" barakmich
#   !"" coreos etc...
Godeps for the package
dependencies
• Using Godeps once, all dependencies copied into
directory and rewrite import statement
• Then you need Godeps command only if package
dependency is added
import "github.com/fsouza/go-dockerclient"
// after `Godep save -r ./…`
import "github.com/ainoya/fune/Godeps/_workspace/
src/github.com/fsouza/go-dockerclient"
Godeps for the package
dependencies
• All dependencies are included in git repos
• But it makes dirty commit log!!
• Keep off its dirtiness by split commits :)
How about vendor feature in
go1.5?
• go1.5 vendor feature have some problems yet
• ex) go	
  tool	
  "./…" doesn't works well
• https://github.com/golang/go/issues/11659
• See also ) http://deeeet.com/writing/2015/06/26/golang-dependency-
vendoring/
Write tests
• Rerun automatically if files are changed
• rerun is awesome! (but ruby tool gem)
rerun -x -c -d directory1, directory2,...
—pattern '**/*.{go}' -- go test ./...
Be careful about race condition
• Test with "-­‐race" option if you often use goroutine in your code
• "-­‐cpu	
  N" option may reveal race condition you didn't expected
• I use "go	
  test	
  ./…	
  -­‐race	
  -­‐cpu	
  1,2,4" inside test script
WARNING: DATA RACE
Write by goroutine 8:
sync.raceWrite()
/usr/local/Cellar/go/1.5/libexec/src/sync/race.go:41 +0x2e
sync.(*WaitGroup).Wait()
/usr/local/Cellar/go/1.5/libexec/src/sync/waitgroup.go:124 +0xf9
github.com/ainoya/fune/emitter.TestBroadCast()
/Users/ainoya/.go/src/github.com/ainoya/fune/gopath/src/github.com/
ainoya/fune/emitter/emitter_test.go:57 +0x444
testing.tRunner()
/usr/local/Cellar/go/1.5/libexec/src/testing/testing.go:456 +0xdc
Is Go1.5 compilation time
slower than 1.4?
• "go	
  test" obviously takes time much longer
• It's probably because of GoGo compiler
performance

Ref) Performance section of https://golang.org/doc/go1.5
• It should be improved with Go1.6
Channel tips
• coreos/etcd implements a shutdown feature with
using close(channel)
type	
  Server	
  struct	
  {	
  
	
   name	
  	
  	
  	
  string	
  
	
   channel	
  chan	
  struct{}	
  
	
   done	
  	
  	
  	
  chan	
  struct{}	
  
	
   stop	
  	
  	
  	
  chan	
  struct{}	
  
}	
  
func	
  main()	
  {	
  
	
   done	
  :=	
  make(chan	
  struct{})	
  
	
   stop	
  :=	
  make(chan	
  struct{})	
  
	
   s	
  :=	
  &Server{done:	
  done,	
  stop:	
  stop,	
  
hoge:	
  hoge}	
  
	
   go	
  s.run()	
  
	
   s.channel	
  <-­‐	
  struct{}{}	
  
	
   osutil.RegisterInterrputHandler(s.Stop)	
  
	
   <-­‐s.done	
  
}
func	
  (s	
  *Server)	
  run()	
  {	
  
	
   defer	
  func()	
  {	
  close(s.done)	
  }()	
  
	
   for	
  {	
  
	
   	
   select	
  {	
  
	
   	
   case	
  <-­‐s.channel:	
  
	
   	
   	
   fmt.Println("do	
  something")	
  
	
   	
   case	
  <-­‐s.stop:	
  
	
   	
   	
   return	
  
	
   	
   }	
  
	
   }	
  
}	
  
func	
  (s	
  *S)	
  Stop()	
  {	
  
	
   select	
  {	
  
	
   case	
  s.stop	
  <-­‐	
  struct{}{}:	
  
	
   case	
  <-­‐s.done:	
  
	
   	
   return	
  
	
   }	
  
	
   <-­‐s.done	
  
}	
  
Channel tips
• coreos/etcd implements a shutdown feature with
using close(channel)
type	
  Server	
  struct	
  {	
  
	
   name	
  	
  	
  	
  string	
  
	
   channel	
  chan	
  struct{}	
  
	
   done	
  	
  	
  	
  chan	
  struct{}	
  
	
   stop	
  	
  	
  	
  chan	
  struct{}	
  
}	
  
func	
  main()	
  {	
  
	
   done	
  :=	
  make(chan	
  struct{})	
  
	
   stop	
  :=	
  make(chan	
  struct{})	
  
	
   s	
  :=	
  &Server{done:	
  done,	
  stop:	
  stop,	
  
hoge:	
  hoge}	
  
	
   go	
  s.run()	
  
	
   s.channel	
  <-­‐	
  struct{}{}	
  
	
   osutil.RegisterInterrputHandler(s.Stop)	
  
	
   <-­‐s.done	
  
}
func	
  (s	
  *Server)	
  run()	
  {	
  
	
   defer	
  func()	
  {	
  close(s.done)	
  }()	
  
	
   for	
  {	
  
	
   	
   select	
  {	
  
	
   	
   case	
  <-­‐s.channel:	
  
	
   	
   	
   fmt.Println("do	
  something")	
  
	
   	
   case	
  <-­‐s.stop:	
  
	
   	
   	
   return	
  
	
   	
   }	
  
	
   }	
  
}	
  
func	
  (s	
  *S)	
  Stop()	
  {	
  
	
   select	
  {	
  
	
   case	
  s.stop	
  <-­‐	
  struct{}{}:	
  
	
   case	
  <-­‐s.done:	
  
	
   	
   return	
  
	
   }	
  
	
   <-­‐s.done	
  
}	
  
Channel tips
• coreos/etcd implements a shutdown feature with
using close(channel)
type	
  Server	
  struct	
  {	
  
	
   name	
  	
  	
  	
  string	
  
	
   channel	
  chan	
  struct{}	
  
	
   done	
  	
  	
  	
  chan	
  struct{}	
  
	
   stop	
  	
  	
  	
  chan	
  struct{}	
  
}	
  
func	
  main()	
  {	
  
	
   done	
  :=	
  make(chan	
  struct{})	
  
	
   stop	
  :=	
  make(chan	
  struct{})	
  
	
   s	
  :=	
  &Server{done:	
  done,	
  stop:	
  stop,	
  
hoge:	
  hoge}	
  
	
   go	
  s.run()	
  
	
   s.channel	
  <-­‐	
  struct{}{}	
  
	
   osutil.RegisterInterrputHandler(s.stop)	
  
	
   <-­‐s.done	
  
}
func	
  (s	
  *Server)	
  run()	
  {	
  
	
   defer	
  func()	
  {	
  close(s.done)	
  }()	
  
	
   for	
  {	
  
	
   	
   select	
  {	
  
	
   	
   case	
  <-­‐s.channel:	
  
	
   	
   	
   fmt.Println("do	
  something")	
  
	
   	
   case	
  <-­‐s.stop:	
  
	
   	
   	
   return	
  
	
   	
   }	
  
	
   }	
  
}	
  
func	
  (s	
  *S)	
  Stop()	
  {	
  
	
   select	
  {	
  
	
   case	
  s.stop	
  <-­‐	
  struct{}{}:	
  
	
   case	
  <-­‐s.done:	
  
	
   	
   return	
  
	
   }	
  
	
   <-­‐s.done	
  
}	
  
Channel tips
• coreos/etcd implements a shutdown feature with
using close(channel)
type	
  Server	
  struct	
  {	
  
	
   name	
  	
  	
  	
  string	
  
	
   channel	
  chan	
  struct{}	
  
	
   done	
  	
  	
  	
  chan	
  struct{}	
  
	
   stop	
  	
  	
  	
  chan	
  struct{}	
  
}	
  
func	
  main()	
  {	
  
	
   done	
  :=	
  make(chan	
  struct{})	
  
	
   stop	
  :=	
  make(chan	
  struct{})	
  
	
   s	
  :=	
  &Server{done:	
  done,	
  stop:	
  stop,	
  
hoge:	
  hoge}	
  
	
   go	
  s.run()	
  
	
   s.channel	
  <-­‐	
  struct{}{}	
  
	
   osutil.RegisterInterrputHandler(s.Stop)	
  
	
   <-­‐s.done	
  
}
func	
  (s	
  *Server)	
  run()	
  {	
  
	
   defer	
  func()	
  {	
  close(s.done)	
  }()	
  
	
   for	
  {	
  
	
   	
   select	
  {	
  
	
   	
   case	
  <-­‐s.channel:	
  
	
   	
   	
   fmt.Println("do	
  something")	
  
	
   	
   case	
  <-­‐s.stop:	
  
	
   	
   	
   return	
  
	
   	
   }	
  
	
   }	
  
}	
  
func	
  (s	
  *S)	
  Stop()	
  {	
  
	
   select	
  {	
  
	
   case	
  s.stop	
  <-­‐	
  struct{}{}:	
  
	
   case	
  <-­‐s.done:	
  
	
   	
   return	
  
	
   }	
  
	
   <-­‐s.done	
  
}	
  
Channel tips
• coreos/etcd implements a shutdown feature with
using close(channel)
type	
  Server	
  struct	
  {	
  
	
   name	
  	
  	
  	
  string	
  
	
   channel	
  chan	
  struct{}	
  
	
   done	
  	
  	
  	
  chan	
  struct{}	
  
	
   stop	
  	
  	
  	
  chan	
  struct{}	
  
}	
  
func	
  main()	
  {	
  
	
   done	
  :=	
  make(chan	
  struct{})	
  
	
   stop	
  :=	
  make(chan	
  struct{})	
  
	
   s	
  :=	
  &Server{done:	
  done,	
  stop:	
  stop,	
  
hoge:	
  hoge}	
  
	
   go	
  s.run()	
  
	
   s.channel	
  <-­‐	
  struct{}{}	
  
	
   osutil.RegisterInterrputHandler(s.Stop)	
  
	
   <-­‐s.done	
  
}
func	
  (s	
  *Server)	
  run()	
  {	
  
	
   defer	
  func()	
  {	
  close(s.done)	
  }()	
  
	
   for	
  {	
  
	
   	
   select	
  {	
  
	
   	
   case	
  <-­‐s.channel:	
  
	
   	
   	
   fmt.Println("do	
  something")	
  
	
   	
   case	
  <-­‐s.stop:	
  
	
   	
   	
   return	
  
	
   	
   }	
  
	
   }	
  
}	
  
func	
  (s	
  *S)	
  Stop()	
  {	
  
	
   select	
  {	
  
	
   case	
  s.stop	
  <-­‐	
  struct{}{}:	
  
	
   case	
  <-­‐s.done:	
  
	
   	
   return	
  
	
   }	
  
	
   <-­‐s.done	
  
}	
  
Test goroutine easily
"s.done" channel makes testing goroutine easily
//	
  https://github.com/coreos/etcd/blob/master/etcdserver/
server_test.go#L1031	
  
//	
  TestPublishRetry	
  tests	
  that	
  publish	
  will	
  keep	
  retry	
  until	
  success.	
  
func	
  TestPublishRetry(t	
  *testing.T)	
  {	
  
	
   n	
  :=	
  &nodeRecorder{}	
  
	
   srv	
  :=	
  &EtcdServer{	
  
	
   	
   cfg:	
  	
  	
  	
  	
  	
  &ServerConfig{TickMs:	
  1},	
  
	
   	
   r:	
  	
  	
  	
  	
  	
  	
  	
  raftNode{Node:	
  n},	
  
	
   	
   w:	
  	
  	
  	
  	
  	
  	
  	
  &waitRecorder{},	
  
	
   	
   done:	
  	
  	
  	
  	
  make(chan	
  struct{}),	
  
	
   	
   reqIDGen:	
  idutil.NewGenerator(0,	
  time.Time{}),	
  
	
   }	
  
	
   time.AfterFunc(500*time.Microsecond,	
  func()	
  {	
  close(srv.done)	
  })	
  
	
   srv.publish(10	
  *	
  time.Nanosecond)	
  
Run go as Docker container
• Go single binary with "SCRATCH"
• You can run a go stuff inside extremely simple container!
FROM	
  scratch	
  
EXPOSE	
  8080	
  
COPY	
  your-­‐golang-­‐app	
  /app/your-­‐golang-­‐app	
  
ENV	
  PATH=/app:$PATH	
  
ENTRYPOINT	
  ["/app/your-­‐golang-­‐app"]	
  
CMD	
  ["-­‐some-­‐option=haha"]
Round up
• Learned a lot of stuffs from well-knowned products
(coreos/etcd)
• project structure, test, golang-way
See you next kyobashi.*!
• 9/7: kyobashi.dex
• 9/16: potatotips
• ???: kyobashi.???

More Related Content

What's hot

Utilizing Powerful Extensions for Analytics and Operations
Utilizing Powerful Extensions for Analytics and OperationsUtilizing Powerful Extensions for Analytics and Operations
Utilizing Powerful Extensions for Analytics and Operations
Neo4j
 
Higher Order Components and Render Props
Higher Order Components and Render PropsHigher Order Components and Render Props
Higher Order Components and Render Props
Nitish Phanse
 
GeeCON 2014 - Functional Programming without Lambdas
GeeCON 2014 - Functional Programming without LambdasGeeCON 2014 - Functional Programming without Lambdas
GeeCON 2014 - Functional Programming without Lambdas
Mattias Severson
 
Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...
Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...
Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...
GeeksLab Odessa
 
High Performance tDiary
High Performance tDiaryHigh Performance tDiary
High Performance tDiary
Hiroshi SHIBATA
 
lldb – Debugger auf Abwegen
lldb – Debugger auf Abwegenlldb – Debugger auf Abwegen
lldb – Debugger auf Abwegen
inovex GmbH
 
Writing Go(od) Tests (FOSDEM 2020)
Writing Go(od) Tests (FOSDEM 2020)Writing Go(od) Tests (FOSDEM 2020)
Writing Go(od) Tests (FOSDEM 2020)
Nikki Attea
 
Common mistakes functional java vjug
Common mistakes functional java vjugCommon mistakes functional java vjug
Common mistakes functional java vjug
Brian Vermeer
 
Common mistakes functional java | Oracle Code One 2018
Common mistakes functional java | Oracle Code One 2018Common mistakes functional java | Oracle Code One 2018
Common mistakes functional java | Oracle Code One 2018
Brian Vermeer
 
Transducers in JavaScript
Transducers in JavaScriptTransducers in JavaScript
Transducers in JavaScript
Pavel Forkert
 
Scu scsi-summary
Scu scsi-summaryScu scsi-summary
Scu scsi-summary
jmichel99
 
Elixir @ Paris.rb
Elixir @ Paris.rbElixir @ Paris.rb
Elixir @ Paris.rb
Gregoire Lejeune
 
Flux and InfluxDB 2.0
Flux and InfluxDB 2.0Flux and InfluxDB 2.0
Flux and InfluxDB 2.0
InfluxData
 
Ten common mistakes made with Functional Java JBCNConf18
Ten common mistakes made with Functional Java JBCNConf18Ten common mistakes made with Functional Java JBCNConf18
Ten common mistakes made with Functional Java JBCNConf18
Brian Vermeer
 
DevOps with Fabric
DevOps with FabricDevOps with Fabric
DevOps with Fabric
Simone Federici
 
Adb instructions
Adb instructionsAdb instructions
Adb instructions
rklsaraswathi
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event Loop
Designveloper
 
Lua: the world's most infuriating language
Lua: the world's most infuriating languageLua: the world's most infuriating language
Lua: the world's most infuriating language
jgrahamc
 
Async data pipelines for client-side JavaScript
Async data pipelines for client-side JavaScriptAsync data pipelines for client-side JavaScript
Async data pipelines for client-side JavaScript
Ismael Celis
 
Os Fetterupdated
Os FetterupdatedOs Fetterupdated
Os Fetterupdatedoscon2007
 

What's hot (20)

Utilizing Powerful Extensions for Analytics and Operations
Utilizing Powerful Extensions for Analytics and OperationsUtilizing Powerful Extensions for Analytics and Operations
Utilizing Powerful Extensions for Analytics and Operations
 
Higher Order Components and Render Props
Higher Order Components and Render PropsHigher Order Components and Render Props
Higher Order Components and Render Props
 
GeeCON 2014 - Functional Programming without Lambdas
GeeCON 2014 - Functional Programming without LambdasGeeCON 2014 - Functional Programming without Lambdas
GeeCON 2014 - Functional Programming without Lambdas
 
Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...
Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...
Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...
 
High Performance tDiary
High Performance tDiaryHigh Performance tDiary
High Performance tDiary
 
lldb – Debugger auf Abwegen
lldb – Debugger auf Abwegenlldb – Debugger auf Abwegen
lldb – Debugger auf Abwegen
 
Writing Go(od) Tests (FOSDEM 2020)
Writing Go(od) Tests (FOSDEM 2020)Writing Go(od) Tests (FOSDEM 2020)
Writing Go(od) Tests (FOSDEM 2020)
 
Common mistakes functional java vjug
Common mistakes functional java vjugCommon mistakes functional java vjug
Common mistakes functional java vjug
 
Common mistakes functional java | Oracle Code One 2018
Common mistakes functional java | Oracle Code One 2018Common mistakes functional java | Oracle Code One 2018
Common mistakes functional java | Oracle Code One 2018
 
Transducers in JavaScript
Transducers in JavaScriptTransducers in JavaScript
Transducers in JavaScript
 
Scu scsi-summary
Scu scsi-summaryScu scsi-summary
Scu scsi-summary
 
Elixir @ Paris.rb
Elixir @ Paris.rbElixir @ Paris.rb
Elixir @ Paris.rb
 
Flux and InfluxDB 2.0
Flux and InfluxDB 2.0Flux and InfluxDB 2.0
Flux and InfluxDB 2.0
 
Ten common mistakes made with Functional Java JBCNConf18
Ten common mistakes made with Functional Java JBCNConf18Ten common mistakes made with Functional Java JBCNConf18
Ten common mistakes made with Functional Java JBCNConf18
 
DevOps with Fabric
DevOps with FabricDevOps with Fabric
DevOps with Fabric
 
Adb instructions
Adb instructionsAdb instructions
Adb instructions
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event Loop
 
Lua: the world's most infuriating language
Lua: the world's most infuriating languageLua: the world's most infuriating language
Lua: the world's most infuriating language
 
Async data pipelines for client-side JavaScript
Async data pipelines for client-side JavaScriptAsync data pipelines for client-side JavaScript
Async data pipelines for client-side JavaScript
 
Os Fetterupdated
Os FetterupdatedOs Fetterupdated
Os Fetterupdated
 

Viewers also liked

このあと滅茶苦茶LGTMした
このあと滅茶苦茶LGTMしたこのあと滅茶苦茶LGTMした
このあと滅茶苦茶LGTMした
shinnosuke kugimiya
 
Performance Monitoring for Docker Environments - Docker Amsterdam June Meetup
Performance Monitoring for Docker Environments - Docker Amsterdam June MeetupPerformance Monitoring for Docker Environments - Docker Amsterdam June Meetup
Performance Monitoring for Docker Environments - Docker Amsterdam June Meetup
Stijn Polfliet
 
Gobotについて
GobotについてGobotについて
Gobotについて
Jun Ichikawa
 
Discussing the difference between docker dontainers and virtual machines
Discussing the difference between docker dontainers and virtual machinesDiscussing the difference between docker dontainers and virtual machines
Discussing the difference between docker dontainers and virtual machines
Steven Grzbielok
 
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios
 
Running Netflix OSS on Docker with Nirmata
Running Netflix OSS on Docker with NirmataRunning Netflix OSS on Docker with Nirmata
Running Netflix OSS on Docker with Nirmata
Damien Toledo
 
Docker Indy Meetup Monitoring 30-Aug-2016
Docker Indy Meetup Monitoring 30-Aug-2016Docker Indy Meetup Monitoring 30-Aug-2016
Docker Indy Meetup Monitoring 30-Aug-2016
Matt Bentley
 
Netflix and Containers: Not A Stranger Thing
Netflix and Containers:  Not A Stranger ThingNetflix and Containers:  Not A Stranger Thing
Netflix and Containers: Not A Stranger Thing
aspyker
 
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
Microservices with Netflix OSS and Spring Cloud -  Dev Day OrangeMicroservices with Netflix OSS and Spring Cloud -  Dev Day Orange
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
acogoluegnes
 
NetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker TalkNetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker Talk
aspyker
 
Microservices with Spring Cloud, Netflix OSS and Kubernetes
Microservices with Spring Cloud, Netflix OSS and Kubernetes Microservices with Spring Cloud, Netflix OSS and Kubernetes
Microservices with Spring Cloud, Netflix OSS and Kubernetes
Christian Posta
 
Microservices and APIs
Microservices and APIsMicroservices and APIs
Microservices and APIs
Christian Posta
 
Real world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShiftReal world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShift
Christian Posta
 
Goだけでモバイルアプリを作る
Goだけでモバイルアプリを作るGoだけでモバイルアプリを作る
Goだけでモバイルアプリを作る
Takuya Ueda
 
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Docker, Inc.
 
Learning the Alphabet: A/B, CD and [E-Z] in the Docker Datacenter by Brett Ti...
Learning the Alphabet: A/B, CD and [E-Z] in the Docker Datacenter by Brett Ti...Learning the Alphabet: A/B, CD and [E-Z] in the Docker Datacenter by Brett Ti...
Learning the Alphabet: A/B, CD and [E-Z] in the Docker Datacenter by Brett Ti...
Docker, Inc.
 
Securing the Container Pipeline at Salesforce by Cem Gurkok
Securing the Container Pipeline at Salesforce by Cem Gurkok   Securing the Container Pipeline at Salesforce by Cem Gurkok
Securing the Container Pipeline at Salesforce by Cem Gurkok
Docker, Inc.
 
Docker in Production, Look No Hands! by Scott Coulton
Docker in Production, Look No Hands! by Scott CoultonDocker in Production, Look No Hands! by Scott Coulton
Docker in Production, Look No Hands! by Scott Coulton
Docker, Inc.
 
Build Fast, Deploy Fast: Innovating in the Enterprise by Imran Raja and Andy Lim
Build Fast, Deploy Fast: Innovating in the Enterprise by Imran Raja and Andy LimBuild Fast, Deploy Fast: Innovating in the Enterprise by Imran Raja and Andy Lim
Build Fast, Deploy Fast: Innovating in the Enterprise by Imran Raja and Andy Lim
Docker, Inc.
 

Viewers also liked (20)

このあと滅茶苦茶LGTMした
このあと滅茶苦茶LGTMしたこのあと滅茶苦茶LGTMした
このあと滅茶苦茶LGTMした
 
cert
certcert
cert
 
Performance Monitoring for Docker Environments - Docker Amsterdam June Meetup
Performance Monitoring for Docker Environments - Docker Amsterdam June MeetupPerformance Monitoring for Docker Environments - Docker Amsterdam June Meetup
Performance Monitoring for Docker Environments - Docker Amsterdam June Meetup
 
Gobotについて
GobotについてGobotについて
Gobotについて
 
Discussing the difference between docker dontainers and virtual machines
Discussing the difference between docker dontainers and virtual machinesDiscussing the difference between docker dontainers and virtual machines
Discussing the difference between docker dontainers and virtual machines
 
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
 
Running Netflix OSS on Docker with Nirmata
Running Netflix OSS on Docker with NirmataRunning Netflix OSS on Docker with Nirmata
Running Netflix OSS on Docker with Nirmata
 
Docker Indy Meetup Monitoring 30-Aug-2016
Docker Indy Meetup Monitoring 30-Aug-2016Docker Indy Meetup Monitoring 30-Aug-2016
Docker Indy Meetup Monitoring 30-Aug-2016
 
Netflix and Containers: Not A Stranger Thing
Netflix and Containers:  Not A Stranger ThingNetflix and Containers:  Not A Stranger Thing
Netflix and Containers: Not A Stranger Thing
 
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
Microservices with Netflix OSS and Spring Cloud -  Dev Day OrangeMicroservices with Netflix OSS and Spring Cloud -  Dev Day Orange
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
 
NetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker TalkNetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker Talk
 
Microservices with Spring Cloud, Netflix OSS and Kubernetes
Microservices with Spring Cloud, Netflix OSS and Kubernetes Microservices with Spring Cloud, Netflix OSS and Kubernetes
Microservices with Spring Cloud, Netflix OSS and Kubernetes
 
Microservices and APIs
Microservices and APIsMicroservices and APIs
Microservices and APIs
 
Real world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShiftReal world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShift
 
Goだけでモバイルアプリを作る
Goだけでモバイルアプリを作るGoだけでモバイルアプリを作る
Goだけでモバイルアプリを作る
 
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
 
Learning the Alphabet: A/B, CD and [E-Z] in the Docker Datacenter by Brett Ti...
Learning the Alphabet: A/B, CD and [E-Z] in the Docker Datacenter by Brett Ti...Learning the Alphabet: A/B, CD and [E-Z] in the Docker Datacenter by Brett Ti...
Learning the Alphabet: A/B, CD and [E-Z] in the Docker Datacenter by Brett Ti...
 
Securing the Container Pipeline at Salesforce by Cem Gurkok
Securing the Container Pipeline at Salesforce by Cem Gurkok   Securing the Container Pipeline at Salesforce by Cem Gurkok
Securing the Container Pipeline at Salesforce by Cem Gurkok
 
Docker in Production, Look No Hands! by Scott Coulton
Docker in Production, Look No Hands! by Scott CoultonDocker in Production, Look No Hands! by Scott Coulton
Docker in Production, Look No Hands! by Scott Coulton
 
Build Fast, Deploy Fast: Innovating in the Enterprise by Imran Raja and Andy Lim
Build Fast, Deploy Fast: Innovating in the Enterprise by Imran Raja and Andy LimBuild Fast, Deploy Fast: Innovating in the Enterprise by Imran Raja and Andy Lim
Build Fast, Deploy Fast: Innovating in the Enterprise by Imran Raja and Andy Lim
 

Similar to Writing Docker monitoring agent with Go

Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
Bo-Yi Wu
 
Go Concurrency Patterns
Go Concurrency PatternsGo Concurrency Patterns
Go Concurrency Patterns
ElifTech
 
用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構
Bo-Yi Wu
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
Ortus Solutions, Corp
 
こわくないよ❤️ Playframeworkソースコードリーディング入門
こわくないよ❤️ Playframeworkソースコードリーディング入門こわくないよ❤️ Playframeworkソースコードリーディング入門
こわくないよ❤️ Playframeworkソースコードリーディング入門
tanacasino
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
A deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleA deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio module
Saúl Ibarra Corretgé
 
Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI
Ortus Solutions, Corp
 
Using zone.js
Using zone.jsUsing zone.js
Using zone.js
Standa Opichal
 
Beyond parallelize and collect - Spark Summit East 2016
Beyond parallelize and collect - Spark Summit East 2016Beyond parallelize and collect - Spark Summit East 2016
Beyond parallelize and collect - Spark Summit East 2016
Holden Karau
 
NDC Sydney 2019 - Async Demystified -- Karel Zikmund
NDC Sydney 2019 - Async Demystified -- Karel ZikmundNDC Sydney 2019 - Async Demystified -- Karel Zikmund
NDC Sydney 2019 - Async Demystified -- Karel Zikmund
Karel Zikmund
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scala
Ruslan Shevchenko
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
Frank Müller
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
Michiel Borkent
 
Lego: A brick system build by scala
Lego: A brick system build by scalaLego: A brick system build by scala
Lego: A brick system build by scalalunfu zhong
 
Concurrency in go
Concurrency in goConcurrency in go
Concurrency in go
borderj
 
Reitit - Clojure/North 2019
Reitit - Clojure/North 2019Reitit - Clojure/North 2019
Reitit - Clojure/North 2019
Metosin Oy
 
Building a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkBuilding a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and Spark
Evan Chan
 
Java 8
Java 8Java 8
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
Cheng-Yi Yu
 

Similar to Writing Docker monitoring agent with Go (20)

Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
 
Go Concurrency Patterns
Go Concurrency PatternsGo Concurrency Patterns
Go Concurrency Patterns
 
用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
 
こわくないよ❤️ Playframeworkソースコードリーディング入門
こわくないよ❤️ Playframeworkソースコードリーディング入門こわくないよ❤️ Playframeworkソースコードリーディング入門
こわくないよ❤️ Playframeworkソースコードリーディング入門
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
A deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleA deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio module
 
Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI
 
Using zone.js
Using zone.jsUsing zone.js
Using zone.js
 
Beyond parallelize and collect - Spark Summit East 2016
Beyond parallelize and collect - Spark Summit East 2016Beyond parallelize and collect - Spark Summit East 2016
Beyond parallelize and collect - Spark Summit East 2016
 
NDC Sydney 2019 - Async Demystified -- Karel Zikmund
NDC Sydney 2019 - Async Demystified -- Karel ZikmundNDC Sydney 2019 - Async Demystified -- Karel Zikmund
NDC Sydney 2019 - Async Demystified -- Karel Zikmund
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scala
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Lego: A brick system build by scala
Lego: A brick system build by scalaLego: A brick system build by scala
Lego: A brick system build by scala
 
Concurrency in go
Concurrency in goConcurrency in go
Concurrency in go
 
Reitit - Clojure/North 2019
Reitit - Clojure/North 2019Reitit - Clojure/North 2019
Reitit - Clojure/North 2019
 
Building a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkBuilding a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and Spark
 
Java 8
Java 8Java 8
Java 8
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 

Recently uploaded

Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 

Recently uploaded (20)

Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 

Writing Docker monitoring agent with Go

  • 2. About me • Naoki Ainoya( ainoya) • iOS(new!)/Server/Infra engineer • Swift/Scala/Go/Docker • Recruit Marketing Partners Co, Ltd.
  • 3. A tiny deployment pipeline tool Written in Go walter-cd/walter Open source project
  • 4. Introduction of Fune • An event emitter triggered by Docker Event API • The agent process (fune-agent) communicates with docker daemon via its socket • https://github.com/ainoya/fune Docker daemon Funeagent ConttainerA ConttainerB ConttainerC Nginx/Redis vulcand(etcd) Slack notification etc.. Listens docker events API notifies each containers are created/died/stopped/started Emits pluggable actions Your arbitrary docker ecosystem ECS/k8s/fleet/etc.. Docker Host Deploy containers
  • 5. Overview of Fune • Docker Events API provides a lifecycle of container as JSON format • create/start/die/stop
  • 6. Overview of Fune fune-agent listens these events Docker daemon Funeagent ConttainerA ConttainerB ConttainerC Listens docker events API notifies each containers are created/died/stopped/started Your arbitrary docker ecosystem ECS/k8s/fleet/etc.. Docker Host Deploy containers
  • 7. Overview of Fune fune-agent emits Action
 when received Docker events
 from event Docker daemon Funeagent ConttainerA ConttainerB Nginx/Redis vulcand(etcd) Slack notification etc.. Listens docker events API notifies each containers are created/died/stopped/started Emits pluggable actions Your arbitrary docker ecosystem ECS/k8s/fleet/etc.. Docker Host Deploy containers
  • 8. Overview of Fune Docker daemon Funeagent ConttainerA ConttainerB Nginx/Redis vulcand(etcd) Slack notification etc.. Listens docker events API notifies each containers are created/died/stopped/started Emits pluggable actions Your arbitrary docker ecosystem ECS/k8s/fleet/etc.. Docker Host Deploy containers • Action, for example; • Set/Del a container information to Redis as FQDN/IP:Port pair for proxy • Slack notification • More details are next time :)
  • 9. Today I talk about: • Some tips I learned with writing fune • Studied a lot of stuffs from coreos/etcd
  • 10. Setup project • Standard structure for 
 working with Godeps correctly • /src/github.com/ainoya/fune ./${GOPATH}/src !"" 9fans.net #   %"" go !"" code.google.com #   %"" p !"" github.com #   !"" ainoya/fune #   !"" barakmich #   !"" coreos etc...
  • 11. Godeps for the package dependencies • Using Godeps once, all dependencies copied into directory and rewrite import statement • Then you need Godeps command only if package dependency is added import "github.com/fsouza/go-dockerclient" // after `Godep save -r ./…` import "github.com/ainoya/fune/Godeps/_workspace/ src/github.com/fsouza/go-dockerclient"
  • 12. Godeps for the package dependencies • All dependencies are included in git repos • But it makes dirty commit log!! • Keep off its dirtiness by split commits :)
  • 13. How about vendor feature in go1.5? • go1.5 vendor feature have some problems yet • ex) go  tool  "./…" doesn't works well • https://github.com/golang/go/issues/11659 • See also ) http://deeeet.com/writing/2015/06/26/golang-dependency- vendoring/
  • 14. Write tests • Rerun automatically if files are changed • rerun is awesome! (but ruby tool gem) rerun -x -c -d directory1, directory2,... —pattern '**/*.{go}' -- go test ./...
  • 15. Be careful about race condition • Test with "-­‐race" option if you often use goroutine in your code • "-­‐cpu  N" option may reveal race condition you didn't expected • I use "go  test  ./…  -­‐race  -­‐cpu  1,2,4" inside test script WARNING: DATA RACE Write by goroutine 8: sync.raceWrite() /usr/local/Cellar/go/1.5/libexec/src/sync/race.go:41 +0x2e sync.(*WaitGroup).Wait() /usr/local/Cellar/go/1.5/libexec/src/sync/waitgroup.go:124 +0xf9 github.com/ainoya/fune/emitter.TestBroadCast() /Users/ainoya/.go/src/github.com/ainoya/fune/gopath/src/github.com/ ainoya/fune/emitter/emitter_test.go:57 +0x444 testing.tRunner() /usr/local/Cellar/go/1.5/libexec/src/testing/testing.go:456 +0xdc
  • 16. Is Go1.5 compilation time slower than 1.4? • "go  test" obviously takes time much longer • It's probably because of GoGo compiler performance
 Ref) Performance section of https://golang.org/doc/go1.5 • It should be improved with Go1.6
  • 17. Channel tips • coreos/etcd implements a shutdown feature with using close(channel) type  Server  struct  {     name        string     channel  chan  struct{}     done        chan  struct{}     stop        chan  struct{}   }   func  main()  {     done  :=  make(chan  struct{})     stop  :=  make(chan  struct{})     s  :=  &Server{done:  done,  stop:  stop,   hoge:  hoge}     go  s.run()     s.channel  <-­‐  struct{}{}     osutil.RegisterInterrputHandler(s.Stop)     <-­‐s.done   } func  (s  *Server)  run()  {     defer  func()  {  close(s.done)  }()     for  {       select  {       case  <-­‐s.channel:         fmt.Println("do  something")       case  <-­‐s.stop:         return       }     }   }   func  (s  *S)  Stop()  {     select  {     case  s.stop  <-­‐  struct{}{}:     case  <-­‐s.done:       return     }     <-­‐s.done   }  
  • 18. Channel tips • coreos/etcd implements a shutdown feature with using close(channel) type  Server  struct  {     name        string     channel  chan  struct{}     done        chan  struct{}     stop        chan  struct{}   }   func  main()  {     done  :=  make(chan  struct{})     stop  :=  make(chan  struct{})     s  :=  &Server{done:  done,  stop:  stop,   hoge:  hoge}     go  s.run()     s.channel  <-­‐  struct{}{}     osutil.RegisterInterrputHandler(s.Stop)     <-­‐s.done   } func  (s  *Server)  run()  {     defer  func()  {  close(s.done)  }()     for  {       select  {       case  <-­‐s.channel:         fmt.Println("do  something")       case  <-­‐s.stop:         return       }     }   }   func  (s  *S)  Stop()  {     select  {     case  s.stop  <-­‐  struct{}{}:     case  <-­‐s.done:       return     }     <-­‐s.done   }  
  • 19. Channel tips • coreos/etcd implements a shutdown feature with using close(channel) type  Server  struct  {     name        string     channel  chan  struct{}     done        chan  struct{}     stop        chan  struct{}   }   func  main()  {     done  :=  make(chan  struct{})     stop  :=  make(chan  struct{})     s  :=  &Server{done:  done,  stop:  stop,   hoge:  hoge}     go  s.run()     s.channel  <-­‐  struct{}{}     osutil.RegisterInterrputHandler(s.stop)     <-­‐s.done   } func  (s  *Server)  run()  {     defer  func()  {  close(s.done)  }()     for  {       select  {       case  <-­‐s.channel:         fmt.Println("do  something")       case  <-­‐s.stop:         return       }     }   }   func  (s  *S)  Stop()  {     select  {     case  s.stop  <-­‐  struct{}{}:     case  <-­‐s.done:       return     }     <-­‐s.done   }  
  • 20. Channel tips • coreos/etcd implements a shutdown feature with using close(channel) type  Server  struct  {     name        string     channel  chan  struct{}     done        chan  struct{}     stop        chan  struct{}   }   func  main()  {     done  :=  make(chan  struct{})     stop  :=  make(chan  struct{})     s  :=  &Server{done:  done,  stop:  stop,   hoge:  hoge}     go  s.run()     s.channel  <-­‐  struct{}{}     osutil.RegisterInterrputHandler(s.Stop)     <-­‐s.done   } func  (s  *Server)  run()  {     defer  func()  {  close(s.done)  }()     for  {       select  {       case  <-­‐s.channel:         fmt.Println("do  something")       case  <-­‐s.stop:         return       }     }   }   func  (s  *S)  Stop()  {     select  {     case  s.stop  <-­‐  struct{}{}:     case  <-­‐s.done:       return     }     <-­‐s.done   }  
  • 21. Channel tips • coreos/etcd implements a shutdown feature with using close(channel) type  Server  struct  {     name        string     channel  chan  struct{}     done        chan  struct{}     stop        chan  struct{}   }   func  main()  {     done  :=  make(chan  struct{})     stop  :=  make(chan  struct{})     s  :=  &Server{done:  done,  stop:  stop,   hoge:  hoge}     go  s.run()     s.channel  <-­‐  struct{}{}     osutil.RegisterInterrputHandler(s.Stop)     <-­‐s.done   } func  (s  *Server)  run()  {     defer  func()  {  close(s.done)  }()     for  {       select  {       case  <-­‐s.channel:         fmt.Println("do  something")       case  <-­‐s.stop:         return       }     }   }   func  (s  *S)  Stop()  {     select  {     case  s.stop  <-­‐  struct{}{}:     case  <-­‐s.done:       return     }     <-­‐s.done   }  
  • 22. Test goroutine easily "s.done" channel makes testing goroutine easily //  https://github.com/coreos/etcd/blob/master/etcdserver/ server_test.go#L1031   //  TestPublishRetry  tests  that  publish  will  keep  retry  until  success.   func  TestPublishRetry(t  *testing.T)  {     n  :=  &nodeRecorder{}     srv  :=  &EtcdServer{       cfg:            &ServerConfig{TickMs:  1},       r:                raftNode{Node:  n},       w:                &waitRecorder{},       done:          make(chan  struct{}),       reqIDGen:  idutil.NewGenerator(0,  time.Time{}),     }     time.AfterFunc(500*time.Microsecond,  func()  {  close(srv.done)  })     srv.publish(10  *  time.Nanosecond)  
  • 23. Run go as Docker container • Go single binary with "SCRATCH" • You can run a go stuff inside extremely simple container! FROM  scratch   EXPOSE  8080   COPY  your-­‐golang-­‐app  /app/your-­‐golang-­‐app   ENV  PATH=/app:$PATH   ENTRYPOINT  ["/app/your-­‐golang-­‐app"]   CMD  ["-­‐some-­‐option=haha"]
  • 24. Round up • Learned a lot of stuffs from well-knowned products (coreos/etcd) • project structure, test, golang-way
  • 25. See you next kyobashi.*! • 9/7: kyobashi.dex • 9/16: potatotips • ???: kyobashi.???