Repository navigation
Add resty v3 (resty.dev/v3) support via restyv3 subpackage - #13
Merged
Merged
Conversation
Adds the restyv3 subpackage with TraceClient for resty.dev/v3 clients. Creates one client span per request attempt, chained to the previous attempt and ended exactly once, tracked via a private context key so the caller's span is never touched. Uses semconv v1.37.0 attributes and adds WithErrorIgnorer and WithIgnoredErrors options.
Associate attempts with their owning request so nested and skipped requests cannot finalize caller spans. Redact credentials in resty.url. Capture transport, redirect, and response middleware errors before Resty rc.4 clears them for retries, honoring ignored errors on every attempt. Finalize retry spans only when another attempt starts or a final hook runs so backoff cancellation and strategy errors remain observable, retaining pre-backoff end timestamps for actual retries.
Set the minimum Go version to 1.26.0, as required by the latest stable OpenTelemetry SDK, and update the shared API, SDK, trace and metric modules to v1.47.0. Use the latest checkout v7.0.1 and setup-go v7.0.0 releases, read the Go version from go.mod, replace deprecated manual caches with setup-go caching, and verify, build, vet and race-test both packages in CI.
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
Implements #8 by adding
github.com/dubonzi/otelresty/restyv3forresty.dev/v3 v3.0.0-rc.4. Users callrestyv3.TraceClient(cli, opts...); the root resty v2 instrumentation is retained alongside the new package.Creates one client span per attempt, chained to the previous attempt and ended exactly once. Nested requests can inherit the parent context without ending or modifying the parent's attempt, including when skipped or rejected before tracing runs. Credentials are redacted in both
resty.urlandurl.full;WithHideURLreplaces both values with<redacted>.Uses HTTP semconv v1.37.0 attributes and marks responses with status >= 400 as Error.
WithErrorIgnorerandWithIgnoredErrorsapply to each attempt. Transport, redirect-policy and response middleware errors are captured before rc.4 clears them during retry processing. Retry spans are finalized when the next attempt starts, using a timestamp from before backoff; cancellation and retry-strategy failures during backoff are recorded by the final error hook.Configure transport, proxy, redirect policy and response middleware before calling
TraceClient. Replacing the wrapped transport or policy afterward bypasses error capture. TLS configuration and idle-connection cleanup still delegate to the original transport. The tests use explicit retry conditions and a custom redirect-policy sentinel because rc.4 has noErrAutoRedirectDisabled.The shared OpenTelemetry API/SDK dependencies are updated to v1.47.0. The module now requires Go 1.26.0, matching the SDK's minimum Go version. CI uses the latest released
actions/checkout@v7.0.1andactions/setup-go@v7.0.0, reads the Go version fromgo.mod, uses setup-go caching, and verifies, builds, vets and race-tests both packages.GOTOOLCHAIN=localprevents CI from silently testing a newer toolchain.Evidence
After: All five original reproducers pass, with permanent regression coverage for each case, request-level retry hooks, retry-strategy errors, unrelated transport errors, TLS configuration,
ErrUseLastResponse, and retry timestamps.go mod verifygo build ./...go vet ./...go test ./... -race -count=1actionlintv1.7.12 passes for.github/workflows/go.yml.git diff --checkMerge Danger
Door: two-way. No migrations or destructive changes.
Blast Radius: project. Consumers need Go 1.26.0 or newer for the updated OpenTelemetry SDK. The new package wraps the configured transport and redirect policy to preserve retry errors; configure these components before instrumentation, as documented in the README and
TraceClientgodoc.