Feat/pubsub v2 otel#45
Open
Josemaralves wants to merge 13 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migration of Pub/Sub to the
cloud.google.com/go/pubsub/v2SDK with native OpenTelemetry tracing support, a comprehensive OTEL infrastructure overhaul (signal-specific exporters, Prometheus, runtime metrics, sampling), and opt-in MongoDB monitoring, alongside dependency upgrades across the board.Key Changes
Pub/Sub v2 Migration (
factory/contrib/cloud.google.com/pubsub/v1)pubsub.NewClienttopubsub.NewClientWithConfigwithEnableOpenTelemetryTracing: true? native OTel tracing via the SDKotelgrpc.NewClientHandler()and gRPC experimental metrics dial options, wired to the boost OTelMeterProviderHelper.Start()now uses fire-and-forget goroutines (droppedsync.WaitGroupcoordination)generateCloudEventto a standalonemessage.goOpenTelemetry Overhaul (
factory/contrib/go.opentelemetry.io/otel/v1)metric.endpoint,metric.protocol,trace.endpoint,trace.protocol,trace.ratio? resolution order follows the OTel env-var specStartMetricProviderruntime.Start(...)runs automatically (5s memory stats interval)AlwaysSample()?TraceIDRatioBased(options.Trace.Ratio), defaulting to 1.0NewOptionsnow readsOTEL_RESOURCE_ATTRIBUTES,OTEL_EXPORTER_OTLP_TIMEOUT,OTEL_TRACES_SAMPLER_ARGMongoDB Opt-in Monitoring (
factory/contrib/go.mongodb.org/mongo-driver/v2)Log.Enabled(defaultfalse), extracted tosetLogMonitorWithMeterProvideralongside the tracer providergRPC Client OTel (
factory/contrib/google.golang.org/grpc/v1)oteltelemetry.DialOptionFunction Middleware
Tracerinstance, usesc.Tracer.Startinstead of creating a new tracer per invocation;sync.Once-guarded lazy meter initfunc(format string, args ...interface{})tofunc(string); default level changed from"INFO"to"DEBUG"New FX Modules
fx/modules/factory/contrib/go.opentelemetry.io/otel/v1? starts tracer and meter providers at app startupfx/modules/bootstrap/function/middleware/opentelemetry? providesOpenTelemetry[T]viafx.Provide, gated by config flagDependency Upgrades
go.opentelemetry.io/contrib/instrumentation/runtime,go.opentelemetry.io/otel/exporters/prometheusreplacedirectives (gnostic-models,kube-openapi)Test Plan
/metricsendpoint is exposed correctlyLog.Enabledisfalse(default)go build ./...andgo test ./...greenBreaking Changes
truetofalsefunc(format string, args ...interface{})tofunc(string)