Skip to content

Commit 3f7b114

Browse files
fix: include semver in instrumentation creation
1 parent a8f129d commit 3f7b114

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

instrumentation/github.com/gocql/gocql/gocql.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import (
1818
"context"
1919

2020
"github.com/gocql/gocql"
21+
22+
otelcontrib "go.opentelemetry.io/contrib"
23+
"go.opentelemetry.io/otel/api/trace"
2124
)
2225

2326
// NewSessionWithTracing creates a new session using the given cluster
@@ -26,7 +29,10 @@ import (
2629
func NewSessionWithTracing(ctx context.Context, cluster *gocql.ClusterConfig, options ...TracedSessionOption) (*gocql.Session, error) {
2730
config := configure(options...)
2831
instruments := newInstruments(config.meterProvider)
29-
tracer := config.traceProvider.Tracer(instrumentationName)
32+
tracer := config.traceProvider.Tracer(
33+
instrumentationName,
34+
trace.WithInstrumentationVersion(otelcontrib.SemVersion()),
35+
)
3036
cluster.QueryObserver = &OTelQueryObserver{
3137
enabled: config.instrumentQuery,
3238
observer: config.queryObserver,

instrumentation/github.com/gocql/gocql/instrument.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package gocql
1717
import (
1818
"log"
1919

20+
otelcontrib "go.opentelemetry.io/contrib"
2021
"go.opentelemetry.io/otel/api/metric"
2122
"go.opentelemetry.io/otel/api/unit"
2223
)
@@ -42,7 +43,10 @@ type instruments struct {
4243
// newInstruments will recreate instruments using a meter
4344
// from the given provider p.
4445
func newInstruments(p metric.Provider) *instruments {
45-
meter := p.Meter(instrumentationName)
46+
meter := p.Meter(
47+
instrumentationName,
48+
metric.WithInstrumentationVersion(otelcontrib.SemVersion()),
49+
)
4650
instruments := &instruments{}
4751
var err error
4852

0 commit comments

Comments
 (0)