Skip to content

Commit

Permalink
Otel Pipeline Improvements (#613)
Browse files Browse the repository at this point in the history
* Embed the default span filters

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Make the resourcedetection component more configurable

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Update examples

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Fix yamllint config

Signed-off-by: Pete Wall <pete.wall@grafana.com>

---------

Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall authored Sep 30, 2024
1 parent cc1ee57 commit a1ea119
Show file tree
Hide file tree
Showing 74 changed files with 316 additions and 414 deletions.
4 changes: 2 additions & 2 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ yaml-files:
- ".yamllint"

ignore:
- .git
- data-alloy
- node_modules
- .git
- examples/**/output.yaml
- charts/k8s-monitoring-v1/docs/examples/**/output.yaml
- charts/**/templates

extends: default
Expand Down
4 changes: 3 additions & 1 deletion charts/k8s-monitoring-v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,8 @@ The Prometheus and Loki services may be hosted on the same cluster, or remotely
| receivers.processors.k8sattributes.annotations | list | `[]` | Kubernetes annotations to extract and add to the attributes of the received telemetry data. |
| receivers.processors.k8sattributes.labels | list | `[]` | Kubernetes labels to extract and add to the attributes of the received telemetry data. |
| receivers.processors.k8sattributes.metadata | list | `["k8s.namespace.name","k8s.pod.name","k8s.deployment.name","k8s.statefulset.name","k8s.daemonset.name","k8s.cronjob.name","k8s.job.name","k8s.node.name","k8s.pod.uid","k8s.pod.start_time"]` | Kubernetes metadata to extract and add to the attributes of the received telemetry data. |
| receivers.processors.resourcedetection.env | object | `{"enabled":true}` | Read resource information from the OTEL_RESOURCE_ATTRIBUTES environment variable. |
| receivers.processors.resourcedetection.system | object | `{"enabled":true,"hostnameSources":["os"],"resourceAttributes":{}}` | Query the host machine to retrieve various resource attributes. |

### OTEL Receivers (gRPC)

Expand Down Expand Up @@ -908,7 +910,7 @@ The Prometheus and Loki services may be hosted on the same cluster, or remotely
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| traces.enabled | bool | `false` | Receive and forward traces. |
| traces.receiver.filters | object | `{"span":[],"spanevent":[]}` | Apply a filter to traces received via the OTLP or OTLP HTTP receivers. ([docs](https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.filter/)) |
| traces.receiver.filters | object | `{"span":["attributes[\"http.route\"] == \"/live\"","attributes[\"http.route\"] == \"/healthy\"","attributes[\"http.route\"] == \"/ready\""],"spanevent":[]}` | Apply a filter to traces received via the OTLP or OTLP HTTP receivers. ([docs](https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.filter/)) |
| traces.receiver.transforms | object | `{"resource":[],"span":[],"spanevent":[]}` | Apply a transformation to traces received via the OTLP or OTLP HTTP receivers. ([docs](https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.transform/)) |

### Other Values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ otelcol.receiver.otlp "receiver" {

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -49,14 +48,13 @@ otelcol.processor.transform "add_metric_datapoint_attributes" {
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ data:

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -181,14 +180,13 @@ data:
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down Expand Up @@ -68571,7 +68569,6 @@ data:

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -68584,14 +68581,13 @@ data:
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ otelcol.receiver.otlp "receiver" {

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -50,14 +49,13 @@ otelcol.processor.transform "add_metric_datapoint_attributes" {
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down Expand Up @@ -135,6 +133,13 @@ otelcol.processor.transform "default" {

otelcol.processor.filter "default" {
error_mode = "ignore"
traces {
span = [
"attributes[\"http.route\"] == \"/live\"",
"attributes[\"http.route\"] == \"/healthy\"",
"attributes[\"http.route\"] == \"/ready\"",
]
}

output {
metrics = [otelcol.processor.batch.batch_processor.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ data:

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -224,14 +223,13 @@ data:
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down Expand Up @@ -309,6 +307,13 @@ data:

otelcol.processor.filter "default" {
error_mode = "ignore"
traces {
span = [
"attributes[\"http.route\"] == \"/live\"",
"attributes[\"http.route\"] == \"/healthy\"",
"attributes[\"http.route\"] == \"/ready\"",
]
}

output {
metrics = [otelcol.processor.batch.batch_processor.input]
Expand Down Expand Up @@ -69773,7 +69778,6 @@ data:

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -69786,14 +69790,13 @@ data:
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down Expand Up @@ -69871,6 +69874,13 @@ data:

otelcol.processor.filter "default" {
error_mode = "ignore"
traces {
span = [
"attributes[\"http.route\"] == \"/live\"",
"attributes[\"http.route\"] == \"/healthy\"",
"attributes[\"http.route\"] == \"/ready\"",
]
}

output {
metrics = [otelcol.processor.batch.batch_processor.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ otelcol.receiver.otlp "receiver" {

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -49,14 +48,13 @@ otelcol.processor.transform "add_metric_datapoint_attributes" {
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down
12 changes: 4 additions & 8 deletions charts/k8s-monitoring-v1/docs/examples/azure-aks/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ data:

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -181,14 +180,13 @@ data:
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down Expand Up @@ -68515,7 +68513,6 @@ data:

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -68528,14 +68525,13 @@ data:
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ otelcol.receiver.otlp "receiver" {

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -49,14 +48,13 @@ otelcol.processor.transform "add_metric_datapoint_attributes" {
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ data:

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -180,14 +179,13 @@ data:
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down Expand Up @@ -68503,7 +68501,6 @@ data:

// Processors
otelcol.processor.transform "add_metric_datapoint_attributes" {
// Grafana Cloud Kubernetes monitoring expects Loki labels `cluster`, `pod`, and `namespace`
error_mode = "ignore"
metric_statements {
context = "datapoint"
Expand All @@ -68516,14 +68513,13 @@ data:
metrics = [otelcol.processor.k8sattributes.default.input]
}
}

otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]

system {
hostname_sources = ["os"]
}

detectors = ["env","system"]

output {
metrics = [otelcol.processor.transform.add_metric_datapoint_attributes.input]
logs = [otelcol.processor.k8sattributes.default.input]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ externalServices:
host: https://loki.example.com
basicAuth:
username: 12345
password: "It's a secret to everyone"
password: "It's a secret to everyone"
Loading

0 comments on commit a1ea119

Please sign in to comment.