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

feat(tracing) Add spans for snuba queries #16388

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Changes from all commits
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
18 changes: 11 additions & 7 deletions src/sentry/utils/snuba.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import six
import time
import urllib3
import sentry_sdk

from concurrent.futures import ThreadPoolExecutor
from django.conf import settings
Expand Down Expand Up @@ -724,13 +725,16 @@ def snuba_query(params):
query_params, forward, reverse = params
try:
with timer("snuba_query"):
return (
_snuba_pool.urlopen(
"POST", "/query", body=json.dumps(query_params), headers=headers
),
forward,
reverse,
)
body = json.dumps(query_params)
with sentry_sdk.start_span(
op="snuba", description=u"query {}".format(body)
) as span:
span.set_tag("referrer", headers.get("referer", "<unknown>"))
return (
_snuba_pool.urlopen("POST", "/query", body=body, headers=headers),
forward,
reverse,
)
except urllib3.exceptions.HTTPError as err:
raise SnubaError(err)

Expand Down