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

introspection: Add go version and library version #457

Merged
merged 1 commit into from
Jul 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ type IntrospectionOptions struct {
IncludeTombstones bool `json:"includeTombstones"`
}

// RuntimeVersion includes version information about the runtime and
// the tchannel library.
type RuntimeVersion struct {
GoVersion string `json:"goVersion"`
LibraryVersion string `json:"tchannelVersion"`
}

// RuntimeState is a snapshot of the runtime state for a channel.
type RuntimeState struct {
// CreatedStack is the stack for how this channel was created.
Expand All @@ -66,6 +73,9 @@ type RuntimeState struct {

// OtherChannels is information about any other channels running in this process.
OtherChannels map[string][]ChannelInfo `json:"otherChannels,omitEmpty"`

// RuntimeVersion is the version information about the runtime and the library.
RuntimeVersion RuntimeVersion `json:"runtimeVersion"`
}

// GoRuntimeStateOptions are the options used when getting Go runtime state.
Expand Down Expand Up @@ -201,6 +211,7 @@ func (ch *Channel) IntrospectState(opts *IntrospectionOptions) *RuntimeState {
NumConnections: numConns,
Connections: connIDs,
OtherChannels: ch.IntrospectOthers(opts),
RuntimeVersion: introspectRuntimeVersion(),
}
}

Expand Down Expand Up @@ -447,6 +458,13 @@ func handleInternalRuntime(arg3 []byte) interface{} {
return state
}

func introspectRuntimeVersion() RuntimeVersion {
return RuntimeVersion{
GoVersion: runtime.Version(),
LibraryVersion: VersionInfo,
}
}

// registerInternal registers the following internal handlers which return runtime state:
// _gometa_introspect: TChannel internal state.
// _gometa_runtime: Golang runtime stats.
Expand Down