oidc icon indicating copy to clipboard operation
oidc copied to clipboard

Add ability to disable or override tracer in pkg/op (private variable makes it impossible)

Open valerijhegaj opened this issue 2 months ago • 0 comments

Preflight Checklist

  • [x] I could not find a solution in the existing issues, docs, nor discussions
  • [x] I have joined the ZITADEL chat

Describe your problem

Problem

Hello, we want to use this library in a large financial institution. Tracing is enabled too aggressively inside github.com/zitadel/oidc/v3/pkg/op, but unlike the pkg/client package, the tracer there is a private variable. Because of this, we cannot override or disable tracing without using unsafe hacks (go:linkname), which is not acceptable for production in regulated environments. Example:

  • In github.com/zitadel/oidc/v3/pkg/client, the tracer is public and can be replaced.
  • In github.com/zitadel/oidc/v3/pkg/op, the tracer is private, so there is no official way to disable or customize it.

Why this is a problem

Many companies (banks, enterprise, government) have strict policies about: Disabling unnecessary tracing Controlling telemetry centrally Avoiding unsafe code and fork maintenance Right now, the only way to disable tracing inside pkg/op is to patch it manually or use unsafe.

Describe your ideal solution

Suggested solution

Any of the following would solve the issue cleanly:

Option 1 (preferred)

Make the tracer exported:

var Tracer = ...

Option 2

Expose a function:

func SetTracer(trace.Tracer)

Option 3

Expose a function to configure or disable tracing:

func DisableTracing() 
// or
func ConfigureTracing(provider trace.TracerProvider)

Why this change is useful

Keeps API backward-compatible Removes the need for unsafe or custom forks Makes behavior consistent with pkg/client Allows regulated environments to integrate safely

Version

v3.45.0

Environment

Self-hosted

Additional Context

No response

valerijhegaj avatar Oct 20 '25 09:10 valerijhegaj