-
Notifications
You must be signed in to change notification settings - Fork 226
feat: Add experimental traceresponse propagator to Rack instrumentation #182
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
plantfansam
merged 14 commits into
open-telemetry:main
from
wperron:instrumentation-rack-tracesponse
Nov 15, 2022
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dac9594
feat: Add experimental traceresponse propagator to Rack instrumentation
wperron 7b6059b
move to different example
wperron b2eeeef
use released version and remove pry
wperron b8bf8d2
add experimental sdk dep in example
wperron dddde9e
pluralize response propagators option
wperron 0b31cef
add test
wperron 2c598c5
adjust whitespace
wperron b7d9d27
minor comments
wperron d95e96b
add case where propagator throws
wperron 6b4f886
remove whitespace from diff
wperron 18763e7
add status code assertion and change case name
wperron 2736718
assert middleware raises on exception
wperron 70c4bb5
Merge branch 'main' into instrumentation-rack-tracesponse
plantfansam 53b4f17
Merge branch 'main' into instrumentation-rack-tracesponse
plantfansam 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # Copyright The OpenTelemetry Authors | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # This uses the response_propagators option. ResponseTextMapPropagator is from the opentelemetry-sdk-experimental gem | ||
| require 'rubygems' | ||
| require 'bundler/setup' | ||
|
|
||
| Bundler.require | ||
|
|
||
| ENV['OTEL_TRACES_EXPORTER'] = 'console' | ||
| OpenTelemetry::SDK.configure do |c | ||
| c.use 'OpenTelemetry::Instrumentation::Rack', { response_propagators: [OpenTelemetry::Trace::Propagation::TraceContext::ResponseTextMapPropagator.new] } | ||
| end | ||
|
|
||
| # setup fake rack application: | ||
| builder = Rack::Builder.app do | ||
| # integration should be automatic in web frameworks (like rails), | ||
| # but for a plain Rack application, enable it in your config.ru, e.g., | ||
| use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware | ||
|
|
||
| app = ->(_env) { [200, { 'Content-Type' => 'text/plain' }, ['All responses are OK']] } | ||
| run app | ||
| end | ||
|
|
||
| # demonstrate tracing (span output to console): | ||
| res = Rack::MockRequest.new(builder).get('/') | ||
| puts res | ||
| puts res.headers |
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
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
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.