From b1d902b98d3d1552284276eda4731683f0ee42f9 Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 18 Sep 2024 15:11:12 -0400 Subject: [PATCH 1/3] rename single-package observability modules to not have dashes --- metrics/{smithy-otel-metrics => smithyotelmetrics}/async.go | 0 metrics/{smithy-otel-metrics => smithyotelmetrics}/attribute.go | 0 metrics/{smithy-otel-metrics => smithyotelmetrics}/doc.go | 2 +- metrics/{smithy-otel-metrics => smithyotelmetrics}/float64.go | 0 metrics/{smithy-otel-metrics => smithyotelmetrics}/go.mod | 2 +- metrics/{smithy-otel-metrics => smithyotelmetrics}/go.sum | 0 metrics/{smithy-otel-metrics => smithyotelmetrics}/int64.go | 0 metrics/{smithy-otel-metrics => smithyotelmetrics}/metrics.go | 0 metrics/{smithy-otel-metrics => smithyotelmetrics}/option.go | 0 tracing/{smithy-otel-tracing => smithyoteltracing}/adapt.go | 0 .../{smithy-otel-tracing => smithyoteltracing}/adapt_test.go | 0 tracing/{smithy-otel-tracing => smithyoteltracing}/attribute.go | 0 .../attribute_test.go | 0 tracing/{smithy-otel-tracing => smithyoteltracing}/doc.go | 2 +- tracing/{smithy-otel-tracing => smithyoteltracing}/go.mod | 2 +- tracing/{smithy-otel-tracing => smithyoteltracing}/go.sum | 0 16 files changed, 4 insertions(+), 4 deletions(-) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/async.go (100%) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/attribute.go (100%) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/doc.go (93%) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/float64.go (100%) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/go.mod (74%) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/go.sum (100%) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/int64.go (100%) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/metrics.go (100%) rename metrics/{smithy-otel-metrics => smithyotelmetrics}/option.go (100%) rename tracing/{smithy-otel-tracing => smithyoteltracing}/adapt.go (100%) rename tracing/{smithy-otel-tracing => smithyoteltracing}/adapt_test.go (100%) rename tracing/{smithy-otel-tracing => smithyoteltracing}/attribute.go (100%) rename tracing/{smithy-otel-tracing => smithyoteltracing}/attribute_test.go (100%) rename tracing/{smithy-otel-tracing => smithyoteltracing}/doc.go (96%) rename tracing/{smithy-otel-tracing => smithyoteltracing}/go.mod (74%) rename tracing/{smithy-otel-tracing => smithyoteltracing}/go.sum (100%) diff --git a/metrics/smithy-otel-metrics/async.go b/metrics/smithyotelmetrics/async.go similarity index 100% rename from metrics/smithy-otel-metrics/async.go rename to metrics/smithyotelmetrics/async.go diff --git a/metrics/smithy-otel-metrics/attribute.go b/metrics/smithyotelmetrics/attribute.go similarity index 100% rename from metrics/smithy-otel-metrics/attribute.go rename to metrics/smithyotelmetrics/attribute.go diff --git a/metrics/smithy-otel-metrics/doc.go b/metrics/smithyotelmetrics/doc.go similarity index 93% rename from metrics/smithy-otel-metrics/doc.go rename to metrics/smithyotelmetrics/doc.go index d6c37c85..6025b510 100644 --- a/metrics/smithy-otel-metrics/doc.go +++ b/metrics/smithyotelmetrics/doc.go @@ -11,7 +11,7 @@ // import ( // "github.com/aws/aws-sdk-go-v2/config" // "github.com/aws/aws-sdk-go-v2/service/s3" -// smithyotelmetrics "github.com/aws/smithy-go/metrics/smithy-otel-metrics" +// "github.com/aws/smithy-go/metrics/smithyotelmetrics" // "go.opentelemetry.io/otel/sdk/metric" // "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" // ) diff --git a/metrics/smithy-otel-metrics/float64.go b/metrics/smithyotelmetrics/float64.go similarity index 100% rename from metrics/smithy-otel-metrics/float64.go rename to metrics/smithyotelmetrics/float64.go diff --git a/metrics/smithy-otel-metrics/go.mod b/metrics/smithyotelmetrics/go.mod similarity index 74% rename from metrics/smithy-otel-metrics/go.mod rename to metrics/smithyotelmetrics/go.mod index 6fedbf02..ba9e618e 100644 --- a/metrics/smithy-otel-metrics/go.mod +++ b/metrics/smithyotelmetrics/go.mod @@ -1,4 +1,4 @@ -module github.com/aws/smithy-go/metrics/smithy-otel-metrics +module github.com/aws/smithy-go/metrics/smithyotelmetrics go 1.22 diff --git a/metrics/smithy-otel-metrics/go.sum b/metrics/smithyotelmetrics/go.sum similarity index 100% rename from metrics/smithy-otel-metrics/go.sum rename to metrics/smithyotelmetrics/go.sum diff --git a/metrics/smithy-otel-metrics/int64.go b/metrics/smithyotelmetrics/int64.go similarity index 100% rename from metrics/smithy-otel-metrics/int64.go rename to metrics/smithyotelmetrics/int64.go diff --git a/metrics/smithy-otel-metrics/metrics.go b/metrics/smithyotelmetrics/metrics.go similarity index 100% rename from metrics/smithy-otel-metrics/metrics.go rename to metrics/smithyotelmetrics/metrics.go diff --git a/metrics/smithy-otel-metrics/option.go b/metrics/smithyotelmetrics/option.go similarity index 100% rename from metrics/smithy-otel-metrics/option.go rename to metrics/smithyotelmetrics/option.go diff --git a/tracing/smithy-otel-tracing/adapt.go b/tracing/smithyoteltracing/adapt.go similarity index 100% rename from tracing/smithy-otel-tracing/adapt.go rename to tracing/smithyoteltracing/adapt.go diff --git a/tracing/smithy-otel-tracing/adapt_test.go b/tracing/smithyoteltracing/adapt_test.go similarity index 100% rename from tracing/smithy-otel-tracing/adapt_test.go rename to tracing/smithyoteltracing/adapt_test.go diff --git a/tracing/smithy-otel-tracing/attribute.go b/tracing/smithyoteltracing/attribute.go similarity index 100% rename from tracing/smithy-otel-tracing/attribute.go rename to tracing/smithyoteltracing/attribute.go diff --git a/tracing/smithy-otel-tracing/attribute_test.go b/tracing/smithyoteltracing/attribute_test.go similarity index 100% rename from tracing/smithy-otel-tracing/attribute_test.go rename to tracing/smithyoteltracing/attribute_test.go diff --git a/tracing/smithy-otel-tracing/doc.go b/tracing/smithyoteltracing/doc.go similarity index 96% rename from tracing/smithy-otel-tracing/doc.go rename to tracing/smithyoteltracing/doc.go index 62952a2f..a22b6989 100644 --- a/tracing/smithy-otel-tracing/doc.go +++ b/tracing/smithyoteltracing/doc.go @@ -11,7 +11,7 @@ // import ( // "github.com/aws/aws-sdk-go-v2/config" // "github.com/aws/aws-sdk-go-v2/service/s3" -// smithyoteltracing "github.com/aws/smithy-go/tracing/smithy-otel-tracing" +// "github.com/aws/smithy-go/tracing/smithyoteltracing" // "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" // "go.opentelemetry.io/otel/sdk/trace" // ) diff --git a/tracing/smithy-otel-tracing/go.mod b/tracing/smithyoteltracing/go.mod similarity index 74% rename from tracing/smithy-otel-tracing/go.mod rename to tracing/smithyoteltracing/go.mod index dd24ffc7..bf2f4016 100644 --- a/tracing/smithy-otel-tracing/go.mod +++ b/tracing/smithyoteltracing/go.mod @@ -1,4 +1,4 @@ -module github.com/aws/smithy-go/tracing/smithy-otel-tracing +module github.com/aws/smithy-go/tracing/smithyoteltracing go 1.22 diff --git a/tracing/smithy-otel-tracing/go.sum b/tracing/smithyoteltracing/go.sum similarity index 100% rename from tracing/smithy-otel-tracing/go.sum rename to tracing/smithyoteltracing/go.sum From 9ac68b5f3a5b63891fd28055b0a2ed152084fffa Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 18 Sep 2024 15:21:43 -0400 Subject: [PATCH 2/3] 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 } From cc73c743f9e151948e6b61aeb63ec0058f1af626 Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 18 Sep 2024 16:05:59 -0400 Subject: [PATCH 3/3] re-add error fault --- .../java/software/amazon/smithy/go/codegen/ServiceGenerator.java | 1 + 1 file changed, 1 insertion(+) 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 41553771..38d084f3 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 @@ -405,6 +405,7 @@ defer endTimer() if $errors.As:T(err, &aerr) { span.SetProperty("api.error_code", aerr.ErrorCode()) span.SetProperty("api.error_message", aerr.ErrorMessage()) + span.SetProperty("api.error_fault", aerr.ErrorFault().String()) } err = &$operationError:T{