mirror of
https://github.com/golang/go
synced 2024-11-19 02:04:42 -07:00
156eb2ae29
This is a straight move of some code with no changes. It splits the part of the telemetry code that will become a standalone library from the bit that belongs in the lsp. Change-Id: Icedb6bf1f3711da9251450531729984df6df7787 Reviewed-on: https://go-review.googlesource.com/c/tools/+/190403 Run-TryBot: Ian Cottrell <iancottrell@google.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
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 (
|
|
"golang.org/x/tools/internal/telemetry/stats"
|
|
"golang.org/x/tools/internal/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 (
|
|
// create the stats we measure
|
|
Started = stats.Int64("started", "Count of started RPCs.", stats.UnitDimensionless)
|
|
ReceivedBytes = stats.Int64("received_bytes", "Bytes received.", stats.UnitBytes)
|
|
SentBytes = stats.Int64("sent_bytes", "Bytes sent.", stats.UnitBytes)
|
|
Latency = stats.Float64("latency_ms", "Elapsed time in milliseconds", stats.UnitMilliseconds)
|
|
)
|
|
|
|
const (
|
|
Inbound = "in"
|
|
Outbound = "out"
|
|
)
|