Skip to content

Go OTel: Support attaching to existing traces/spans #4243

@ZackarySantana

Description

@ZackarySantana

Describe the feature

Allow attaching operation's OTel traces/spans to existing traces/spans.

Use Case

Currently, the spans sent by glide aren't that informational other than knowing about how many times an operation is used. Allowing spans to be children of existing spans helps with overall instrumentation and e2e debugging of long service requests (which currently don't have visibility on the underlying valkey/glide operation)

Proposed Solution

An option in glide.OpenTelemetryConfig for a function that retrieves a span/trace information from a given context.

config := glide.OpenTelemetryConfig{
	SpanFromContext: func(ctx context.Context) (spanID string, found bool) {
		if /* found */ {
			return "span_id", true
		}
		return "", false
	},
	// ... other configurations
}

The return span id will be used as the parent span id sent for operations.

Most instrumentation libraries/systems store it in a context key. The context key is often private to the package and the underlying span information is locked behind an exported function (e.g. like here)

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Client version used

v2.0.1

Environment details (OS name and version, etc.)

Docker img: valkey/valkey:8.1

Metadata

Metadata

Labels

User issue 🚨Issue opened by a userUsers PainAn issue known to cause users pain, generaly open by the user.go 🏃golang wrapper

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions