Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update go-client - new telemetry #1330

Merged
merged 6 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/pkg/telemetry/metric/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/bridge/opencensus"
export "go.opentelemetry.io/otel/exporters/prometheus"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/resource"
Expand Down Expand Up @@ -56,6 +57,9 @@ func ServeMetrics(ctx context.Context, serviceName, listenAddr string, logger lo
return nil, err
}

// Register legacy OpenCensus metrics, for go-cloud (https://github.com/google/go-cloud/issues/2877)
exporter.RegisterProducer(opencensus.NewMetricProducer())

Comment on lines +60 to +62
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go-cloud, ktory pouzivame na pracu s S3/ABS nepodporuje zatial OpenTelemetry, viac v google/go-cloud#2877 (postupne je tych dovodou menej, casom urcite prejdu na OpenTelemetry). Zatial je tu tento bridge.

OpenCensus je zial globalna zalezitost, preto to registrujem na najvyssej moznej urovni, aby to nerozbilo testovatelnost kodu na nizsich urovniach.

// Create HTTP metrics server
opts := promhttp.HandlerOpts{ErrorLog: &errLogger{logger: logger}}
handler := http.NewServeMux()
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/telemetry/oteldd/oteldd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (
"context"
"encoding/binary"

octrace "go.opencensus.io/trace"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/bridge/opencensus"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
Expand Down Expand Up @@ -43,6 +45,10 @@ func IsDataDogEnabled(envs env.Provider) bool {
func NewProvider() trace.TracerProvider {
p := &TracerProvider{}
p.tracer = newTracer(p)

// Register legacy OpenCensus tracing for go-cloud (https://github.com/google/go-cloud/issues/2877).
octrace.DefaultTracer = opencensus.NewTracer(p.Tracer("otel.bridge.opencensus"))

return p
}

Expand Down