Skip to content

Commit

Permalink
chore: do not use deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Jan 7, 2025
1 parent 119b9de commit fb801bf
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions cmd/chotel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelbot/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/otelbot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions cmd/oteldb/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion cmd/oteldb/oteldb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion cmd/oteldb/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion cmd/oteldemo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
2 changes: 1 addition & 1 deletion cmd/oteldemo/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
16 changes: 8 additions & 8 deletions cmd/otelproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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),
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion internal/otelbench/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down

0 comments on commit fb801bf

Please sign in to comment.