echo-otel/v5: rename module, error.type per semconv, Echo.Pre route, v5.0.0 - #21
Merged
Merged
Conversation
vishr
force-pushed
the
echo-v5.4-error-type-v4
branch
2 times, most recently
from
September 28, 2026 17:33
49715de to
5403ddc
Compare
Contributor
|
@vishr , why are you letting LLM do this? Moving repo is a big change of downstream users. |
Member
Author
@aldas Existing users aren't affected. v0.0.1–v0.0.3 stay in the module proxy, GitHub redirects the old URL, and builds on the old path keep working. v0.0.4 only adds a deprecation notice pointing to the new paths. Updates move to echo-otel/v5 and /v4, the same versioning as echo-jwt, plus a v4 line for otelecho users. If you see a specific problem, let me know before the release. |
vishr
force-pushed
the
echo-v5.4-error-type-v4
branch
2 times, most recently
from
September 28, 2026 18:32
4087933 to
a1a0c15
Compare
…v5.0.0 Align with echo-jwt: MAJOR version tracks the Echo version. This is the Echo v5 line, github.com/labstack/echo-otel/v5; Echo v4 is supported on the v4 branch as github.com/labstack/echo-otel/v4. - module github.com/labstack/echo-otel/v5, ScopeName = module path, Version 5.0.0 - minimal Echo v5.2.1 (unchanged), CI also tests the latest Echo v5 - error.type on spans and metrics per the HTTP semantic conventions (#10); semconv v1.40.0, which unwraps fmt.Errorf wrappers for error.type - set http.route and span name when the middleware is added with Echo.Pre; http.route is always the Echo route, never an outer http.ServeMux pattern - metrics only carry low cardinality attributes: server.address, server.port and http.request.method_original stay on spans (Opt-In for metrics) - with ServerName set, server.port no longer comes from the Host header - do not record an unknown (-1) request body size - record a panicking handler (error.type "panic", also after a 4xx response) and re-panic; a panic in a middleware callback keeps the original value; runtime.Goexit and http.ErrAbortHandler are handled; a Recover middleware added after this middleware (PanicStackError) is reported as "panic" - a panic value that carries a status (echo.ErrUnauthorized) records that status - no http.response.status_code when no response status was sent - network.protocol.version "2"/"3" for HTTP/2 and HTTP/3 - http.request.body.size / http.response.body.size are Opt-In on spans and no longer set there; the body size metrics stay - reject a ServerName without a host (for example ":8080") - fix the example module path; build and vet the example in CI - rename extrator.go to extractor.go; CI on Go 1.25, 1.26 and 1.27 - add a middleware benchmark; tests run on Windows (temp dir via the form) - OpenTelemetry v1.46.0 - README: versioning, migrating from echo-opentelemetry and otelecho, custom error handler, error.type, spans, known limitations, Renovate major updates
vishr
force-pushed
the
echo-v5.4-error-type-v4
branch
from
September 28, 2026 18:54
a1a0c15 to
24685b4
Compare
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR becomes
mainfor Echo v5 under the new name and versioning, aligned with echo-jwt. The MAJOR version tracks the Echo version:github.com/labstack/echo-otel/v5main(this PR)v5.0.0v5.2.1github.com/labstack/echo-otel/v4v4(pushed, CI green)v4.0.0v4.15.4github.com/labstack/echo-opentelemetryv0(frozen)v0.0.4, deprecatedThe repository will be renamed
labstack/echo-opentelemetry→labstack/echo-otel. GitHub redirects the old name, and v0.0.1–v0.0.3 stay available in the Go module proxy, so existing builds keep working. v0.0.4 is v0.0.3 plus a// Deprecated:go.mod comment pointing to the new paths.Closes #10.
Changes on main (Echo v5)
github.com/labstack/echo-otel/v5.ScopeNameis the module path andVersionis 5.0.0.error.typeper semconv (http span and error.type #10) on spans and metrics, following the same rules asSpanStatus:_OTHER, or the code itself for 600–999.http.routeand the span name are set when the middleware is added withEcho.Pre.http.routecomes only from the Echo route, never from an outerhttp.ServeMuxpattern.server.address,server.portandhttp.request.method_originalstay on spans only, since they are Opt-In for metrics and their values come from the client. WithServerNameset,server.portno longer comes from theHostheader.error.typepanic, also after a 4xx response was sent) and then re-panicked with the original value, so aRecovermiddleware added first still handles it. A panic inOnNextError,runtime.Goexitandhttp.ErrAbortHandlerare handled too, and aRecovermiddleware added after this one (*middleware.PanicStackError) is also reported aspanic.panic(echo.ErrUnauthorized)) records the status the error handler sends, not 500.http.response.status_codeis not set when no response status was sent, for example after anhttp.ErrAbortHandlerpanic.network.protocol.versionis2and3for HTTP/2 and HTTP/3, instead of2.0and3.0.http.request.body.sizeandhttp.response.body.sizeare Opt-In for spans and are no longer set there. The body size metrics stay.ServerNamewithout a host (for example:8080) is rejected.echo-opentelemetryand fromotelecho, with an option-to-field table.error.typeand panic rules.url.query(with redaction) and the body sizes.Echo v4 (separate
v4branch, not in this PR)The same middleware for Echo v4, for otelecho users who stay on Echo v4:
echo.Contextinstead of*echo.Context.ResolveResponseStatusmirrorsDefaultHTTPErrorHandler.http.routecomes fromc.Path().HTTPErrorreports its status code aserror.type.OnNextError: c.Error(err)supports custom error handlers.Recovermiddleware added after this one sends 500 through the error handler, so it is reported as a 5xx response (error.type500).The framework-independent extractor is identical on both branches, and fixes are cherry-picked from
maintov4.Testing
Coverage is 96.5% for v5 and 96.6% for v4. On both modules:
make check(lint, vet, gosec, race), shuffled test runs, andGOOS=windows go vetA local end-to-end simulation of the renamed repository and tags checked that:
go get -umoves them to v0.0.4 and prints the deprecation notice.@latestis v0.0.4 and never jumps to v4 or v5./v5and/v4both resolve.Release order
v5.0.0.v4branch and tagv4.0.0.v0branch and tagv0.0.4.Open PRs #19 and #20 will need a rebase onto the new module path.