diff options
Diffstat (limited to 'internal/event')
-rw-r--r-- | internal/event/export/ocagent/wire/metrics.go | 14 | ||||
-rw-r--r-- | internal/event/export/trace.go | 2 | ||||
-rw-r--r-- | internal/event/tag/tag.go | 59 |
3 files changed, 70 insertions, 5 deletions
diff --git a/internal/event/export/ocagent/wire/metrics.go b/internal/event/export/ocagent/wire/metrics.go index 4cfdb88bf..6cb58943c 100644 --- a/internal/event/export/ocagent/wire/metrics.go +++ b/internal/event/export/ocagent/wire/metrics.go @@ -71,9 +71,12 @@ type PointInt64Value struct { // OpenCensus service can correctly determine the underlying value type. // This custom MarshalJSON exists because, // by default *Point is JSON marshalled as: -// {"value": {"int64Value": 1}} +// +// {"value": {"int64Value": 1}} +// // but it should be marshalled as: -// {"int64Value": 1} +// +// {"int64Value": 1} func (p *Point) MarshalJSON() ([]byte, error) { if p == nil { return []byte("null"), nil @@ -158,9 +161,12 @@ type bucketOptionsExplicitAlias BucketOptionsExplicit // OpenCensus service can correctly determine the underlying value type. // This custom MarshalJSON exists because, // by default BucketOptionsExplicit is JSON marshalled as: -// {"bounds":[1,2,3]} +// +// {"bounds":[1,2,3]} +// // but it should be marshalled as: -// {"explicit":{"bounds":[1,2,3]}} +// +// {"explicit":{"bounds":[1,2,3]}} func (be *BucketOptionsExplicit) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Explicit *bucketOptionsExplicitAlias `json:"explicit,omitempty"` diff --git a/internal/event/export/trace.go b/internal/event/export/trace.go index 1a99482f1..79aebbaca 100644 --- a/internal/event/export/trace.go +++ b/internal/event/export/trace.go @@ -90,7 +90,7 @@ func (s *SpanContext) Format(f fmt.State, r rune) { } func (s *Span) Start() core.Event { - // start never changes after construction, so we dont need to hold the mutex + // start never changes after construction, so we don't need to hold the mutex return s.start } diff --git a/internal/event/tag/tag.go b/internal/event/tag/tag.go new file mode 100644 index 000000000..ff2f2ecd3 --- /dev/null +++ b/internal/event/tag/tag.go @@ -0,0 +1,59 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package tag provides the labels used for telemetry throughout gopls. +package tag + +import ( + "golang.org/x/tools/internal/event/keys" +) + +var ( + // create the label keys we use + Method = keys.NewString("method", "") + StatusCode = keys.NewString("status.code", "") + StatusMessage = keys.NewString("status.message", "") + RPCID = keys.NewString("id", "") + RPCDirection = keys.NewString("direction", "") + File = keys.NewString("file", "") + Directory = keys.New("directory", "") + URI = keys.New("URI", "") + Package = keys.NewString("package", "") // Package ID + PackagePath = keys.NewString("package_path", "") + Query = keys.New("query", "") + Snapshot = keys.NewUInt64("snapshot", "") + Operation = keys.NewString("operation", "") + + Position = keys.New("position", "") + Category = keys.NewString("category", "") + PackageCount = keys.NewInt("packages", "") + Files = keys.New("files", "") + Port = keys.NewInt("port", "") + Type = keys.New("type", "") + HoverKind = keys.NewString("hoverkind", "") + + NewServer = keys.NewString("new_server", "A new server was added") + EndServer = keys.NewString("end_server", "A server was shut down") + + ServerID = keys.NewString("server", "The server ID an event is related to") + Logfile = keys.NewString("logfile", "") + DebugAddress = keys.NewString("debug_address", "") + GoplsPath = keys.NewString("gopls_path", "") + ClientID = keys.NewString("client_id", "") + + Level = keys.NewInt("level", "The logging level") +) + +var ( + // create the stats we measure + Started = keys.NewInt64("started", "Count of started RPCs.") + ReceivedBytes = keys.NewInt64("received_bytes", "Bytes received.") //, unit.Bytes) + SentBytes = keys.NewInt64("sent_bytes", "Bytes sent.") //, unit.Bytes) + Latency = keys.NewFloat64("latency_ms", "Elapsed time in milliseconds") //, unit.Milliseconds) +) + +const ( + Inbound = "in" + Outbound = "out" +) |