diff --git a/cmd/chotel/main.go b/cmd/chotel/main.go index 2f983c65..0d9b0afb 100644 --- a/cmd/chotel/main.go +++ b/cmd/chotel/main.go @@ -35,7 +35,7 @@ import ( ) func main() { - app.Run(func(ctx context.Context, lg *zap.Logger, m *app.Metrics) (err error) { + app.Run(func(ctx context.Context, lg *zap.Logger, m *app.Telemetry) (err error) { a, err := NewApp(lg, m) if err != nil { return errors.Wrap(err, "init") @@ -47,7 +47,7 @@ func main() { // App is the trace exporter application. type App struct { log *zap.Logger - metrics *app.Metrics + metrics *app.Telemetry clickHouseAddr string clickHousePassword string @@ -75,7 +75,7 @@ const DDL = `CREATE TABLE IF NOT EXISTS opentelemetry_span_export ` // NewApp initializes the trace exporter application. -func NewApp(lg *zap.Logger, metrics *app.Metrics) (*App, error) { +func NewApp(lg *zap.Logger, metrics *app.Telemetry) (*App, error) { a := &App{ log: lg, metrics: metrics, diff --git a/cmd/otelbot/app.go b/cmd/otelbot/app.go index 871b1bca..8e58994c 100644 --- a/cmd/otelbot/app.go +++ b/cmd/otelbot/app.go @@ -8,7 +8,7 @@ import ( "golang.org/x/sync/errgroup" ) -func newApp(cfg Config, m *app.Metrics) (*App, error) { +func newApp(cfg Config, m *app.Telemetry) (*App, error) { cfg.setDefaults() a := &App{ cfg: cfg, @@ -24,7 +24,7 @@ func newApp(cfg Config, m *app.Metrics) (*App, error) { type App struct { cfg Config - metrics *app.Metrics + metrics *app.Telemetry services map[string]func(context.Context) error } diff --git a/cmd/otelbot/main.go b/cmd/otelbot/main.go index 76fb0de8..ac031486 100644 --- a/cmd/otelbot/main.go +++ b/cmd/otelbot/main.go @@ -13,7 +13,7 @@ import ( ) func main() { - app.Run(func(ctx context.Context, lg *zap.Logger, m *app.Metrics) error { + app.Run(func(ctx context.Context, lg *zap.Logger, m *app.Telemetry) error { shutdown, err := autozpages.Setup(m.TracerProvider()) if err != nil { return errors.Wrap(err, "setup zPages") diff --git a/cmd/oteldb/app.go b/cmd/oteldb/app.go index 3914b053..5ef6e30b 100644 --- a/cmd/oteldb/app.go +++ b/cmd/oteldb/app.go @@ -43,10 +43,10 @@ type App struct { otelStorage lg *zap.Logger - metrics *sdkapp.Metrics + metrics *sdkapp.Telemetry } -func newApp(ctx context.Context, cfg Config, m *sdkapp.Metrics) (_ *App, err error) { +func newApp(ctx context.Context, cfg Config, m *sdkapp.Telemetry) (_ *App, err error) { cfg.setDefaults() app := &App{ diff --git a/cmd/oteldb/oteldb.go b/cmd/oteldb/oteldb.go index 62c5fb0a..f60bb579 100644 --- a/cmd/oteldb/oteldb.go +++ b/cmd/oteldb/oteldb.go @@ -14,7 +14,7 @@ import ( ) func main() { - app.Run(func(ctx context.Context, lg *zap.Logger, m *app.Metrics) error { + app.Run(func(ctx context.Context, lg *zap.Logger, m *app.Telemetry) error { shutdown, err := autozpages.Setup(m.TracerProvider()) if err != nil { return errors.Wrap(err, "setup zPages") diff --git a/cmd/oteldb/storage.go b/cmd/oteldb/storage.go index 7d3596fb..4f2102db 100644 --- a/cmd/oteldb/storage.go +++ b/cmd/oteldb/storage.go @@ -42,7 +42,7 @@ func setupCH( dsn string, ttl time.Duration, lg *zap.Logger, - m *app.Metrics, + m *app.Telemetry, ) (store otelStorage, _ error) { c, err := chstorage.Dial(ctx, dsn, chstorage.DialOptions{ MeterProvider: m.MeterProvider(), diff --git a/cmd/oteldemo/client.go b/cmd/oteldemo/client.go index 81e70553..1c22a531 100644 --- a/cmd/oteldemo/client.go +++ b/cmd/oteldemo/client.go @@ -12,7 +12,7 @@ import ( "go.uber.org/zap" ) -func client(ctx context.Context, lg *zap.Logger, m *app.Metrics) error { +func client(ctx context.Context, lg *zap.Logger, m *app.Telemetry) error { httpTransport := otelhttp.NewTransport(http.DefaultTransport, otelhttp.WithTracerProvider(m.TracerProvider()), otelhttp.WithMeterProvider(m.MeterProvider()), diff --git a/cmd/oteldemo/server.go b/cmd/oteldemo/server.go index 036123b4..53118373 100644 --- a/cmd/oteldemo/server.go +++ b/cmd/oteldemo/server.go @@ -18,7 +18,7 @@ import ( "golang.org/x/sync/errgroup" ) -func server(ctx context.Context, lg *zap.Logger, m *app.Metrics) error { +func server(ctx context.Context, lg *zap.Logger, m *app.Telemetry) error { g, ctx := errgroup.WithContext(ctx) mux := http.NewServeMux() diff --git a/cmd/otelproxy/main.go b/cmd/otelproxy/main.go index d0136fbc..3869d360 100644 --- a/cmd/otelproxy/main.go +++ b/cmd/otelproxy/main.go @@ -33,7 +33,7 @@ type service struct { cleanup func() error } -func (s service) Run(ctx context.Context, lg *zap.Logger, m *app.Metrics) error { +func (s service) Run(ctx context.Context, lg *zap.Logger, m *app.Telemetry) error { if s.cleanup != nil { defer func() { if err := s.cleanup(); err != nil { @@ -74,7 +74,7 @@ func (s service) Run(ctx context.Context, lg *zap.Logger, m *app.Metrics) error } // ServiceMiddleware is a generic middleware for any service. -func ServiceMiddleware(s service, lg *zap.Logger, m *app.Metrics) http.Handler { +func ServiceMiddleware(s service, lg *zap.Logger, m *app.Telemetry) http.Handler { return httpmiddleware.Wrap(s.handler, httpmiddleware.InjectLogger(lg), httpmiddleware.Instrument(s.name, s.findRoute, m), @@ -98,7 +98,7 @@ func (s *services) addService(addr string, srv service) error { return nil } -func (s *services) Prometheus(m *app.Metrics) error { +func (s *services) Prometheus(m *app.Telemetry) error { const ( prefix = "PROMETHEUS" defaultPort = ":9090" @@ -156,7 +156,7 @@ func (s *services) Prometheus(m *app.Metrics) error { }) } -func (s *services) Loki(m *app.Metrics) error { +func (s *services) Loki(m *app.Telemetry) error { const ( prefix = "LOKI" defaultPort = ":3100" @@ -196,7 +196,7 @@ func (s *services) Loki(m *app.Metrics) error { }) } -func (s *services) Pyroscope(m *app.Metrics) error { +func (s *services) Pyroscope(m *app.Telemetry) error { const ( prefix = "PYROSCOPE" defaultPort = ":4040" @@ -236,7 +236,7 @@ func (s *services) Pyroscope(m *app.Metrics) error { }) } -func (s *services) Tempo(m *app.Metrics) error { +func (s *services) Tempo(m *app.Telemetry) error { const ( prefix = "TEMPO" defaultPort = ":3200" @@ -276,7 +276,7 @@ func (s *services) Tempo(m *app.Metrics) error { }) } -func (s *services) httpClient(wrap TransportMiddleware, m *app.Metrics) *http.Client { +func (s *services) httpClient(wrap TransportMiddleware, m *app.Telemetry) *http.Client { transport := http.DefaultTransport if wrap != nil { transport = wrap(transport) @@ -290,7 +290,7 @@ func (s *services) httpClient(wrap TransportMiddleware, m *app.Metrics) *http.Cl } func main() { - app.Run(func(ctx context.Context, lg *zap.Logger, m *app.Metrics) error { + app.Run(func(ctx context.Context, lg *zap.Logger, m *app.Telemetry) error { s := services{} if err := s.Prometheus(m); err != nil { return errors.Wrapf(err, "setup Prometheus proxy") diff --git a/internal/otelbench/handler.go b/internal/otelbench/handler.go index 2a9d1a52..88b8648a 100644 --- a/internal/otelbench/handler.go +++ b/internal/otelbench/handler.go @@ -20,7 +20,7 @@ import ( ) // NewHandler initializes and returns a new Handler. -func NewHandler(db *ent.Client, m *app.Metrics) *Handler { +func NewHandler(db *ent.Client, m *app.Telemetry) *Handler { httpClient := &http.Client{ Transport: otelhttp.NewTransport(http.DefaultTransport, otelhttp.WithTracerProvider(m.TracerProvider()),