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

observability naming adjustments #537

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's fault in the context of Smithy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"client", "server" or "unknown"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, like "who's fault is this".

I may be biased towards the errors I happen to be looking at right now, but this does seem useful for communicating with customers and saying "this is a client error, not an issue with the server", although I'd defer to your experience if you think this is not important

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I'm fine leaving it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-added

span.SetProperty("api.error_code", aerr.ErrorCode())
span.SetProperty("api.error_message", aerr.ErrorMessage())
}

err = &$operationError:T{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
""",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
// )
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
// )
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions transport/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down
Loading