Skip to content

Commit

Permalink
Add ability to set the job label
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall committed Oct 13, 2024
1 parent b416d05 commit 41ab89f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
13 changes: 7 additions & 6 deletions charts/feature-integrations/docs/integrations/cert-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
| namespaces | list | `[]` | Namespaces to look for cert-manager instances. |
| portName | string | `"http-metrics"` | Name of the port to scrape metrics from. |

### Scrape Settings

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| jobName | string | `"integrations/cert-manager"` | The value of the job label for scraped metrics. |
| scrapeInterval | string | `60s` | How frequently to scrape metrics from Windows Exporter. |

### Metric Processing Settings

| Key | Type | Default | Description |
Expand All @@ -24,9 +31,3 @@
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| name | string | `""` | Name for this cert-manager instance. |

### Scrape Settings

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| scrapeInterval | string | `60s` | How frequently to scrape metrics from Windows Exporter. |
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ portName: http-metrics
# @section -- Scrape Settings
scrapeInterval:

# -- The value of the job label for scraped metrics.
# @section -- Scrape Settings
jobName: integrations/cert-manager

# -- Sets the max_cache_size for cadvisor prometheus.relabel component.
# This should be at least 2x-5x your largest scrape target or samples appended rate.
# ([docs](https://grafana.com/docs/alloy/latest/reference/components/prometheus.relabel/#arguments))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"field_selectors": {
"type": "array"
},
"jobName": {
"type": "string"
},
"labelSelectors": {
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ cert_manager.kubernetes {{ include "helper.alloy_name" .name | quote }} {
{{- if .namespaces }}
namespaces = {{ .namespaces | toJson }}
{{- end }}
job_label = {{ .jobName | quote }}
{{- if $labelSelectors }}
label_selectors = {{ $labelSelectors | toJson }}
{{- end }}
{{- if $fieldSelectors }}
field_selectors = {{ $fieldSelectors | toJson }}
{{- end }}
port_name = {{ .portName | quote }}
port_name = {{ .portName | quote }}
}

cert_manager.scrape {{ include "helper.alloy_name" .name | quote }} {
Expand Down
6 changes: 4 additions & 2 deletions charts/feature-integrations/tests/cert-manager_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ tests:
}
cert_manager.kubernetes "my_cert_manager" {
job_label = "integrations/cert-manager"
label_selectors = ["app.kubernetes.io/name=cert-manager"]
port_name = "http-metrics"
port_name = "http-metrics"
}
cert_manager.scrape "my_cert_manager" {
Expand Down Expand Up @@ -68,8 +69,9 @@ tests:
cert_manager.kubernetes "my_cert_manager" {
namespaces = ["kube-system"]
job_label = "integrations/cert-manager"
label_selectors = ["app.kubernetes.io/name=cert-manager"]
port_name = "http-metrics"
port_name = "http-metrics"
}
cert_manager.scrape "my_cert_manager" {
Expand Down
3 changes: 3 additions & 0 deletions charts/feature-integrations/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
"field_selectors": {
"type": "array"
},
"jobName": {
"type": "string"
},
"labelSelectors": {
"type": "object",
"properties": {
Expand Down
Binary file not shown.

0 comments on commit 41ab89f

Please sign in to comment.