From e8c4a24676a58fb6836c1df219f94c0088a2934e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 06:25:01 +0000 Subject: [PATCH 1/2] fix(deps): update opentelemetry-go-contrib monorepo --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index ab34bdcd..ca65dadf 100644 --- a/go.mod +++ b/go.mod @@ -11,8 +11,8 @@ require ( github.com/prometheus/client_golang v1.23.2 github.com/rabbitmq/amqp091-go v1.11.0 github.com/stretchr/testify v1.11.1 - go.opentelemetry.io/contrib/bridges/otelslog v0.14.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0 + go.opentelemetry.io/contrib/bridges/otelslog v0.18.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 go.opentelemetry.io/otel v1.43.0 go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.19.0 go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.19.0 diff --git a/go.sum b/go.sum index fe54e9e6..e2040dae 100644 --- a/go.sum +++ b/go.sum @@ -117,8 +117,12 @@ go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/bridges/otelslog v0.14.0 h1:eypSOd+0txRKCXPNyqLPsbSfA0jULgJcGmSAdFAnrCM= go.opentelemetry.io/contrib/bridges/otelslog v0.14.0/go.mod h1:CRGvIBL/aAxpQU34ZxyQVFlovVcp67s4cAmQu8Jh9mc= +go.opentelemetry.io/contrib/bridges/otelslog v0.18.0 h1:hhPGP3zvvy1xWT9RTy970wlniSxFttBIsAK1gvMguJM= +go.opentelemetry.io/contrib/bridges/otelslog v0.18.0/go.mod h1:twJF7inoMza6kxMcF8JOdL3mPmtOZu7GEr34CUNE6Dg= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0 h1:ssfIgGNANqpVFCndZvcuyKbl0g+UAVcbBcqGkG28H0Y= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0/go.mod h1:GQ/474YrbE4Jx8gZ4q5I4hrhUzM6UPzyrqJYV2AqPoQ= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo= go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho= go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc= go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= From a27252f1f3314f9148fa5bb0e9cec4ca5f9b215d Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Thu, 21 May 2026 09:53:51 +0200 Subject: [PATCH 2/2] fix(planner): replace removed otelhttp.WithRouteTag for v0.68.0 otelhttp.WithRouteTag was removed in v0.65.0. Replace it with a local helper that uses LabelerFromContext, which is the recommended migration path. --- internal/planner/server.go | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/internal/planner/server.go b/internal/planner/server.go index 6bf3c5b2..8a2567f5 100644 --- a/internal/planner/server.go +++ b/internal/planner/server.go @@ -22,6 +22,7 @@ import ( "github.com/canonical/github-runner-operators/internal/database" "github.com/canonical/github-runner-operators/internal/server" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + "go.opentelemetry.io/otel/attribute" ) const ( @@ -83,19 +84,19 @@ func NewServer(store FlavorStore, auth AuthStore, metrics *Metrics, adminToken s // Register routes // General endpoints require either a valid general token or the admin token - s.mux.Handle("GET "+flavorsPattern, otelhttp.WithRouteTag(flavorsPattern, s.adminProtected(http.HandlerFunc(s.listFlavors)))) - s.mux.Handle("POST "+flavorPattern, otelhttp.WithRouteTag(flavorPattern, s.tokenProtected(http.HandlerFunc(s.createFlavor)))) - s.mux.Handle("GET "+flavorPattern, otelhttp.WithRouteTag(flavorPattern, s.tokenProtected(http.HandlerFunc(s.getFlavor)))) - s.mux.Handle("PATCH "+flavorPattern, otelhttp.WithRouteTag(flavorPattern, s.tokenProtected(http.HandlerFunc(s.updateFlavor)))) - s.mux.Handle("DELETE "+flavorPattern, otelhttp.WithRouteTag(flavorPattern, s.tokenProtected(http.HandlerFunc(s.deleteFlavor)))) - s.mux.Handle("GET "+getFlavorPressurePattern, otelhttp.WithRouteTag(getFlavorPressurePattern, s.tokenProtected(http.HandlerFunc(s.getFlavorPressure)))) - s.mux.Handle("POST "+createAuthTokenPattern, otelhttp.WithRouteTag(createAuthTokenPattern, s.adminProtected(http.HandlerFunc(s.createAuthToken)))) - s.mux.Handle("GET "+authTokenBasePattern, otelhttp.WithRouteTag(authTokenBasePattern, s.adminProtected(http.HandlerFunc(s.listAuthTokens)))) - s.mux.Handle("DELETE "+deleteAuthTokenPattern, otelhttp.WithRouteTag(deleteAuthTokenPattern, s.adminProtected(http.HandlerFunc(s.deleteAuthToken)))) - s.mux.Handle("GET "+jobsPattern, otelhttp.WithRouteTag(jobsPattern, s.tokenProtected(http.HandlerFunc(s.listJobs)))) - s.mux.Handle("GET "+jobPattern, otelhttp.WithRouteTag(jobPattern, s.tokenProtected(http.HandlerFunc(s.getJob)))) - s.mux.Handle("PATCH "+jobPattern, otelhttp.WithRouteTag(jobPattern, s.tokenProtected(http.HandlerFunc(s.updateJob)))) - s.mux.Handle("GET "+healthPattern, otelhttp.WithRouteTag(healthPattern, http.HandlerFunc(s.health))) + s.mux.Handle("GET "+flavorsPattern, withRouteTag(flavorsPattern, s.adminProtected(http.HandlerFunc(s.listFlavors)))) + s.mux.Handle("POST "+flavorPattern, withRouteTag(flavorPattern, s.tokenProtected(http.HandlerFunc(s.createFlavor)))) + s.mux.Handle("GET "+flavorPattern, withRouteTag(flavorPattern, s.tokenProtected(http.HandlerFunc(s.getFlavor)))) + s.mux.Handle("PATCH "+flavorPattern, withRouteTag(flavorPattern, s.tokenProtected(http.HandlerFunc(s.updateFlavor)))) + s.mux.Handle("DELETE "+flavorPattern, withRouteTag(flavorPattern, s.tokenProtected(http.HandlerFunc(s.deleteFlavor)))) + s.mux.Handle("GET "+getFlavorPressurePattern, withRouteTag(getFlavorPressurePattern, s.tokenProtected(http.HandlerFunc(s.getFlavorPressure)))) + s.mux.Handle("POST "+createAuthTokenPattern, withRouteTag(createAuthTokenPattern, s.adminProtected(http.HandlerFunc(s.createAuthToken)))) + s.mux.Handle("GET "+authTokenBasePattern, withRouteTag(authTokenBasePattern, s.adminProtected(http.HandlerFunc(s.listAuthTokens)))) + s.mux.Handle("DELETE "+deleteAuthTokenPattern, withRouteTag(deleteAuthTokenPattern, s.adminProtected(http.HandlerFunc(s.deleteAuthToken)))) + s.mux.Handle("GET "+jobsPattern, withRouteTag(jobsPattern, s.tokenProtected(http.HandlerFunc(s.listJobs)))) + s.mux.Handle("GET "+jobPattern, withRouteTag(jobPattern, s.tokenProtected(http.HandlerFunc(s.getJob)))) + s.mux.Handle("PATCH "+jobPattern, withRouteTag(jobPattern, s.tokenProtected(http.HandlerFunc(s.updateJob)))) + s.mux.Handle("GET "+healthPattern, withRouteTag(healthPattern, http.HandlerFunc(s.health))) s.handler = server.LoggingHandler(logger, s.mux) return s @@ -572,6 +573,16 @@ func flushJSONToStream(w http.ResponseWriter, flusher http.Flusher, payload any) return nil } +// withRouteTag annotates the current OTel span with the http.route attribute. +// otelhttp.WithRouteTag was removed in otelhttp v0.65.0; use LabelerFromContext instead. +func withRouteTag(route string, h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + labeler, _ := otelhttp.LabelerFromContext(r.Context()) + labeler.Add(attribute.String("http.route", route)) + h.ServeHTTP(w, r) + }) +} + func decodeFlavorInRequestBody(r *http.Request) (*flavorRequest, error) { decoder := json.NewDecoder(r.Body) defer r.Body.Close()