-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(tasks) Add taskbroker-client metrics for tasks #118052
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
Changes from 1 commit
bbd23f9
6a04c4e
6fc270b
2d76ea0
56b556f
08b72ea
8cb98aa
785bf98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| import os | ||
|
|
||
| from django.conf import settings | ||
| from django.core.cache import cache | ||
| from taskbroker_client.app import TaskbrokerApp | ||
| from taskbroker_client.metrics import DatadogMetrics | ||
|
|
||
| from sentry.taskworker.adapters import ( | ||
| DjangoCacheAtMostOnceStore, | ||
|
|
@@ -10,10 +13,23 @@ | |
| make_producer, | ||
| ) | ||
|
|
||
| metrics_class = SentryMetricsBackend() | ||
| if os.getenv("USE_TASKWORKER_METRICS", None): | ||
| # Metrics created by this interface will not | ||
| # have `sentry.` prefix, and will not have | ||
| # K8S_LABEL applied. | ||
| metrics_class = DatadogMetrics( | ||
| application="sentry", | ||
| statsd_host=os.getenv("HOST_IP", "127.0.0.1"), | ||
| statsd_port=os.getenv("SENTRY_STATSD_PORT", 8126), | ||
|
sentry[bot] marked this conversation as resolved.
Outdated
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we try to funnel this through our existing django settings? having the envvar be read in many places is not great
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good question. I'm not thrilled about the extra env var for the port either. Sadly our production metrics are all configured through getsentry and not env vars. I'll rework this to work with the production & self-hosted django settings. |
||
| sample_rate=settings.SENTRY_METRICS_SAMPLE_RATE, | ||
| enable_prefixed_metrics=True, | ||
| ) | ||
|
|
||
| app = TaskbrokerApp( | ||
| name="sentry", | ||
| producer_factory=make_producer, | ||
| metrics_class=SentryMetricsBackend(), | ||
| metrics_class=metrics_class, | ||
| router_class=SentryRouter(), | ||
| at_most_once_store=DjangoCacheAtMostOnceStore(cache), | ||
| context_hooks=[ViewerContextHook()], | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.