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:
dependabot[bot]
2024-10-29 07:59:53 +01:00
committed by Ralf Haferkamp
parent 3540c490e0
commit af71e56246
6 changed files with 41 additions and 6 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ require (
github.com/pkg/xattr v0.4.10
github.com/prometheus/client_golang v1.20.5
github.com/r3labs/sse/v2 v2.10.0
github.com/riandyrn/otelchi v0.10.0
github.com/riandyrn/otelchi v0.10.1
github.com/rogpeppe/go-internal v1.13.1
github.com/rs/cors v1.11.1
github.com/rs/zerolog v1.33.0
+2 -2
View File
@@ -983,8 +983,8 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/riandyrn/otelchi v0.10.0 h1:QMbR/FMDWBOkej6dfyWteYefUKqIFxnyrpaoWRJ9RPQ=
github.com/riandyrn/otelchi v0.10.0/go.mod h1:zBaX2FavWMlsvq4GqHit+QXxF1c5wIMZZFaYyW4+7FA=
github.com/riandyrn/otelchi v0.10.1 h1:x86f8M0pGvjW3tJUxpva4cpdNtMydLPnarIXHssYUy4=
github.com/riandyrn/otelchi v0.10.1/go.mod h1:SWarhA5rdeiCNq+Ygc4p59ZGM5AtYCiyPU/3Q5rzT0M=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
+14 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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"
}
+1 -1
View File
@@ -1676,7 +1676,7 @@ github.com/r3labs/sse/v2
# github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
## explicit
github.com/rcrowley/go-metrics
# github.com/riandyrn/otelchi v0.10.0
# github.com/riandyrn/otelchi v0.10.1
## explicit; go 1.22.0
github.com/riandyrn/otelchi
# github.com/rivo/uniseg v0.4.7