Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade DB semconv from v1.21.0 to v1.26.0 #911

Merged
merged 13 commits into from
Jul 9, 2024
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http
- Upgrade semconv from `v1.24.0` to `v1.26.0` in `github.com/segmentio/kafka-go` instrumentation. ([#909](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/909))
- The `messaging.operation` attribute key is renamed to `messaging.operation.type`.
- The `messaging.kafka.destination.partition` key is renamed to `messaging.destination.partition.id`
- Upgrade semconv from `v1.21.0` to `v1.26.0` in `database/sql` instrumentation. ([#911](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/911))
- The `db.statement` attribute key is renamed to `db.query.text`.
- Upgrade semconv to `v1.26.0` in `net/http` instrumentation. ([#913](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/913))
- Upgrade `go.opentelemetry.io/auto` semconv to `v1.26.0`. ([#914](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/914))

Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/instrumentation/bpf/database/sql/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/go-logr/logr"
"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
"go.opentelemetry.io/otel/trace"
"golang.org/x/sys/unix"

Expand Down Expand Up @@ -100,7 +100,7 @@ func convertEvent(e *event) []*probe.SpanEvent {
EndTime: int64(e.EndTime),
SpanContext: &sc,
Attributes: []attribute.KeyValue{
semconv.DBStatementKey.String(query),
semconv.DBQueryText(query),
},
ParentSpanContext: pscPtr,
},
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/instrumentation/bpf/database/sql/probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"

"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
"go.opentelemetry.io/otel/trace"

"go.opentelemetry.io/auto/internal/pkg/instrumentation/context"
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestProbeConvertEvent(t *testing.T) {
EndTime: int64(end.UnixNano()),
SpanContext: &sc,
Attributes: []attribute.KeyValue{
semconv.DBStatementKey.String("SELECT * FROM foo"),
semconv.DBQueryText("SELECT * FROM foo"),
},
}
assert.Equal(t, want, got[0])
Expand Down
2 changes: 1 addition & 1 deletion internal/test/e2e/databasesql/traces.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{
"attributes": [
{
"key": "db.statement",
"key": "db.query.text",
"value": {
"stringValue": "SELECT * FROM contacts"
}
Expand Down
4 changes: 2 additions & 2 deletions internal/test/e2e/databasesql/verify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load ../../test_helpers/utilities

SCOPE="go.opentelemetry.io/auto/database/sql"

@test "${SCOPE} :: includes db.statement attribute" {
result=$(span_attributes_for ${SCOPE} | jq "select(.key == \"db.statement\").value.stringValue")
@test "${SCOPE} :: includes db.query.text attribute" {
result=$(span_attributes_for ${SCOPE} | jq "select(.key == \"db.query.text\").value.stringValue")
assert_equal "$result" '"SELECT * FROM contacts"'
}

Expand Down
Loading