Skip to content

Commit 5734ddf

Browse files
authored
Merge branch 'main' into main
2 parents 85d4619 + 83a5329 commit 5734ddf

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

modules/kubernetes/annotations/README.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ Handles discovery of kubernetes targets and exports them, this component does no
239239
| `label_selectors` | _no_ | `[]` | The [label selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) to use to find matching targets |
240240
| `annotation` | _no_ | `metrics.grafana.com` | The domain to use when looking for annotations, Kubernetes selectors do not support a logical `OR`, if multiple types of annotations are needed, this module should be invoked multiple times. |
241241
| `tenant` | _no_ | `.*` | The tenant to write metrics to. This does not have to be the tenantId, this is the value to look for in the `{{argument.annotation.value}}/tenant` annotation i.e. (`metrics.grafana.com/tenant`), and this can be a regular expression. It is recommended to use a default i.e. `primary\|`, which would match the primary tenant or an empty string meaning the tenant is not set. |
242+
| `scrape_interval` | _no_ | `60s` | How often to scrape metrics from the targets |
243+
| `scrape_timeout` | _no_ | `10s` | How long before a scrape times out |
242244
| `blackbox_url` | _no_ | `""` | The address of the blackbox exporter to use (without the protocol), only the hostname and port i.e. `blackbox-prometheus-blackbox-exporter.default.svc.cluster.local:9115` |
243245

244246
#### Exports
@@ -263,16 +265,14 @@ The following labels are automatically added to exported targets.
263265

264266
#### Arguments
265267

266-
| Name | Required | Default | Description |
267-
| :---------------- | :------- | :---------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
268-
| `targets` | _yes_ | `list(map(string))` | List of targets to scrape |
269-
| `forward_to` | _yes_ | `list(MetricsReceiver)` | Must be a where scraped should be forwarded to |
270-
| `keep_metrics` | _no_ | [see code](module.alloy#L228) | A regular expression of metrics to keep |
271-
| `drop_metrics` | _no_ | [see code](module.alloy#L235) | A regular expression of metrics to drop |
272-
| `scrape_interval` | _no_ | `60s` | How often to scrape metrics from the targets |
273-
| `scrape_timeout` | _no_ | `10s` | How long before a scrape times out |
274-
| `max_cache_size` | _no_ | `100000` | The maximum number of elements to hold in the relabeling cache. This should be at least 2x-5x your largest scrape target or samples appended rate. |
275-
| `clustering` | _no_ | `false` | Whether or not [clustering](https://grafana.com/docs/agent/latest/flow/concepts/clustering/) should be enabled |
268+
| Name | Required | Default | Description |
269+
| :--------------- | :------- | :---------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
270+
| `targets` | _yes_ | `list(map(string))` | List of targets to scrape |
271+
| `forward_to` | _yes_ | `list(MetricsReceiver)` | Must be a where scraped should be forwarded to |
272+
| `keep_metrics` | _no_ | [see code](module.alloy#L228) | A regular expression of metrics to keep |
273+
| `drop_metrics` | _no_ | [see code](module.alloy#L235) | A regular expression of metrics to drop |
274+
| `max_cache_size` | _no_ | `100000` | The maximum number of elements to hold in the relabeling cache. This should be at least 2x-5x your largest scrape target or samples appended rate. |
275+
| `clustering` | _no_ | `false` | Whether or not [clustering](https://grafana.com/docs/agent/latest/flow/concepts/clustering/) should be enabled |
276276

277277
#### Labels
278278

@@ -288,7 +288,7 @@ The following example will scrape all metric annotation instances in cluster.
288288

289289
```alloy
290290
import.git "metric_annotations" {
291-
repository = "https://github.com/grafana/flow-modules.git"
291+
repository = "https://github.com/grafana/alloy-modules.git"
292292
revision = "main"
293293
path = "modules/kubernetes/annotations/metrics.alloy"
294294
pull_frequency = "15m"
@@ -300,7 +300,7 @@ metric_annotations.kubernetes "targets" {
300300
}
301301
302302
// scrape the annotations
303-
metric_annotations.scrape "metrics" {
303+
metric_annotations.metrics "scrape" {
304304
targets = metric_annotations.kubernetes.targets.output
305305
forward_to = [
306306
prometheus.remote_write.default.receiver,
@@ -326,7 +326,7 @@ The following example will scrape all probe annotation instances in cluster.
326326

327327
```alloy
328328
import.git "probe_annotations" {
329-
repository = "https://github.com/grafana/flow-modules.git"
329+
repository = "https://github.com/grafana/alloy-modules.git"
330330
revision = "main"
331331
path = "modules/kubernetes/annotations/probes.alloy"
332332
pull_frequency = "15m"
@@ -338,7 +338,7 @@ probe_annotations.kubernetes "targets" {
338338
}
339339
340340
// scrape the annotations
341-
probe_annotations.scrape "probes" {
341+
probe_annotations.probe "scrape" {
342342
targets = probe_annotations.kubernetes.targets.output
343343
forward_to = [
344344
prometheus.remote_write.default.receiver,

modules/kubernetes/annotations/metrics.alloy

+10-14
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ declare "kubernetes" {
128128
default = false
129129
}
130130

131+
argument "scrape_interval" {
132+
comment = "How often to scrape metrics from the targets (default: 60s)"
133+
optional = true
134+
}
135+
136+
argument "scrape_timeout" {
137+
comment = "How long before a scrape times out (default: 10s)"
138+
optional = true
139+
}
140+
131141
/*
132142
Hidden Arguments
133143
These arguments are used to set reusable variables to avoid repeating logic
@@ -503,16 +513,6 @@ declare "metrics" {
503513
optional = true
504514
}
505515

506-
argument "scrape_interval" {
507-
comment = "How often to scrape metrics from the targets (default: 60s)"
508-
optional = true
509-
}
510-
511-
argument "scrape_timeout" {
512-
comment = "How long before a scrape times out (default: 10s)"
513-
optional = true
514-
}
515-
516516
argument "max_cache_size" {
517517
comment = "The maximum number of elements to hold in the relabeling cache (default: 100000). This should be at least 2x-5x your largest scrape target or samples appended rate."
518518
optional = true
@@ -541,8 +541,6 @@ declare "metrics" {
541541
forward_to = [prometheus.relabel.annotations.receiver]
542542
targets = discovery.relabel.http_annotations.output
543543
scheme = "http"
544-
scrape_interval = coalesce(argument.scrape_interval.value, "60s")
545-
scrape_timeout = coalesce(argument.scrape_timeout.value, "10s")
546544

547545
clustering {
548546
enabled = coalesce(argument.clustering.value, false)
@@ -566,8 +564,6 @@ declare "metrics" {
566564
forward_to = [prometheus.relabel.annotations.receiver]
567565
targets = discovery.relabel.https_annotations.output
568566
scheme = "https"
569-
scrape_interval = coalesce(argument.scrape_interval.value, "60s")
570-
scrape_timeout = coalesce(argument.scrape_timeout.value, "10s")
571567
bearer_token_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
572568

573569
tls_config {

0 commit comments

Comments
 (0)