Skip to content

Commit

Permalink
Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py committed Aug 16, 2023
1 parent 0afa9a3 commit 9ffcc1f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
config.trace_propagation_targets = [/.*/] # default is to all targets
config.trace_propagation_targets = [/example.com/, 'foobar.org/api/v2']
```
- Tracing without Performance
- Implement `PropagationContext` on `Scope` and add `Sentry.get_trace_propagation_headers` API [#2084](https://github.com/getsentry/sentry-ruby/pull/2084)

The SDK now supports connecting arbitrary events (Errors / Transactions / Replays) across distributed services and not just Transactions.
To continue an incoming trace starting with this version of the SDK, use `Sentry.continue_trace` as follows.

```rb
# rack application
def call(env)
transaction = Sentry.continue_trace(env, name: 'transaction', op: 'op')
Sentry.start_transaction(transaction: transaction)
end
```

To inject headers into outgoing requests, use `Sentry.get_trace_propagation_headers` to get a hash of headers to add to your request.

## 5.10.0

Expand Down
10 changes: 5 additions & 5 deletions sentry-ruby/lib/sentry/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def request(req, body = nil, &block)

Sentry.with_child_span(op: OP_NAME, start_timestamp: Sentry.utc_now.to_f) do |sentry_span|
request_info = extract_request_info(req)
set_propagation_headers(req, request_info)

if propagate_trace?(request_info[:url], Sentry.configuration.trace_propagation_targets)
set_propagation_headers(req)

Check warning on line 36 in sentry-ruby/lib/sentry/net/http.rb

View check run for this annotation

Codecov / codecov/patch

sentry-ruby/lib/sentry/net/http.rb#L35-L36

Added lines #L35 - L36 were not covered by tests
end

super.tap do |res|
record_sentry_breadcrumb(request_info, res)
Expand All @@ -49,10 +52,7 @@ def request(req, body = nil, &block)

private

def set_propagation_headers(req, request_info)
client = Sentry.get_current_client
return unless propagate_trace?(request_info[:url], client.configuration.trace_propagation_targets)

def set_propagation_headers(req)
Sentry.get_trace_propagation_headers&.each { |k, v| req[k] = v }

Check warning on line 56 in sentry-ruby/lib/sentry/net/http.rb

View check run for this annotation

Codecov / codecov/patch

sentry-ruby/lib/sentry/net/http.rb#L56

Added line #L56 was not covered by tests
end

Expand Down

0 comments on commit 9ffcc1f

Please sign in to comment.