Skip to content
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

SHOW DIAGNOSTICS command #2061

Merged
merged 6 commits into from
Mar 24, 2015
Merged

SHOW DIAGNOSTICS command #2061

merged 6 commits into from
Mar 24, 2015

Conversation

otoolep
Copy link
Contributor

@otoolep otoolep commented Mar 24, 2015

No description provided.

@@ -93,6 +99,10 @@ type Server struct {
// is just getting the request after being off duty for running CQs then
// it will recompute all of them
lastContinuousQueryRun time.Time

// Build information.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's important the server object get this stuff, so it be dumped by the diags. I am open to other approaches.

@otoolep otoolep changed the title SHOW DIAGS command SHOW DIAGNOSTICS command Mar 24, 2015
func (s *Server) executeShowDiagnosticsStatement(stmt *influxql.ShowDiagnosticsStatement, user *User) *Result {
rows := make([]*influxql.Row, 0)

// Build information.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this more table-driven, stand by.

@otoolep
Copy link
Contributor Author

otoolep commented Mar 24, 2015

Table-driven code put in place. Green build.

@otoolep otoolep force-pushed the show_diags_command branch 4 times, most recently from f9da484 to e5907e6 Compare March 24, 2015 06:38
@otoolep
Copy link
Contributor Author

otoolep commented Mar 24, 2015

$ curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "q=SHOW DIAGNOSTICS"
{
    "results": [
        {
            "series": [
                {
                    "name": "build",
                    "columns": [
                        "time",
                        "commitHash",
                        "version"
                    ],
                    "values": [
                        [
                            "2015-03-24T16:26:45.190882079Z",
                            "unknown",
                            "0.9"
                        ]
                    ]
                },
                {
                    "name": "server",
                    "columns": [
                        "time",
                        "authEnabled",
                        "id",
                        "index",
                        "numShards",
                        "path",
                        "retentionAutoCreate"
                    ],
                    "values": [
                        [
                            "2015-03-24T16:26:45.190882079Z",
                            false,
                            1,
                            7,
                            1,
                            "/home/philip/.influxdb/data",
                            true
                        ]
                    ]
                },
                {
                    "name": "cq",
                    "columns": [
                        "time",
                        "lastRun"
                    ],
                    "values": [
                        [
                            "2015-03-24T16:26:45.190882079Z",
                            "0001-01-01T00:00:00Z"
                        ]
                    ]
                },
                {
                    "name": "system",
                    "columns": [
                        "time",
                        "arch",
                        "hostname",
                        "numcpu",
                        "os",
                        "pid",
                        "startTime",
                        "uptime"
                    ],
                    "values": [
                        [
                            "2015-03-24T16:26:45.190882079Z",
                            "amd64",
                            "marx",
                            8,
                            "linux",
                            6047,
                            "2015-03-24T16:26:41.947782722Z",
                            "3.243141953s"
                        ]
                    ]
                },
                {
                    "name": "memory",
                    "columns": [
                        "time",
                        "alloc",
                        "frees",
                        "heapAlloc",
                        "heapIdle",
                        "heapInUse",
                        "heapObjects",
                        "heapReleased",
                        "heapSys",
                        "lookups",
                        "mallocs",
                        "numGC",
                        "pauseTotalNs",
                        "sys",
                        "totalAlloc"
                    ],
                    "values": [
                        [
                            "2015-03-24T16:26:45.190882079Z",
                            548528,
                            9525,
                            548528,
                            737280,
                            884736,
                            3009,
                            0,
                            1622016,
                            147,
                            12534,
                            9,
                            4487713,
                            3999992,
                            1531200
                        ]
                    ]
                },
                {
                    "name": "go",
                    "columns": [
                        "time",
                        "goMaxProcs",
                        "numGoroutine",
                        "version"
                    ],
                    "values": [
                        [
                            "2015-03-24T16:26:45.190882079Z",
                            1,
                            41,
                            "go1.4"
                        ]
                    ]
                },
                {
                    "name": "shardGroups",
                    "columns": [
                        "time",
                        "database",
                        "retentionPolicy",
                        "id",
                        "startTime",
                        "endTime",
                        "duration",
                        "numShards"
                    ],
                    "values": [
                        [
                            "2015-03-24T16:26:45.190882079Z",
                            "internal",
                            "default",
                            1,
                            "2015-03-23T00:00:00Z",
                            "2015-03-30T00:00:00Z",
                            "168h0m0s",
                            1
                        ]
                    ]
                },
                {
                    "name": "shards",
                    "columns": [
                        "time",
                        "id",
                        "dataNodes",
                        "index",
                        "path"
                    ],
                    "values": [
                        [
                            "2015-03-24T16:26:45.190882079Z",
                            1,
                            "1",
                            8,
                            "/home/philip/.influxdb/data/shards/1"
                        ]
                    ]
                }
            ]
        }
    ]
}

@toddboom
Copy link
Contributor

👍

Very exciting!

otoolep added a commit that referenced this pull request Mar 24, 2015
@otoolep otoolep merged commit bfad9a1 into master Mar 24, 2015
@otoolep otoolep deleted the show_diags_command branch March 24, 2015 19:25
"version": runtime.Version(),
},
},
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be easier to use this data from a client or another system if it were a type:


type Diagnostics struct {
    Build struct {
        Version    string `json:"version"`
        CommitHash string `json:"commitHash"`
    } `json:"build"`

    Server struct {
        ID          string `json:"id"`
        Path        string `json:"path"`
        AuthEnabled bool   `json:"authenticationEnabled"`
        ...
    }
}

And then you can get the current Diagnostics type using NewDiagnostics(). That would shorten this function quite a bit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe name it Stats instead -- similar to MemStats.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about something along those lines this morning, but it wasn't clear exactly what to do.

The Diagnostics type needs information from various components -- the server, build information, Go runtime, indexes. Which part of the code fills in the values? I want to do something like this, as I want to factor out this code next so that it can be written to the database (like the stats) every minute or so.

Let me know what you have in mind, as I was going to something like this next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants