otel: replace cobraotel with native lifecycle management#3107
Closed
Jdepp007004 wants to merge 1 commit intoauthzed:mainfrom
Closed
otel: replace cobraotel with native lifecycle management#3107Jdepp007004 wants to merge 1 commit intoauthzed:mainfrom
Jdepp007004 wants to merge 1 commit intoauthzed:mainfrom
Conversation
Fixes authzed#712 and authzed#3095. - Remove dependency on github.com/jzelinskie/cobrautil/v2/cobraotel - Replicate OTel provider initialization natively in pkg/cmd/server/otel.go - Wire TracerProvider into serve.go signal handler so Shutdown and ForceFlush are called on SIGTERM/SIGINT, preventing span loss on exit - Fix vendored cobrautil Viper global singleton bug: viper.SetEnvPrefix was mutating global state instead of the local instance (v.SetEnvPrefix) - Touch pkg/cmd/util/util.go only to break import cycle between pkg/cmd/util and pkg/cmd/server; all flag registrations unchanged - Add 20 tests across unit, integration, and system build tags
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #712 and #3095.
Removes the cobraotel dependency and brings OTel lifecycle management natively into SpiceDB.
What changed:
pkg/cmd/server/otel.go— new file with RegisterOTelFlags, InitOTelProvider, ShutdownOTelProvider, OTelPreRunE, OTelProviderFromContextpkg/cmd/serve.go— ShutdownOTelProvider now called on SIGTERM/SIGINT, fixing span loss on exit (Bug: OpenTelemetry traces are not flushed on shutdown, dropping spans on SIGTERM #3095)pkg/cmd/server/defaults.go— replaced cobraotel wiring with native OTelPreRunEpkg/cmd/util/util.go— touched only to break an import cycle, flag registrations unchangedvendor/.../cobrautil.go— fixed viper.SetEnvPrefix mutating global singleton instead of local instanceQuestion before I finalize: for
--otel-provider, you mentioned deprecating/hiding it — should I useMarkDeprecated(warns users when they pass it) orMarkHidden(silently removes from help)? Happy to add that in a follow-up or include it here.