-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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(ddm): Add new metrics/query endpoint base code #64785
Conversation
@@ -0,0 +1,61 @@ | |||
from collections.abc import Sequence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied the entire code in data
to make the new changes completely independent of the old ones. Should enable us to keep the old endpoint up and running without problems.
referrer=Referrer.API_DDM_METRICS_QUERY.value, | ||
) | ||
except InvalidMetricsQueryError as e: | ||
return Response(status=400, data={"detail": str(e)}) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
except InvalidMetricsQueryError as e: | ||
return Response(status=400, data={"detail": str(e)}) | ||
except LatestReleaseNotFoundError as e: | ||
return Response(status=404, data={"detail": str(e)}) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
except LatestReleaseNotFoundError as e: | ||
return Response(status=404, data={"detail": str(e)}) | ||
except MetricsQueryExecutionError as e: | ||
return Response(status=500, data={"detail": str(e)}) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
@@ -201,6 +201,15 @@ class OrgAuthTokenPermission(OrganizationPermission): | |||
} | |||
|
|||
|
|||
class OrganizationMetricsPermission(OrganizationPermission): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We needed different permissions since by default we don't have org:read
on POST
.
# TODO: figure out how to make these methods work with HTTP body. | ||
projects=self.get_projects(request, organization), | ||
environments=self.get_environments(request, organization), | ||
referrer=Referrer.API_DDM_METRICS_QUERY.value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a different referrer to separately track in snuba the usage of the new endpoint.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #64785 +/- ##
==========================================
+ Coverage 81.36% 81.37% +0.01%
==========================================
Files 5236 5243 +7
Lines 231130 231453 +323
Branches 45348 45400 +52
==========================================
+ Hits 188058 188347 +289
- Misses 37220 37252 +32
- Partials 5852 5854 +2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline. LGTM
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
This PR adds a new
/metrics/query
endpoint and copies over all thequerying/data
files inquerying/data_v2
to kickstart the development of the updated metrics API.Closes: #64769