Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import "github.com/go-coldbrew/tracing"

Package tracing provides distributed tracing for Go applications. It offers features such as collecting performance data, identifying where requests spend most of their time, and segmenting requests.

Traces are created using OpenTracing APIs and exported via the configured global tracer \(opentracing.GlobalTracer\). The core package configures this tracer at startup — typically an OpenTelemetry bridge that sends traces to any OTLP\-compatible backend \(Jaeger, Grafana Tempo, Honeycomb, etc.\) or New Relic.
Traces are created and exported via OpenTelemetry. The core package configures the OTEL tracer provider at startup, sending traces to any OTLP\-compatible backend \(Jaeger, Grafana Tempo, Honeycomb, etc.\) or New Relic.

## Index

- [Constants](<#constants>)
- [func ClientSpan\(operationName string, ctx context.Context\) \(context.Context, opentracing.Span\)](<#ClientSpan>)
- [func ClientSpan\(operationName string, ctx context.Context\) \(context.Context, oteltrace.Span\)](<#ClientSpan>)
Comment thread
ankurs marked this conversation as resolved.
- [func CloneContextValues\(parent context.Context\) context.Context](<#CloneContextValues>)
- [func GRPCTracingSpan\(operationName string, ctx context.Context\) context.Context](<#GRPCTracingSpan>)
- [func MergeContextValues\(parent context.Context, main context.Context\) context.Context](<#MergeContextValues>)
Comment thread
ankurs marked this conversation as resolved.
Expand All @@ -42,13 +42,13 @@ const SupportPackageIsVersion1 = true
```

<a name="ClientSpan"></a>
## func [ClientSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L272>)
## func [ClientSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L270>)

```go
func ClientSpan(operationName string, ctx context.Context) (context.Context, opentracing.Span)
func ClientSpan(operationName string, ctx context.Context) (context.Context, oteltrace.Span)
```

ClientSpan starts a new client span linked to the existing spans if any are found in the context. The returned context should be used in place of the original
ClientSpan starts a new client span linked to the existing spans if any are found in the context. The returned context should be used in place of the original.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
<a name="CloneContextValues"></a>
## func [CloneContextValues](<https://github.com/go-coldbrew/tracing/blob/main/context.go#L24>)
Expand All @@ -60,13 +60,13 @@ func CloneContextValues(parent context.Context) context.Context
CloneContextValues clones a given context values and returns a new context obj which is not affected by Cancel, Deadline etc Deprecated: The function name is a bit confusing, use CloneContextValues instead

<a name="GRPCTracingSpan"></a>
## func [GRPCTracingSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L290>)
## func [GRPCTracingSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L276>)

```go
func GRPCTracingSpan(operationName string, ctx context.Context) context.Context
```

GRPCTracingSpan starts a new client span linked to the existing spans if any are found in the context. The returned context should be used in place of the original
GRPCTracingSpan starts a new server span from incoming gRPC metadata. The returned context should be used in place of the original.

<a name="MergeContextValues"></a>
## func [MergeContextValues](<https://github.com/go-coldbrew/tracing/blob/main/context.go#L45>)
Expand Down Expand Up @@ -96,9 +96,9 @@ func NewContextWithParentValues(parent context.Context) context.Context
NewContextWithParentValues clones a given context values and returns a new context obj which is not affected by Cancel, Deadline etc can be used to pass context values to a new context which is not affected by the parent context cancel/deadline etc from parent

<a name="Span"></a>
## type [Span](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L19-L30>)
## type [Span](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L44-L55>)

Span defines an interface for implementing a tracing span This is used to abstract the underlying tracing implementation, currently using opentracing/opentelemetry and newrelic tracing libraries for implementation
Span defines an interface for implementing a tracing span. Consumers use this to create and annotate spans without coupling to a specific tracing backend.

```go
type Span interface {
Expand All @@ -116,13 +116,13 @@ type Span interface {
```

<a name="NewDatastoreSpan"></a>
### func [NewDatastoreSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L147>)
### func [NewDatastoreSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L168>)

```go
func NewDatastoreSpan(ctx context.Context, datastore, operation, collection string) (Span, context.Context)
```

NewDatastoreSpan starts a span for tracing data store actions This is used to trace actions against a data store, for example, a database query or a redis call
NewDatastoreSpan starts a span for tracing data store actions. This is used to trace actions against a data store, for example, a database query or a redis call.

<details><summary>Example</summary>
<p>
Expand Down Expand Up @@ -154,13 +154,13 @@ func main() {
</details>

<a name="NewExternalSpan"></a>
### func [NewExternalSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L222>)
### func [NewExternalSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L247>)

```go
func NewExternalSpan(ctx context.Context, name string, url string) (Span, context.Context)
```

NewExternalSpan starts a span for tracing external actions This is used to trace actions against an external service, for example, a call to another service or a call to an external API
NewExternalSpan starts a span for tracing external actions. This is used to trace actions against an external service.

<details><summary>Example</summary>
<p>
Expand Down Expand Up @@ -192,22 +192,22 @@ func main() {
</details>

<a name="NewHTTPExternalSpan"></a>
### func [NewHTTPExternalSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L229>)
### func [NewHTTPExternalSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L254>)

```go
func NewHTTPExternalSpan(ctx context.Context, name string, url string, hdr http.Header) (Span, context.Context)
```

NewHTTPExternalSpan starts a span for tracing external HTTP actions This is used to trace actions against an external service, for example, a call to another service or a call to an external API It also adds the HTTP headers to the span so that the external service can trace the call back to this service if needed
NewHTTPExternalSpan starts a span for tracing external HTTP actions. It also injects trace propagation headers so the external service can correlate the call back to this service.

<a name="NewInternalSpan"></a>
### func [NewInternalSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L118>)
### func [NewInternalSpan](<https://github.com/go-coldbrew/tracing/blob/main/tracing.go#L139>)

```go
func NewInternalSpan(ctx context.Context, name string) (Span, context.Context)
```

NewInternalSpan starts a span for tracing internal actions This is used to trace actions within the same service, for example, a function call within the same service
NewInternalSpan starts a span for tracing internal actions. This is used to trace actions within the same service, for example, a function call.

<details><summary>Example</summary>
<p>
Expand Down
7 changes: 3 additions & 4 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// features such as collecting performance data, identifying where requests
// spend most of their time, and segmenting requests.
//
// Traces are created using OpenTracing APIs and exported via the configured
// global tracer (opentracing.GlobalTracer). The core package configures this
// tracer at startup — typically an OpenTelemetry bridge that sends traces to
// any OTLP-compatible backend (Jaeger, Grafana Tempo, Honeycomb, etc.) or
// Traces are created and exported via OpenTelemetry. The core package
// configures the OTEL tracer provider at startup, sending traces to any
// OTLP-compatible backend (Jaeger, Grafana Tempo, Honeycomb, etc.) or
// New Relic.
package tracing

Expand Down
7 changes: 6 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ go 1.25.8

require (
github.com/newrelic/go-agent/v3 v3.42.0
github.com/opentracing/opentracing-go v1.2.0
go.opentelemetry.io/otel v1.42.0
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go modules for OpenTelemetry are typically released in lockstep; here go.opentelemetry.io/otel and go.opentelemetry.io/otel/trace are pinned to v1.42.0, but the dependency graph still pulls in go.opentelemetry.io/otel/sdk v1.39.0 (per go.sum). To reduce the risk of subtle incompatibilities, consider aligning OTEL module versions (e.g., explicitly upgrading otel/sdk/related modules to the same minor) and re-running go mod tidy.

Suggested change
go.opentelemetry.io/otel v1.42.0
go.opentelemetry.io/otel v1.42.0
go.opentelemetry.io/otel/sdk v1.42.0

Copilot uses AI. Check for mistakes.
go.opentelemetry.io/otel/trace v1.42.0
google.golang.org/grpc v1.79.3
)

Expand Down Expand Up @@ -81,6 +82,8 @@ require (
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.8.0 // indirect
github.com/go-git/go-git/v5 v5.17.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-toolsmith/astcast v1.1.0 // indirect
github.com/go-toolsmith/astcopy v1.1.0 // indirect
github.com/go-toolsmith/astequal v1.2.0 // indirect
Expand Down Expand Up @@ -226,6 +229,8 @@ require (
go-simpler.org/sloglint v0.11.1 // indirect
go.augendre.info/arangolint v0.4.0 // indirect
go.augendre.info/fatcontext v0.9.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
Expand Down
15 changes: 7 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
Expand Down Expand Up @@ -524,8 +525,6 @@ github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI
github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE=
github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28=
github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
Expand Down Expand Up @@ -718,16 +717,16 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho=
go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc=
go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4=
go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI=
go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18=
go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE=
go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8=
go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew=
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY=
go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
Expand Down
Loading
Loading