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

[ruby] Add metrics #2246

Closed
5 tasks done
Tracked by #36
sl0thentr0py opened this issue Feb 12, 2024 · 0 comments · Fixed by #2247
Closed
5 tasks done
Tracked by #36

[ruby] Add metrics #2246

sl0thentr0py opened this issue Feb 12, 2024 · 0 comments · Fixed by #2247
Assignees

Comments

@sl0thentr0py
Copy link
Member

sl0thentr0py commented Feb 12, 2024

getsentry/team-sdks#36

Tasks

@sl0thentr0py sl0thentr0py self-assigned this Feb 12, 2024
@sl0thentr0py sl0thentr0py changed the title add metrics Add metrics Feb 12, 2024
@smeubank smeubank changed the title Add metrics [ruby] Add metrics Feb 19, 2024
@smeubank smeubank linked a pull request Feb 29, 2024 that will close this issue
sl0thentr0py added a commit that referenced this issue Mar 12, 2024
* new `Sentry::Metrics` module with 4 apis that map to the new 4 `Sentry::Metrics::Metric` classes
  * `increment` - simple counter
  * `distribution` -  array of observations
  * `gauge` - statistics (last/min/max/sum/count)
  * `set` - unique values
* new `Sentry::Metrics::Aggregator` that 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_shift` once per startup to create jittering
  * flushable buckets are sent in a new `statsd` type envelope that is not json so made a small change to the `Envelope::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
@sl0thentr0py sl0thentr0py reopened this Mar 12, 2024
sl0thentr0py added a commit that referenced this issue Mar 12, 2024
* add a `LocalAggregator` instance on spans to duplicate metrics on the span as a gauge metric
* proxy the main aggregator add calls to the local aggregator if a span is running
* start a `metric.timing` span in the `Sentry::Metrics.timing` API
* add `before_emit` callback


part of #2246
sl0thentr0py added a commit that referenced this issue Mar 12, 2024
* sent once a day or once per application run on that day
* sent as separate json envelope item `metric_meta`
* controlled with `config.metrics.enable_code_locations`, defaults to true

part of #2246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant