Skip to content
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

[PLAT-10672] Fixed: bugsnag.sampling.p is missing or 0 since iOS v1.0.0 #195

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ Changelog

### Enhancements

* Network spans can now be controlled via user callbacks.
* Network spans can now be controlled via user callbacks
[189](https://github.com/bugsnag/bugsnag-cocoa-performance/pull/189)

### Bug fixes

* The span sampling attribute was not being set when equal to 1.0
[195](https://github.com/bugsnag/bugsnag-cocoa-performance/pull/195)

## 1.0.0 (2023-07-17)

Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ GEM
multi_test (0.1.2)
nokogiri (1.15.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.3-x86_64-darwin)
racc (~> 1.4)
optimist (3.0.1)
os (1.0.1)
power_assert (2.0.3)
Expand Down Expand Up @@ -117,6 +119,7 @@ GEM

PLATFORMS
arm64-darwin-22
x86_64-darwin-21

DEPENDENCIES
bugsnag-maze-runner (~> 8.0)
Expand Down
1 change: 1 addition & 0 deletions Sources/BugsnagPerformance/Private/SpanData.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
if (firstClass != BSGFirstClassUnset) {
attributes[@"bugsnag.span.first_class"] = @(firstClass == BSGFirstClassYes);
}
attributes[@"bugsnag.sampling.p"] = @(samplingProbability);
}

void
Expand Down
1 change: 1 addition & 0 deletions features/sampling.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Feature: Sampling
* the trace "Bugsnag-Span-Sampling" header equals "1:1"
* the trace "Bugsnag-Sent-At" header matches the regex "^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$"
* a span field "name" equals "Post-start"
* a span double attribute "bugsnag.sampling.p" equals 1.0
7 changes: 7 additions & 0 deletions features/steps/app_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,10 @@ def assert_received_exactly_spans(span_count, list)
Maze::Schemas::Validator.verify_against_schema(list, 'trace')
Maze::Schemas::Validator.validate_payload_elements(list, 'trace')
end

Then('a span double attribute {string} equals {float}') do |attribute, value|
spans = spans_from_request_list(Maze::Server.list_for('traces'))
selected_attributes = spans.map { |span| span['attributes'].find { |a| a['key'].eql?(attribute) && a['value'].has_key?('doubleValue') } }.compact
selected_attributes = selected_attributes.map { |a| a['value']['doubleValue'] == value }
Maze.check.false(selected_attributes.empty?)
end
Loading