Skip to content

Commit 82694ba

Browse files
sgironesMrAliasAneurysm9
authored
[otelecho] Use SpanStatusFromHTTPStatusCodeAndSpanKind on the middleware (#1848)
* [otelecho] Use SpanStatusFromHTTPStatusCodeAndSpanKind on the middleware * Add an entry to the changelog * Update CHANGELOG.md Co-authored-by: Tyler Yahn <[email protected]> Co-authored-by: Tyler Yahn <[email protected]> Co-authored-by: Anthony Mirabella <[email protected]>
1 parent 7b00c22 commit 82694ba

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
88

99
## [Unreleased]
1010

11+
### Fixed
12+
13+
- Fix the `echo` middleware by using `SpanKind.SERVER` when deciding the `SpanStatus`.
14+
This makes `4xx` response codes to not be an error anymore. (#1848)
15+
1116
## [1.4.0/0.29.0] - 2022-02-14
1217

1318
### Added

instrumentation/github.com/labstack/echo/otelecho/echo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func Middleware(service string, opts ...Option) echo.MiddlewareFunc {
9494
}
9595

9696
attrs := semconv.HTTPAttributesFromHTTPStatusCode(c.Response().Status)
97-
spanStatus, spanMessage := semconv.SpanStatusFromHTTPStatusCode(c.Response().Status)
97+
spanStatus, spanMessage := semconv.SpanStatusFromHTTPStatusCodeAndSpanKind(c.Response().Status, oteltrace.SpanKindServer)
9898
span.SetAttributes(attrs...)
9999
span.SetStatus(spanStatus, spanMessage)
100100

0 commit comments

Comments
 (0)