From 9ac68b5f3a5b63891fd28055b0a2ed152084fffa Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 18 Sep 2024 15:21:43 -0400 Subject: [PATCH] align span attribute names with recommended --- .../amazon/smithy/go/codegen/ServiceGenerator.java | 9 ++++----- .../auth/ResolveAuthSchemeMiddlewareGenerator.java | 2 +- .../endpoints/EndpointMiddlewareGenerator.java | 2 +- transport/http/client.go | 12 ++++++------ 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/ServiceGenerator.java b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/ServiceGenerator.java index ea57d32f..41553771 100644 --- a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/ServiceGenerator.java +++ b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/ServiceGenerator.java @@ -398,14 +398,13 @@ defer endTimer() decorated := middleware.DecorateHandler(handler, stack) result, metadata, err = decorated.Handle(ctx, params) if err != nil { - span.SetProperty("error.go.type", fmt.Sprintf("%T", err)) - span.SetProperty("error.go.error", err.Error()) + span.SetProperty("exception.type", fmt.Sprintf("%T", err)) + span.SetProperty("exception.message", err.Error()) var aerr smithy.APIError if $errors.As:T(err, &aerr) { - span.SetProperty("error.api.code", aerr.ErrorCode()) - span.SetProperty("error.api.message", aerr.ErrorMessage()) - span.SetProperty("error.api.fault", aerr.ErrorFault().String()) + span.SetProperty("api.error_code", aerr.ErrorCode()) + span.SetProperty("api.error_message", aerr.ErrorMessage()) } err = &$operationError:T{ diff --git a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/auth/ResolveAuthSchemeMiddlewareGenerator.java b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/auth/ResolveAuthSchemeMiddlewareGenerator.java index ec5c93a9..588605f7 100644 --- a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/auth/ResolveAuthSchemeMiddlewareGenerator.java +++ b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/auth/ResolveAuthSchemeMiddlewareGenerator.java @@ -83,7 +83,7 @@ private GoWriter.Writable generateBody() { ctx = setResolvedAuthScheme(ctx, scheme) - span.SetProperty("operation.auth.resolved_scheme_id", scheme.Scheme.SchemeID()) + span.SetProperty("auth.scheme_id", scheme.Scheme.SchemeID()) span.End() return next.HandleFinalize(ctx, in) """, diff --git a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointMiddlewareGenerator.java b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointMiddlewareGenerator.java index bc54b06d..36bce2bd 100644 --- a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointMiddlewareGenerator.java +++ b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointMiddlewareGenerator.java @@ -141,7 +141,7 @@ private GoWriter.Writable generateResolveEndpoint() { return out, metadata, $fmt.Errorf:T("failed to resolve service endpoint, %w", err) } - span.SetProperty("operation.resolved_endpoint", endpt.URI.String()) + span.SetProperty("client.call.resolved_endpoint", endpt.URI.String()) if endpt.URI.RawPath == "" && req.URL.RawPath != "" { endpt.URI.RawPath = endpt.URI.Path diff --git a/transport/http/client.go b/transport/http/client.go index 4d8aed45..c43c346b 100644 --- a/transport/http/client.go +++ b/transport/http/client.go @@ -56,14 +56,14 @@ func (c ClientHandler) Handle(ctx context.Context, input interface{}) ( return nil, metadata, err } - span.SetProperty("http.request.method", req.Method) - span.SetProperty("http.request.content_length", -1) // at least indicate unknown + span.SetProperty("http.method", req.Method) + span.SetProperty("http.request_content_length", -1) // at least indicate unknown length, ok, err := req.StreamLength() if err != nil { return nil, metadata, err } if ok { - span.SetProperty("http.request.content_length", length) + span.SetProperty("http.request_content_length", length) } resp, err := c.client.Do(builtRequest) @@ -93,9 +93,9 @@ func (c ClientHandler) Handle(ctx context.Context, input interface{}) ( _ = builtRequest.Body.Close() } - span.SetProperty("http.proto", fmt.Sprintf("%d.%d", resp.ProtoMajor, resp.ProtoMinor)) - span.SetProperty("http.response.status_code", resp.StatusCode) - span.SetProperty("http.response.content_length", resp.ContentLength) + span.SetProperty("net.protocol.version", fmt.Sprintf("%d.%d", resp.ProtoMajor, resp.ProtoMinor)) + span.SetProperty("http.status_code", resp.StatusCode) + span.SetProperty("http.response_content_length", resp.ContentLength) return &Response{Response: resp}, metadata, err }