-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add tracing, request timeouts and move instrumentation to boxo #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+318
−37
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
998863c
fix: larger duration buckets for better visibility
2color 92ea4bc
feat: log accept header
2color 4a03a91
fix: move instrumentation to boxo
2color 2d98247
feat: add tracing with auth token
2color 80a2bce
feat: add 30 second request timeout
2color 771ca9b
chore: remove replace directive
2color 8759a7b
chore: add missing funcSampler
2color ef69b64
chore: remove request timeout
2color edf43b1
chore: update changelog
2color 2cf3afe
chore: go mod tidy
lidel eee4143
chore: go-libp2p-kad-dht v0.28.1
lidel d7ddc88
chore: latest boxo#720
lidel 593d74c
chore: mod tidy
lidel a2bfa98
chore: boxo main
lidel b07e198
Apply suggestions from code review
2color bee051d
fix: typo
2color File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| ## Tracing | ||
|
|
||
| Tracing across the stack follows, as much as possible, the [Open Telemetry] | ||
| specifications. Configuration environment variables are specified in the | ||
| [OpenTelemetry Environment Variable Specification] where possible. The | ||
| [Boxo Tracing] documentation is the basis for tracing here. | ||
|
|
||
| > [!NOTE] | ||
| > A major distinction from the more [general tracing enabled in boxo][Boxo Tracing] is that when | ||
| > tracing is enabled it is restricted to flows through HTTP Gateway requests, rather | ||
| > than also included background processes. | ||
|
|
||
| ### Fractional Sampling | ||
|
|
||
| To sample a % of requests set [`SOMEGUY_SAMPLING_FRACTION`](environment-variables.md#someguy_sampling_fraction) to a value between `0` and `1`. | ||
|
|
||
| ### Per Request | ||
|
|
||
| Per-request tracing is possible when a non-empty [`SOMEGUY_TRACING_AUTH`](environment-variables.md#someguy_tracing_auth) is set in Someguy and when there are both valid | ||
| [Authorization](headers.md#authorization) and [`Traceparent`](headers.md#traceparent) HTTP headers passed in the request. | ||
|
|
||
| ### Per-request tracing example: | ||
|
|
||
| ```console | ||
| $ export SOMEGUY_TRACING_AUTH=CHANGEME-tracing-auth-secret # use value from Someguy config | ||
| $ export CID=bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi | ||
| $ curl -H "Authorization: $SOMEGUY_TRACING_AUTH" -H "Traceparent: 00-$(openssl rand -hex 16)-00$(openssl rand -hex 7)-01" http://127.0.0.1:8090/routing/v1/providers/$CID -v -o /dev/null | ||
| ... | ||
| > Authorization: CHANGEME-tracing-auth-secret | ||
| > Traceparent: 00-b617dc6b6e302ccbabe0115eac80320b-00033792c7de8fc6-01 | ||
| ... | ||
| ```` | ||
|
|
||
| Now you can search for `trace_id = b617dc6b6e302ccbabe0115eac80320b` to find the trace. | ||
|
|
||
| [Boxo Tracing]: https://github.com/ipfs/boxo/blob/main/docs/tracing.md | ||
| [Open Telemetry]: https://opentelemetry.io/ | ||
| [OpenTelemetry Environment Variable Specification]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md | ||
| [Trace Context]: https://www.w3.org/TR/trace-context |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.