-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete diagnostics support #3969
Conversation
9429ce5
to
88e69b7
Compare
613ad93
to
0303154
Compare
0303154
to
43a3be9
Compare
Example of retrieving Go heap in use from
|
@@ -223,8 +265,10 @@ func (s *Service) openTCPServer() (net.Addr, error) { | |||
// handleTCPConnection services an individual TCP connection for the Graphite input. | |||
func (s *Service) handleTCPConnection(conn net.Conn) { | |||
defer conn.Close() | |||
defer removeConnection(conn) | |||
defer s.wg.Done() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this wasn't part of this PR but should s.wg.Done()
be moved up so it's the first defer
since defered funcs execute in LIFO order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
On Thursday, September 3, 2015, dgnorton notifications@github.com wrote:
In services/graphite/service.go
#3969 (comment):@@ -223,8 +265,10 @@ func (s *Service) openTCPServer() (net.Addr, error) {
// handleTCPConnection services an individual TCP connection for the Graphite input.
func (s *Service) handleTCPConnection(conn net.Conn) {
defer conn.Close()
- defer removeConnection(conn)
defer s.wg.Done()I know this wasn't part of this PR but should s.wg.Done() be moved up so
it's the first defer since defered funcs execute in LIFO order?—
Reply to this email directly or view it on GitHub
https://github.com/influxdb/influxdb/pull/3969/files#r38712841.
I haven't used |
Not by default in our system. I needed to hook it up in the On Thu, Sep 3, 2015 at 5:50 PM, dgnorton notifications@github.com wrote:
|
Actually https://github.com/influxdb/influxdb/blob/master/services/httpd/handler.go#L166 |
Why are the stats vars in the |
@@ -64,8 +107,12 @@ func New(c Config) *Monitor { | |||
func (m *Monitor) Open() error { | |||
m.Logger.Printf("Starting monitor system") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a nit, and I'm not sure how to get around this yet, for testing, you can't silence this as it will "Open" from the server before you can call "SetLogger" on it to null it out. I get a lot of chatter in my test output because of it. I would like to find a better way to do this.
Good question. What would you tag the metrics for an individual service with, such that it RegisterStatsClient(name string, tags map[string]string, client StatsClient) On Thu, Sep 3, 2015 at 6:11 PM, dgnorton notifications@github.com wrote:
|
Quite a bit in here, but nothing jumped out at me. Super excited to start using this. +1 |
I could use a simple index, but that will need to be global for the On Thu, Sep 3, 2015 at 6:13 PM, Philip O'Toole philip@influxdb.com wrote:
|
Yeah, local port seems logical. Or, maybe addr and port. |
Makes good sense @dgnorton -- I will make that change. I think when I started the code looked a bit different, but made changes later on to make tagging easy...and then forgot to use the port tag here. |
@dgnorton -- as much as possible pushed onto the service. expvar stats are now per bound service, and the stats are suitably tagged with new
|
3f64b2d
to
702a011
Compare
This change adds support for diagnostics by decomposing the existing interface into two interfaces -- one for stats, and the other for diags. It also adds some basic monitor of system, network, and the Go runtime.
Graphite diagnostics currently show TCP connections.
702a011
to
6ad35e2
Compare
Green build, let me know if you think this is good @dgnorton |
} | ||
|
||
var tcpConnectionsMu sync.Mutex | ||
var tcpConnections map[string]*tcpConnectionDiag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not track connections in the service also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly because I went for a simple diagnostics display, something like you
get when you run netstat - a single table showing all connections to
Graphite, not broken down by individual Graphite inputs. It's clear anyway
because the table shows source and dest IP.
I did not break stats down by connection because someone that uses a lot of
different connections that come and might start creating a lot of stats
noise - and series.
On Friday, September 4, 2015, dgnorton notifications@github.com wrote:
In services/graphite/service.go
#3969 (comment):-// Build the graphite expvar hierarchy.
-func init() {
- statMap.Set("tcp", statMapTCP)
- statMap.Set("udp", statMapUDP)
+type tcpConnectionDiag struct {- conn net.Conn
- connectTime time.Time
+}
+var tcpConnectionsMu sync.Mutex
+var tcpConnections map[string]*tcpConnectionDiagWhy not track connections in the service also?
—
Reply to this email directly or view it on GitHub
https://github.com/influxdb/influxdb/pull/3969/files#r38747327.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Connections that come and go that is, from different IPs. If this turns out
not to be an issue in practice we can change it.
On Friday, September 4, 2015, Philip O'Toole philip@influxdb.com wrote:
Mostly because I went for a simple diagnostics display, something like you
get when you run netstat - a single table showing all connections to
Graphite, not broken down by individual Graphite inputs. It's clear anyway
because the table shows source and dest IP.I did not break stats down by connection because someone that uses a lot
of different connections that come and might start creating a lot of stats
noise - and series.On Friday, September 4, 2015, dgnorton <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:In services/graphite/service.go
#3969 (comment):-// Build the graphite expvar hierarchy.
-func init() {
- statMap.Set("tcp", statMapTCP)
- statMap.Set("udp", statMapUDP)
+type tcpConnectionDiag struct {- conn net.Conn
- connectTime time.Time
+}
+var tcpConnectionsMu sync.Mutex
+var tcpConnections map[string]*tcpConnectionDiagWhy not track connections in the service also?
—
Reply to this email directly or view it on GitHub
https://github.com/influxdb/influxdb/pull/3969/files#r38747327.
+1 |
Thanks for the reviews @corylanou and @dgnorton |
This change adds support for diagnostics by decomposing the existing interface into two interfaces -- one for stats, and the other for diags. It also adds some basic monitor of system, network, and the Go runtime. The format of diagnostics is deliberately loose, as each module will have different data to report.
This change also adds diagnostics support for Graphite. It shows all current TCP connections, as well as the connect time of each.
Example output:
Lots more to come as individual packages are instrumented.