sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

[Java] Add support for Sentry Metrics

Open smeubank opened this issue 1 year ago • 2 comments

Description

Metrics! Sentry will support Metrics finally! First we need all of our SDKs to support Metrics, including Java and dependent SDKs

Requirements:

  • [ ] https://github.com/getsentry/sentry-java/pull/3205
  • [ ] Metrics Summary
  • [ ] Code location
  • [ ] Tag normalization

Question:

How much of this can the Android SDK inherit if added in Java?

Document(s)

Develop Specs SDK Develop Specs Product Specs

smeubank avatar Feb 05 '24 09:02 smeubank

Having looked into the docs and the .NET implementation I want to highlight a few development aspects:

  • The product specs describe the overall API behavior best
  • We not only need to provide APIs on the SDK side, but also need some basic logic to aggregate metrics into 10s buckets
  • We need some async flush functionality to send past buckets to our backend
  • There's a new envelope item, type = statsd for sending metrics
  • We have to keep thread safety (metrics can be emitted by any thread, reading and cleaning up happens every 10s) in mind
  • There's a timing API which connects spans with metrics AND creates gauge metrics aka "summaries" of metrics on a span level
  • When capturing metrics, stack traces are used to determine a code location for an emitted metric, if feasible at all, some caching needs to be done

To get going fast let's split this up into smaller PRs / tasks:

  • [x] Implement basic API, add protocol definitions for sending statsd envelope items
  • [ ] Add support for code locations, linking metrics to source code
  • [x] Add support for the timing API, connecting spans with metrics and creating gauges

markushi avatar Feb 13 '24 16:02 markushi

The product specs describe the overall API behavior best

@markushi do you mean the develop spec? the link is to develop docs, not product

Thanks for investigating in more detail!

smeubank avatar Feb 19 '24 12:02 smeubank

released with 7.6.0 (excluding code location, which is currently blocked and tracked separately)

kahest avatar Mar 08 '24 12:03 kahest