1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:54:42 -07:00
go/internal/lsp/telemetry/telemetry.go
Ian Cottrell 75a6f91e26 internal/lsp: add the new form of the telemetry tagging package
This maps more directly to the basic telementery tagging requirements and uses
the context package in a way that is more idomatic.

Change-Id: If08c429b897bddfe014224ac2d92d7796a521ab9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184941
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-09 19:46:06 +00:00

40 lines
965 B
Go

// 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 telemetry provides the hooks and adapters to allow use of telemetry
// throughout gopls.
package telemetry
import (
"net/http"
"golang.org/x/tools/internal/lsp/telemetry/stats"
"golang.org/x/tools/internal/lsp/telemetry/tag"
)
const (
// create the tag keys we use
Method = tag.Key("method")
StatusCode = tag.Key("status.code")
StatusMessage = tag.Key("status.message")
RPCID = tag.Key("id")
RPCDirection = tag.Key("direction")
File = tag.Key("file")
Package = tag.Key("package")
)
var (
Handle = func(mux *http.ServeMux) {}
Started = stats.NullInt64Measure()
ReceivedBytes = stats.NullInt64Measure()
SentBytes = stats.NullInt64Measure()
Latency = stats.NullFloat64Measure()
)
const (
Inbound = "in"
Outbound = "out"
)