1// Copyright 2019 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Package telemetry provides the hooks and adapters to allow use of telemetry
6// throughout gopls.
7package telemetry
8
9import (
10	"golang.org/x/tools/internal/telemetry/stats"
11	"golang.org/x/tools/internal/telemetry/tag"
12	"golang.org/x/tools/internal/telemetry/unit"
13)
14
15const (
16	// create the tag keys we use
17	Method        = tag.Key("method")
18	StatusCode    = tag.Key("status.code")
19	StatusMessage = tag.Key("status.message")
20	RPCID         = tag.Key("id")
21	RPCDirection  = tag.Key("direction")
22	File          = tag.Key("file")
23	URI           = tag.Key("URI")
24	Package       = tag.Key("package")
25	PackagePath   = tag.Key("package_path")
26)
27
28var (
29	// create the stats we measure
30	Started       = stats.Int64("started", "Count of started RPCs.", unit.Dimensionless)
31	ReceivedBytes = stats.Int64("received_bytes", "Bytes received.", unit.Bytes)
32	SentBytes     = stats.Int64("sent_bytes", "Bytes sent.", unit.Bytes)
33	Latency       = stats.Float64("latency_ms", "Elapsed time in milliseconds", unit.Milliseconds)
34)
35
36const (
37	Inbound  = "in"
38	Outbound = "out"
39)
40