telemetry

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package telemetry lets tokenex credential providers receive an OTel TracerProvider from their consumer, and derive their own appropriately-scoped Tracer from it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdentityTokenAttrs

func IdentityTokenAttrs(prefix string, rawToken string, expiresAt time.Time) []attribute.KeyValue

IdentityTokenAttrs returns span attributes describing an identity token presented to a downstream exchange: <prefix>.expires_at always, plus <prefix>.subject / <prefix>.audience / <prefix>.iss when rawToken parses as a JWT and carries those claims (rawToken is parsed unverified — this is for telemetry, not validation).

func RecordResult

func RecordResult(span trace.Span, err error)

RecordResult records err on span (if non-nil) and sets the span's final status accordingly. It does not end the span — callers should `defer span.End()` right after starting it, so the span is always closed regardless of which return path is taken.

func Tracer

func Tracer(ctx context.Context, tp trace.TracerProvider, scopeName string) trace.Tracer

Tracer returns a Tracer scoped to scopeName from tp. If tp is nil, it falls back to the TracerProvider of the current span in ctx (if any), and finally to the OTel global TracerProvider. Providers should call this with their own package's instrumentation scope name rather than accepting a Tracer directly, so the scope always reflects the actual source of the spans regardless of what the consumer supplies.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL