/
telemetry.go
42 lines (37 loc) · 1.36 KB
/
telemetry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// 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 (
"github.com/anz-bank/sysl/pkg/lspimpl/lspframework/telemetry/stats"
"github.com/anz-bank/sysl/pkg/lspimpl/lspframework/telemetry/tag"
"github.com/anz-bank/sysl/pkg/lspimpl/lspframework/telemetry/unit"
)
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")
Directory = tag.Key("directory")
URI = tag.Key("URI")
Package = tag.Key("package")
PackagePath = tag.Key("package_path")
Query = tag.Key("query")
Snapshot = tag.Key("snapshot")
)
var (
// create the stats we measure
Started = stats.Int64("started", "Count of started RPCs.", unit.Dimensionless)
ReceivedBytes = stats.Int64("received_bytes", "Bytes received.", unit.Bytes)
SentBytes = stats.Int64("sent_bytes", "Bytes sent.", unit.Bytes)
Latency = stats.Float64("latency_ms", "Elapsed time in milliseconds", unit.Milliseconds)
)
const (
Inbound = "in"
Outbound = "out"
)