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

Switch the semconv migration default to new #6899

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
fix the mux metric tests
  • Loading branch information
dmathieu committed Mar 7, 2025
commit ee5537af8ce564a0e060e70623dabc67f27114d3
20 changes: 11 additions & 9 deletions instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,17 @@ func TestSDKIntegration(t *testing.T) {
assertSpan(t, sr.Ended()[0],
"/user/{id:[0-9]+}",
trace.SpanKindServer,
attribute.String("net.host.name", "foobar"),
attribute.Int("http.status_code", http.StatusOK),
attribute.String("http.method", "GET"),
attribute.String("server.address", "foobar"),
attribute.Int("http.response.status_code", http.StatusOK),
attribute.String("http.request.method", "GET"),
attribute.String("http.route", "/user/{id:[0-9]+}"),
)
assertSpan(t, sr.Ended()[1],
"/book/{title}",
trace.SpanKindServer,
attribute.String("net.host.name", "foobar"),
attribute.Int("http.status_code", http.StatusOK),
attribute.String("http.method", "GET"),
attribute.String("server.address", "foobar"),
attribute.Int("http.response.status_code", http.StatusOK),
attribute.String("http.request.method", "GET"),
attribute.String("http.route", "/book/{title}"),
)
}
Expand All @@ -136,15 +136,17 @@ func TestNotFoundIsNotError(t *testing.T) {
assertSpan(t, sr.Ended()[0],
"/does/not/exist",
trace.SpanKindServer,
attribute.String("net.host.name", "foobar"),
attribute.Int("http.status_code", http.StatusNotFound),
attribute.String("http.method", "GET"),
attribute.String("server.address", "foobar"),
attribute.Int("http.response.status_code", http.StatusNotFound),
attribute.String("http.request.method", "GET"),
attribute.String("http.route", "/does/not/exist"),
)
assert.Equal(t, codes.Unset, sr.Ended()[0].Status().Code)
}

func assertSpan(t *testing.T, span sdktrace.ReadOnlySpan, name string, kind trace.SpanKind, attrs ...attribute.KeyValue) {
t.Helper()

assert.Equal(t, name, span.Name())
assert.Equal(t, kind, span.SpanKind())

Expand Down
Loading