Skip to content

Commit

Permalink
Merge pull request #18799 from brnhensley/patch-2
Browse files Browse the repository at this point in the history
chore: format code blocks
  • Loading branch information
akristen authored Oct 8, 2024
2 parents 0eb26ef + e8805bf commit de04212
Show file tree
Hide file tree
Showing 25 changed files with 995 additions and 1,050 deletions.
10 changes: 5 additions & 5 deletions src/content/docs/data-apis/manage-data/nrintegrationerror.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Here are some examples of queries:
>
Here's a simple query of `NrIntegrationError`. This one shows Event API ingest issues from the last week, with up to 100 results:

```
```sql
SELECT message FROM NrIntegrationError WHERE newRelicFeature = 'Event API' SINCE 1 WEEK AGO LIMIT 100
```

Expand All @@ -55,7 +55,7 @@ Here are some examples of queries:
>
Here's a simple query of issues with the Metric API:

```
```sql
SELECT message FROM NrIntegrationError WHERE newRelicFeature = 'Metrics' SINCE 1 WEEK AGO LIMIT 100
```

Expand All @@ -75,7 +75,7 @@ Here are some examples of queries:
>
Here's a simple query of issues with distributed tracing data:

```
```sql
SELECT message FROM NrIntegrationError WHERE newRelicFeature = 'Distributed Tracing' SINCE 1 WEEK AGO LIMIT 100
```

Expand All @@ -88,7 +88,7 @@ Here are some examples of queries:
>
Here's a query showing a count of `NrIntegrationError` events over time:

```
```sql
SELECT count(*) FROM NrIntegrationError WHERE newRelicFeature = 'Metrics' TIMESERIES
```

Expand All @@ -98,7 +98,7 @@ Here are some examples of queries:

If you want to examine the structure of this event and see what attributes are attached, you can use a [`keyset()`](/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/#keyset) query, like this:

```
```sql
FROM NrIntegrationError SELECT keyset()
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ As delta conversion is a stateful operation, we must be cognizant of time series

Even though the data was recorded by your application and sent as a sequence of monotonically increasing values, calling `sum()` on it will treat it as though it were a sequence of delta values; no need to compute any `derivative()`!

When converting a sum to a delta, New Relic will also emit the cumulative value alongside the delta to maintain the ability for you to query the latest cumulative value. To access the cumulative value, you can use [getField()](/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/#func-getfield) (see [How to query metrics](/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/best-practices/opentelemetry-best-practices-metrics/#query) for examples).
When converting a sum to a delta, New Relic will also emit the cumulative value alongside the delta to maintain the ability for you to query the latest cumulative value. To access the cumulative value, you can use [`getField()`](/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/#func-getfield) (see [How to query metrics](/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/best-practices/opentelemetry-best-practices-metrics/#query) for examples).

Note that data points are plotted at their associated `timestamps` which are the start of an interval. However, cumulative values are associated with the `endTimestamp` of the data point, so you may need to consider the width of a data point when interpreting cumulative queries.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ To install the New Relic Metrics Adapter, we provide the `newrelic-k8s-metrics-a
1. If not already installed, [install our Kubernetes integration](/install/kubernetes).
2. Upgrade the installation to include the New Relic Metrics Adapter with the following command:

```
```shell
helm upgrade --install newrelic newrelic/nri-bundle \
--namespace newrelic --create-namespace --reuse-values \
--set metrics-adapter.enabled=true \
--set newrelic-k8s-metrics-adapter.personalAPIKey=YOUR_NEW_RELIC_PERSONAL_API_KEY \
--set newrelic-k8s-metrics-adapter.config.accountID=YOUR_NEW_RELIC_ACCOUNT_ID \
--set newrelic-k8s-metrics-adapter.config.externalMetrics.external_metric_name.query=NRQL query
--namespace newrelic --create-namespace --reuse-values \
--set metrics-adapter.enabled=true \
--set newrelic-k8s-metrics-adapter.personalAPIKey=YOUR_NEW_RELIC_PERSONAL_API_KEY \
--set newrelic-k8s-metrics-adapter.config.accountID=YOUR_NEW_RELIC_ACCOUNT_ID \
--set newrelic-k8s-metrics-adapter.config.externalMetrics.external_metric_name.query=NRQL query
```

Please notice and adjust the following flags:
Expand Down Expand Up @@ -125,7 +125,8 @@ Based on the HPA definition, the controller manager fetches the metrics from the
The New Relic metrics adapter receives the query including the `nginx_average_requests` metric name and all the selectors, and searches for a matching metric name in the internal memory based on the configured metrics. Then, it adds the selectors to the query to form a final query that is executed using NerdGraph to fetch the value from New Relic. The above example will generate a query like the following:

```sql
FROM Metric SELECT average(nginx.server.net.requestsPerSecond) WHERE clusterName=<clusterName> AND `k8s.namespaceName`='nginx' SINCE 2 MINUTES AGO
FROM Metric SELECT average(nginx.server.net.requestsPerSecond)
WHERE clusterName=CLUSTER_NAME AND `k8s.namespaceName`='nginx' SINCE 2 MINUTES AGO
```

Notice that a `clusterName` filter has been automatically added to the query to exclude metrics from other clusters in the same account. You can remove it by using the `removeClusterFilter` configuration parameter. Also the value is cached for a period of time defined by the `cacheTTLSeconds` configuration parameter, whose default is 30 seconds.
Expand Down Expand Up @@ -172,11 +173,11 @@ Notice that a `clusterName` filter has been automatically added to the query to
To get the value for a specific metric with a selector, run:

```shell
kubectl get --raw "/apis/external.metrics.k8s.io/v1beta1/namespaces/*/__METRIC_NAME__?labelSelector=_SELECTOR_KEY_=_SELECTOR_VALUE_"
kubectl get --raw "/apis/external.metrics.k8s.io/v1beta1/namespaces/*/METRIC_NAME?labelSelector=SELECTOR_KEY=SELECTOR_VALUE"
```

<Callout variant="tip">
You must replace `<metric_name>`, `<selector_key>` and `<selector_value>` with your values.
You must replace `METRIC_NAME`, `SELECTOR_KEY` and `SELECTOR_VALUE` with your values.
</Callout>
</Collapser>

Expand Down
Loading

0 comments on commit de04212

Please sign in to comment.