Skip to content

Commit 8986edb

Browse files
authored
🔧 Instrument gateway process (#256)
1 parent 70f1207 commit 8986edb

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

go.mod

+10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ require (
2020
github.com/stretchr/testify v1.9.0
2121
github.com/swaggo/swag v1.16.3
2222
go.opentelemetry.io/contrib/exporters/autoexport v0.51.0
23+
go.opentelemetry.io/contrib/instrumentation/host v0.51.0
24+
go.opentelemetry.io/contrib/instrumentation/runtime v0.51.0
2325
go.opentelemetry.io/contrib/propagators/b3 v1.26.0
2426
go.opentelemetry.io/otel v1.26.0
2527
go.opentelemetry.io/otel/sdk v1.26.0
@@ -52,6 +54,7 @@ require (
5254
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
5355
github.com/go-logr/logr v1.4.1 // indirect
5456
github.com/go-logr/stdr v1.2.2 // indirect
57+
github.com/go-ole/go-ole v1.2.6 // indirect
5558
github.com/go-openapi/jsonpointer v0.20.2 // indirect
5659
github.com/go-openapi/jsonreference v0.20.4 // indirect
5760
github.com/go-openapi/spec v0.20.13 // indirect
@@ -63,22 +66,29 @@ require (
6366
github.com/josharian/intern v1.0.0 // indirect
6467
github.com/klauspost/compress v1.17.6 // indirect
6568
github.com/leodido/go-urn v1.2.4 // indirect
69+
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
6670
github.com/mailru/easyjson v0.7.7 // indirect
6771
github.com/mattn/go-colorable v0.1.13 // indirect
6872
github.com/mattn/go-isatty v0.0.20 // indirect
6973
github.com/mattn/go-runewidth v0.0.15 // indirect
7074
github.com/pmezard/go-difflib v1.0.0 // indirect
75+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
7176
github.com/prometheus/client_golang v1.19.0 // indirect
7277
github.com/prometheus/client_model v0.6.1 // indirect
7378
github.com/prometheus/common v0.48.0 // indirect
7479
github.com/prometheus/procfs v0.12.0 // indirect
7580
github.com/rivo/uniseg v0.4.7 // indirect
7681
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect
82+
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
83+
github.com/shoenig/go-m1cpu v0.1.6 // indirect
7784
github.com/spf13/pflag v1.0.5 // indirect
7885
github.com/swaggo/files/v2 v2.0.0 // indirect
86+
github.com/tklauser/go-sysconf v0.3.12 // indirect
87+
github.com/tklauser/numcpus v0.6.1 // indirect
7988
github.com/valyala/bytebufferpool v1.0.0 // indirect
8089
github.com/valyala/fasthttp v1.52.0 // indirect
8190
github.com/valyala/tcplisten v1.0.0 // indirect
91+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
8292
go.opentelemetry.io/contrib v1.17.0 // indirect
8393
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.26.0 // indirect
8494
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.26.0 // indirect

go.sum

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/gateway.go

+13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99

1010
"github.com/EinStack/glide/pkg/routers"
1111
"github.com/EinStack/glide/pkg/version"
12+
"go.opentelemetry.io/contrib/instrumentation/host"
13+
"go.opentelemetry.io/contrib/instrumentation/runtime"
1214

1315
"github.com/EinStack/glide/pkg/config"
1416

@@ -68,6 +70,17 @@ func NewGateway(configProvider *config.Provider) (*Gateway, error) {
6870

6971
// Run starts and runs the gateway according to given configuration
7072
func (gw *Gateway) Run(ctx context.Context) error {
73+
// Instrument the gateway process
74+
err := host.Start()
75+
if err != nil {
76+
return err
77+
}
78+
79+
err = runtime.Start()
80+
if err != nil {
81+
return err
82+
}
83+
7184
gw.configProvider.Start()
7285
gw.serverManager.Start() //nolint:contextcheck
7386

0 commit comments

Comments
 (0)