self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

Add Developer Metrics

Open aldy505 opened this issue 1 year ago • 6 comments

Problem Statement

Sentry has Developer Metrics in alpha. We should bring that into self-hosted after GA.

Solution Brainstorm

Discussion: https://github.com/getsentry/sentry/discussions/58584 Feature docs: https://develop.sentry.dev/delightful-developer-metrics/ SDK: https://develop.sentry.dev/sdk/metrics/

SDK guide on Python: https://develop.sentry.dev/delightful-developer-metrics/sending-metrics-sdk/

aldy505 avatar Jan 10 '24 01:01 aldy505

IMPORTANT: See this comment's edit history for older Sentry versions.

To enable the feature, make sure you're on 24.3.0 or higher. You'd need to edit your sentry/sentry.conf.py file and add these feature flags:

SENTRY_FEATURES.update(
  {
    feature: True
    for feature in (
      # ......
      # For DDM
      # Metrics: Enable ingestion and storage of custom metrics. See custom-metrics for UI.
      "organizations:custom-metrics",
      # Enables experimental WIP custom metrics related features
      "organizations:custom-metrics-experimental",
      # Enables automatically deriving of code mappings
      "organizations:derive-code-mappings",
    )
  }
)

Add new Snuba container on your docker-compose.yml:

  snuba-generic-metrics-gauges-consumer:
    <<: *snuba_defaults
    command: rust-consumer --storage generic_metrics_gauges_raw --consumer-group snuba-gen-metrics-gauges-consumers --auto-offset-reset=latest --max-batch-time-ms 1000 --no-strict-offset-reset

Then do ./install.sh all over again.

aldy505 avatar Jan 10 '24 01:01 aldy505

Thanks for creating this issue

hubertdeng123 avatar Jan 11 '24 18:01 hubertdeng123

These are required Database Migrations:

docker compose run --rm snuba-api migrations migrate -g spans

DarkByteZero avatar Feb 21 '24 19:02 DarkByteZero

Hello @ayirr7, since GA for Metrics is near, do you want to re-create this PR https://github.com/getsentry/self-hosted/pull/2757? (You can't reopen since it's already locked, you need to create a new PR)

I believe adding the gauge consumer now is a good idea, since it will ingest some data beforehand, that can be viewed later on the UI when GA's arrived -- so the Metrics UI won't be empty when it's enabled.

aldy505 avatar May 04 '24 15:05 aldy505

To enable the feature, make sure you're on 23.11.2 or higher.

Note for anyone trying to test this on their self-hosted instance, the minimum version is probably actually higher. Had no luck on 24.1.1 (the Metrics page was not showing at all), after upgrading to 24.7.0 it worked well.

marianhlavac avatar Jul 17 '24 15:07 marianhlavac

anybody used the metric alert success? it's never triggered, my version is 24.7.0

xuweixi11 avatar Jul 30 '24 10:07 xuweixi11