Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ dependencies = [
"statsd>=3.3.0",
"structlog>=22.1.0",
"symbolic>=13.1.1",
"taskbroker-client>=0.19.1",
"taskbroker-client>=0.19.2",
"tiktoken>=0.8.0",
"tokenizers>=0.22.0",
"tldextract>=5.1.2",
Expand Down
18 changes: 17 additions & 1 deletion src/sentry/taskworker/runtime.py
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,
Expand All @@ -10,10 +13,23 @@
make_producer,
)

metrics_class = SentryMetricsBackend()
if os.getenv("USE_TASKWORKER_METRICS", None):
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
# 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),
Comment thread
sentry[bot] marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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()],
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading