sentry-ruby
sentry-ruby copied to clipboard
Add Metrics API and aggregator
- new
Sentry::Metricsmodule with 4 apis that map to the new 4Sentry::Metrics::Metricclassesincrement- simple counterdistribution- array of observationsgauge- statistics (last/min/max/sum/count)set- unique values
- new
Sentry::Metrics::Aggregatorthat starts a thread that flushes pending metric buckets in 5 second intervals- buckets are a nested hash of timestamp (rolled to 10 second intervals) -> metric keys -> actual metric instance
- there is a random
flush_shiftonce per startup to create jittering - flushable buckets are sent in a new
statsdtype envelope that is not json so made a small change to theEnvelope::Item - tag key/values are sanitized for unicode/special characters according to the two regexes
Reference spec - https://develop.sentry.dev/sdk/metrics/
part of #2246
Codecov Report
Merging #2247 (0e87bab) into master (478c4cf) will increase coverage by
0.12%. The diff coverage is99.50%.
Additional details and impacted files
@@ Coverage Diff @@
## master #2247 +/- ##
==========================================
+ Coverage 97.41% 97.54% +0.12%
==========================================
Files 102 110 +8
Lines 3828 4026 +198
==========================================
+ Hits 3729 3927 +198
Misses 99 99
| Components | Coverage Δ | |
|---|---|---|
| sentry-ruby | 98.23% <99.50%> (+0.08%) |
:arrow_up: |
| sentry-rails | 95.05% <ø> (ø) |
|
| sentry-sidekiq | 94.70% <ø> (ø) |
|
| sentry-resque | 92.30% <ø> (+1.53%) |
:arrow_up: |
| sentry-delayed_job | 95.60% <ø> (ø) |
|
| sentry-opentelemetry | 100.00% <ø> (ø) |
| Files | Coverage Δ | |
|---|---|---|
| sentry-ruby/lib/sentry-ruby.rb | 96.56% <100.00%> (+0.12%) |
:arrow_up: |
| sentry-ruby/lib/sentry/configuration.rb | 98.80% <100.00%> (+0.01%) |
:arrow_up: |
| sentry-ruby/lib/sentry/envelope.rb | 97.95% <100.00%> (ø) |
|
| sentry-ruby/lib/sentry/metrics.rb | 100.00% <100.00%> (ø) |
|
| sentry-ruby/lib/sentry/metrics/configuration.rb | 100.00% <100.00%> (ø) |
|
| sentry-ruby/lib/sentry/metrics/counter_metric.rb | 100.00% <100.00%> (ø) |
|
| ...try-ruby/lib/sentry/metrics/distribution_metric.rb | 100.00% <100.00%> (ø) |
|
| sentry-ruby/lib/sentry/metrics/gauge_metric.rb | 100.00% <100.00%> (ø) |
|
| sentry-ruby/lib/sentry/metrics/metric.rb | 100.00% <100.00%> (ø) |
|
| sentry-ruby/lib/sentry/metrics/set_metric.rb | 100.00% <100.00%> (ø) |
|
| ... and 3 more |
will add unit lists in separate PR
@st0012 im gonna start merging these because we want to ship this week. If you have things you want changed, feel free to leave reviews anyway, I can change them separately.