Skip to content

Commit

Permalink
refactor: Move tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
boecklim committed Jan 28, 2025
1 parent ce9d1f1 commit 4921d29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
File renamed without changes.
7 changes: 3 additions & 4 deletions internal/tracing/init.go → pkg/tracing/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"log/slog"

"github.com/bitcoin-sv/arc/config"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
Expand Down Expand Up @@ -45,14 +44,14 @@ func NewTraceProvider(ctx context.Context, serviceName string, sample int, opts
return tp, exporter, nil
}

func Enable(logger *slog.Logger, serviceName string, tracingConfig *config.TracingConfig) (func(), error) {
if tracingConfig.DialAddr == "" {
func Enable(logger *slog.Logger, serviceName string, dialAddr string, sample int) (func(), error) {
if dialAddr == "" {
return nil, errors.New("tracing enabled, but tracing address empty")
}

ctx := context.Background()

tp, exporter, err := NewTraceProvider(ctx, serviceName, tracingConfig.Sample, otlptracegrpc.WithEndpointURL(tracingConfig.DialAddr), otlptracegrpc.WithInsecure())
tp, exporter, err := NewTraceProvider(ctx, serviceName, sample, otlptracegrpc.WithEndpointURL(dialAddr), otlptracegrpc.WithInsecure())
if err != nil {
return nil, fmt.Errorf("failed to create trace provider: %v", err)
}
Expand Down

0 comments on commit 4921d29

Please sign in to comment.