Skip to content

Commit

Permalink
chore: code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
brnhensley authored Oct 9, 2024
1 parent 1a1e047 commit 6639d2f
Showing 1 changed file with 81 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ To configure the agent using Helm, you should set up your `values.yaml` in one o
>
```yaml
global:
licenseKey: _YOUR_NEW_RELIC_LICENSE_KEY_
cluster: _K8S_CLUSTER_NAME_
licenseKey: YOUR_NEW_RELIC_LICENSE_KEY
cluster: K8S_CLUSTER_NAME

newrelic-prometheus-agent:
enabled: true
Expand All @@ -44,8 +44,8 @@ To configure the agent using Helm, you should set up your `values.yaml` in one o
This option is only recommended if you're an advanced user.

```yaml
licenseKey: _YOUR_NEW_RELIC_LICENSE_KEY_
cluster: _K8S_CLUSTER_NAME_
licenseKey: YOUR_NEW_RELIC_LICENSE_KEY
cluster: K8S_CLUSTER_NAME
config:
# YOUR CONFIGURATION GOES HERE. An example:
Expand Down Expand Up @@ -75,8 +75,8 @@ app_values: ["redis", "traefik", "calico", "nginx", "coredns", "kube-dns", "etcd
Moreover, it might happen that a new version of the integrations filters may cause a target that was already scraped by one job to be scraped a second time.
In order to receive a notification in the event of duplicated data (and prevent duplicate scraping altogether), you can create an alert based on the following query:

```
FROM Metric select uniqueCount(job) facet instance, cluster_name limit 10 since 2 minutes ago
```sql
FROM Metric SELECT uniqueCount(job) FACET instance, cluster_name LIMIT 10 SINCE 2 minutes ago
```

If any value is different from 1 then you have two or more jobs scraping the same instance in the same cluster.
Expand Down Expand Up @@ -106,19 +106,19 @@ The following example only scrapes `Pods` and `Endpoints` with the `newrelic.io/
```yaml
kubernetes:
jobs:
- job_name_prefix: example
integrations_filter:
enabled: false
target_discovery:
pod: true
endpoints: true
filter:
annotations:
# <string>: <regex>
newrelic.io/scrape: 'true'
label:
# <string>: <regex>
k8s.io/app: '(postgres|mysql)'
- job_name_prefix: example
integrations_filter:
enabled: false
target_discovery:
pod: true
endpoints: true
filter:
annotations:
# <string>: <regex>
newrelic.io/scrape: "true"
label:
# <string>: <regex>
k8s.io/app: "(postgres|mysql)"
```

<Callout variant="tip">
Expand Down Expand Up @@ -181,21 +181,21 @@ common:
scrape_interval: 30s
kubernetes:
jobs:
# this job will use the default scrape_interval defined in common.
- job_name_prefix: default-targets-with-30s-interval
target_discovery:
pod: true
filter:
annotations:
newrelic.io/scrape: 'true'
- job_name_prefix: slow-targets-with-60s-interval
scrape_interval: 60s
target_discovery:
pod: true
filter:
annotations:
newrelic.io/scrape_slow: 'true'
# this job will use the default scrape_interval defined in common.
- job_name_prefix: default-targets-with-30s-interval
target_discovery:
pod: true
filter:
annotations:
newrelic.io/scrape: "true"
- job_name_prefix: slow-targets-with-60s-interval
scrape_interval: 60s
target_discovery:
pod: true
filter:
annotations:
newrelic.io/scrape_slow: "true"
```

## Metric and label transformations [#metric-label-transformations]
Expand All @@ -210,21 +210,21 @@ Here's an example of how to use it in different parts of the YAML configuration

```yaml
static_targets:
- name: self-metrics
urls:
- 'http://static-service:8181'
extra_metric_relabel_config:
# Drop metrics with prefix 'go_' for this target.
- source_labels: [__name__]
regex: 'go_.+'
action: drop
- name: self-metrics
urls:
- "http://static-service:8181"
extra_metric_relabel_config:
# Drop metrics with prefix 'go_' for this target.
- source_labels: [__name__]
regex: "go_.+"
action: drop
newrelic_remote_write:
extra_write_relabel_configs:
# Drop all metrics with the specified name before sent to New Relic.
- source_labels: [__name__]
regex: 'metric_name'
action: drop
# Drop all metrics with the specified name before sent to New Relic.
- source_labels: [__name__]
regex: "metric_name"
action: drop
```

### YAML file snippet samples [#config-samples]
Expand Down Expand Up @@ -292,10 +292,10 @@ Add one of these examples in the YAML configuration file from the [metric and la
>
```yaml
- source_labels: [__name__]
regex: 'prefix_.+'
target_label: new_label
action: replace
replacement: newLabelValue
regex: 'prefix_.+'
target_label: new_label
action: replace
replacement: newLabelValue
```
</Collapser>

Expand All @@ -307,7 +307,7 @@ Add one of these examples in the YAML configuration file from the [metric and la

```yaml
- regex: 'label_name'
action: labeldrop
action: labeldrop
```
</Collapser>
</CollapserGroup>
Expand All @@ -328,36 +328,37 @@ Here are some examples to deal with targets that need access authorization:
```yaml
kubernetes:
jobs:
- job_name_prefix: skip-verify-on-https-targets
target_discovery:
pod: true
filter:
annotations:
newrelic.io/scrape: 'true'
- job_name_prefix: bearer-token
target_discovery:
pod: true
filter:
label:
k8s.io/app: my-app-with-token
authorization:
type: Bearer
credentials_file: '/etc/my-app/token'
- job_name_prefix: skip-verify-on-https-targets
target_discovery:
pod: true
filter:
annotations:
newrelic.io/scrape: "true"
- job_name_prefix: bearer-token
target_discovery:
pod: true
filter:
label:
k8s.io/app: my-app-with-token
authorization:
type: Bearer
credentials_file: "/etc/my-app/token"
static_targets:
jobs:
- job_name: mtls-target
scheme: https
targets:
- 'my-mtls-target:8181'
tls_config:
ca_file: '/etc/my-app/client-ca.crt'
cert_file: '/etc/my-app/client.crt'
key_file: '/etc/my-app/client.key'
- job_name: basic-auth-target
targets:
- 'my-basic-auth-static:8181'
basic_auth:
password_file: '/etc/my-app/pass.htpasswd'
- job_name: mtls-target
scheme: https
targets:
- "my-mtls-target:8181"
tls_config:
ca_file: "/etc/my-app/client-ca.crt"
cert_file: "/etc/my-app/client.crt"
key_file: "/etc/my-app/client.key"
- job_name: basic-auth-target
targets:
- "my-basic-auth-static:8181"
basic_auth:
password_file: "/etc/my-app/pass.htpasswd"
```

0 comments on commit 6639d2f

Please sign in to comment.