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

(nit:core) Standardize semconv version #2812

Merged
merged 1 commit into from
Jun 28, 2024
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
4 changes: 2 additions & 2 deletions core/metrics/instrumentation/otelginmetrics/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"net/http"

"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
semconv "go.opentelemetry.io/otel/semconv/v1.25.0"
)

type config struct {
Expand Down Expand Up @@ -36,7 +36,7 @@
}

if serverName != "" {
attrs = append(attrs, semconv.HTTPServerNameKey.String(serverName))
attrs = append(attrs, semconv.ServiceNameKey.String(serverName))

Check warning on line 39 in core/metrics/instrumentation/otelginmetrics/config.go

View check run for this annotation

Codecov / codecov/patch

core/metrics/instrumentation/otelginmetrics/config.go#L39

Added line #L39 was not covered by tests
}
if route != "" {
attrs = append(attrs, semconv.HTTPRouteKey.String(route))
Expand Down
4 changes: 2 additions & 2 deletions core/metrics/instrumentation/otelginmetrics/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"time"

"github.com/gin-gonic/gin"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
semconv "go.opentelemetry.io/otel/semconv/v1.25.0"
)

// Middleware returns middleware that will trace incoming requests.
Expand Down Expand Up @@ -49,7 +49,7 @@
code := int(ginCtx.Writer.Status()/100) * 100
resAttributes = append(resAttributes, semconv.HTTPStatusCodeKey.Int(code))
} else {
resAttributes = append(resAttributes, semconv.HTTPAttributesFromHTTPStatusCode(ginCtx.Writer.Status())...)
resAttributes = append(resAttributes, semconv.HTTPResponseStatusCodeKey.Int(ginCtx.Writer.Status()))

Check warning on line 52 in core/metrics/instrumentation/otelginmetrics/middleware.go

View check run for this annotation

Codecov / codecov/patch

core/metrics/instrumentation/otelginmetrics/middleware.go#L52

Added line #L52 was not covered by tests
}

recorder.AddRequests(ctx, 1, resAttributes)
Expand Down
Loading