-
Notifications
You must be signed in to change notification settings - Fork 61
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
[Integration][New Relic] - Add support for service level #840
Conversation
"serviceLevelIndicator": { | ||
"type": "number", | ||
"title": "Service Level Indicator" |
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.
"serviceLevelIndicator": { | |
"type": "number", | |
"title": "Service Level Indicator" | |
"sli": { | |
"type": "number", | |
"title": "SLI" |
): | ||
nrql = ( | ||
service_level.get("serviceLevel", {}) | ||
.get("indicators", [])[0] |
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.
is it possible that they will have more than one indicator and would want to have more than one?
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.
I confirmed this and it is not possible to have more than 1
actor { | ||
account(id: {{ account_id }}) { | ||
nrql(query: "{{ nrql_query }}") { | ||
results |
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.
how is that query is specific for SLI, can you add an example of the expected query that will be generated
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.
"indicator":{
"nrql":"SELECT clamp_max((sum(newrelic.sli.valid) - sum(newrelic.sli.bad)) / sum(newrelic.sli.valid) * 100, 100) AS 'SLI' FROM Metric WHERE entity.guid = 'NDM2OTY4MHxFWFR8U0VSVklDRV9MRVZFTHw1OTk0MzM' UNTIL 2 minutes AGO"
}
async for service_level in send_paginated_graph_api_request( | ||
self.http_client, |
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.
if you look inside the send_paginated_graph_api_request
it actually already fetched a batch, but returns it item by item, so to make it return faster, and maybe async gather the SLIs for multiple SLOs I would suggest either adjusting the send_paginated_graph_api_request
or gathering a size of a batch and then bringing the SLI
for each one, and using the stream_async_iterators_tasks
to return the results for each one.
extract_data=self._extract_service_levels, | ||
): | ||
nrql = ( | ||
service_level.get("serviceLevel", {}) |
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.
add comment about that you are taking the nrql
that the SLI is actually built from and query it to get the result
from newrelic_integration.utils import ( | ||
get_port_resource_configuration_by_newrelic_entity_type, | ||
get_port_resource_configuration_by_port_kind, | ||
) | ||
|
||
MAX_CONCURRENT_REQUESTS = 10 |
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.
you are using it only by the newRelicServiceLevel
so I would give it a more specific name
@staticmethod | ||
def _format_tags(entity: dict[Any, Any]) -> dict[Any, Any]: | ||
entity["tags"] = {tag["key"]: tag["values"] for tag in entity.get("tags", [])} | ||
return entity |
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.
this is repeating code we already have in core/entities.py
I would move it to core/utils
and re-use it in all places
integrations/newrelic/CHANGELOG.md
Outdated
@@ -7,14 +7,54 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
|
|||
<!-- towncrier release notes start --> | |||
|
|||
# Port_Ocean 0.1.65 (2024-08-01) | |||
# Port_Ocean 0.1.70 (2024-08-15) |
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.
## 0.1.70 (2024-08-15)
Description
What - Added support for New Relic Service Levels
Why -
How - Used the NerdGraphQL API to query entities of type SERVICE_LEVEL
Type of change
Please leave one option from the following and delete the rest:
Screenshots
API Documentation
Sample response