Bump github.com/riandyrn/otelchi from 0.10.0 to 0.10.1
Bumps [github.com/riandyrn/otelchi](https://github.com/riandyrn/otelchi) from 0.10.0 to 0.10.1. - [Release notes](https://github.com/riandyrn/otelchi/releases) - [Changelog](https://github.com/riandyrn/otelchi/blob/master/CHANGELOG.md) - [Commits](https://github.com/riandyrn/otelchi/compare/v0.10.0...v0.10.1) --- updated-dependencies: - dependency-name: github.com/riandyrn/otelchi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
3540c490e0
commit
af71e56246
+14
-1
@@ -8,6 +8,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.10.1] - 2024-10-27
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgrade `go.opentelemetry.io/otel`, `go.opentelemetry.io/otel/sdk`, & `go.opentelemetry.io/otel/trace` to `v1.31.0`. ([#70])
|
||||
|
||||
### Fixed
|
||||
|
||||
- Span for websocket connection now won't be marked as error span. ([#67])
|
||||
|
||||
## [0.10.0] - 2024-09-17
|
||||
|
||||
### Added
|
||||
@@ -194,6 +204,8 @@ It contains instrumentation for trace and depends on:
|
||||
- Example code for a basic usage.
|
||||
- Apache-2.0 license.
|
||||
|
||||
[#70]: https://github.com/riandyrn/otelchi/pull/70
|
||||
[#67]: https://github.com/riandyrn/otelchi/pull/67
|
||||
[#64]: https://github.com/riandyrn/otelchi/pull/64
|
||||
[#63]: https://github.com/riandyrn/otelchi/pull/63
|
||||
[#62]: https://github.com/riandyrn/otelchi/pull/62
|
||||
@@ -219,7 +231,8 @@ It contains instrumentation for trace and depends on:
|
||||
[#2]: https://github.com/riandyrn/otelchi/pull/2
|
||||
[#1]: https://github.com/riandyrn/otelchi/pull/1
|
||||
|
||||
[Unreleased]: https://github.com/riandyrn/otelchi/compare/v0.10.0...HEAD
|
||||
[Unreleased]: https://github.com/riandyrn/otelchi/compare/v0.10.1...HEAD
|
||||
[0.10.1]: https://github.com/riandyrn/otelchi/releases/tag/v0.10.1
|
||||
[0.10.0]: https://github.com/riandyrn/otelchi/releases/tag/v0.10.0
|
||||
[0.9.0]: https://github.com/riandyrn/otelchi/releases/tag/v0.9.0
|
||||
[0.8.0]: https://github.com/riandyrn/otelchi/releases/tag/v0.8.0
|
||||
|
||||
+22
@@ -3,12 +3,14 @@ package otelchi
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/felixge/httpsnoop"
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.20.0"
|
||||
@@ -202,6 +204,12 @@ func (tw traceware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
span.SetName(spanName)
|
||||
}
|
||||
|
||||
// check if the request is a WebSocket upgrade request
|
||||
if isWebSocketRequest(r) {
|
||||
span.SetStatus(codes.Unset, "WebSocket upgrade request")
|
||||
return
|
||||
}
|
||||
|
||||
// set status code attribute
|
||||
span.SetAttributes(semconv.HTTPStatusCode(rrw.status))
|
||||
|
||||
@@ -221,3 +229,17 @@ func addPrefixToSpanName(shouldAdd bool, prefix, spanName string) string {
|
||||
}
|
||||
return spanName
|
||||
}
|
||||
|
||||
// isWebSocketRequest checks if an HTTP request is a WebSocket upgrade request
|
||||
// Fix: https://github.com/riandyrn/otelchi/issues/66
|
||||
func isWebSocketRequest(r *http.Request) bool {
|
||||
// Check if the Connection header contains "Upgrade"
|
||||
connectionHeader := r.Header.Get("Connection")
|
||||
if !strings.Contains(strings.ToLower(connectionHeader), "upgrade") {
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if the Upgrade header is "websocket"
|
||||
upgradeHeader := r.Header.Get("Upgrade")
|
||||
return strings.ToLower(upgradeHeader) == "websocket"
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package otelchi
|
||||
|
||||
// Version is the current release version of otelchi in use.
|
||||
func Version() string {
|
||||
return "0.10.0"
|
||||
return "0.10.1"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user