Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow adding extra outputs #640

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions charts/k8s-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ The Prometheus and Loki services may be hosted on the same cluster, or remotely
| externalServices.loki.basicAuth.usernameKey | string | `"username"` | The key for the username property in the secret |
| externalServices.loki.externalLabels | object | `{}` | Custom labels to be added to all logs and events, all values are treated as strings and automatically quoted. |
| externalServices.loki.externalLabelsFrom | object | `{}` | Custom labels to be added to all logs and events through a dynamic reference, all values are treated as raw strings and not quoted. |
| externalServices.loki.extraOutputs | list | `[]` | Extra outputs configured in Alloy to send logs to at the end on the pipeline. When the protocol is "loki" the output is in the Loki format, while if the protocol is "otlp" or "otlphttp" it is the OTel format. |
| externalServices.loki.host | string | `""` | Loki host where logs and events will be sent |
| externalServices.loki.hostKey | string | `"host"` | The key for the host property in the secret |
| externalServices.loki.processors.batch.maxSize | int | `0` | Upper limit of a batch size. When set to 0, there is no upper limit. |
Expand Down Expand Up @@ -257,6 +258,7 @@ The Prometheus and Loki services may be hosted on the same cluster, or remotely
| externalServices.prometheus.basicAuth.usernameKey | string | `"username"` | The key for the username property in the secret |
| externalServices.prometheus.externalLabels | object | `{}` | Custom labels to be added to all time series, all values are treated as strings and automatically quoted. |
| externalServices.prometheus.externalLabelsFrom | object | `{}` | Custom labels to be added to all time series through a dynamic reference, all values are treated as raw strings and not quoted. |
| externalServices.prometheus.extraOutputs | list | `[]` | Extra outputs configured in Alloy to send metics to at the end on the pipeline. When the protocol is "remote_write" the output is in the Prometheus format, while if the protocol is "otlp" or "otlphttp" it is the OTel format. |
| externalServices.prometheus.host | string | `""` | Prometheus host where metrics will be sent |
| externalServices.prometheus.hostKey | string | `"host"` | The key for the host property in the secret |
| externalServices.prometheus.processors.batch.maxSize | int | `0` | Upper limit of a batch size. When set to 0, there is no upper limit. |
Expand Down Expand Up @@ -759,6 +761,9 @@ The Prometheus and Loki services may be hosted on the same cluster, or remotely
|-----|------|---------|-------------|
| receivers.grafanaCloudMetrics.enabled | bool | `true` | Generate host info metrics from telemetry data, used in Application Observability in Grafana Cloud. |
| receivers.processors.batch.maxSize | int | `0` | The upper limit of the amount of data contained in a single batch, in bytes. When set to 0, batches can be any size. |
| receivers.processors.batch.output.logs | list | `[]` | Extra outputs to send the batched logs to. |
| receivers.processors.batch.output.metrics | list | `[]` | Extra outputs to send the batched metrics to. |
| receivers.processors.batch.output.traces | list | `[]` | Extra outputs to send the batched traces to. |
| receivers.processors.batch.size | int | `16384` | What batch size to use, in bytes |
| receivers.processors.batch.timeout | string | `"2s"` | How long before sending (Processors) |
| receivers.processors.k8sattributes.annotations | list | `[]` | Kubernetes annotations to extract and add to the attributes of the received telemetry data. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ loki.process "logs_service" {
}

{{- if eq .Values.externalServices.loki.protocol "loki" }}
forward_to = [loki.write.logs_service.receiver]
forward_to = [{{ append (.Values.externalServices.loki.extraOutputs | default (list)) "loki.write.logs_service.receiver" | join "," }}]
}
{{ include "alloy.config.logsServiceLoki" . }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ otelcol.processor.memory_limiter "logs_service" {
output {
{{- end }}
{{- if eq .protocol "otlp" }}
logs = [otelcol.exporter.otlp.logs_service.input]
logs = [{{ append (.Values.externalServices.loki.extraOutputs | default (list)) "otelcol.exporter.otlp.logs_service.input" | join "," }}]
{{- end }}
{{- if eq .protocol "otlphttp" }}
logs = [otelcol.exporter.otlphttp.logs_service.input]
logs = [{{ append (.Values.externalServices.loki.extraOutputs | default (list)) "otelcol.exporter.otlphttp.logs_service.input" | join "," }}]
{{- end }}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ prometheus.relabel "metrics_service" {
{{- end }}

{{- if eq .Values.externalServices.prometheus.protocol "remote_write" }}
forward_to = [prometheus.remote_write.metrics_service.receiver]
forward_to = [{{ append (.Values.externalServices.prometheus.extraOutputs | default (list)) "prometheus.remote_write.metrics_service.receiver" | join "," }}]
}
{{ include "alloy.config.metricsServiceRemoteWrite" . }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ otelcol.processor.memory_limiter "metrics_service" {
output {
{{- end }}
{{- if eq .protocol "otlp" }}
metrics = [otelcol.exporter.otlp.metrics_service.input]
metrics = [{{ append (.Values.externalServices.prometheus.extraOutputs | default (list)) "otelcol.exporter.otlp.metrics_service.input" | join "," }}]
{{- end }}
{{- if eq .protocol "otlphttp" }}
metrics = [otelcol.exporter.otlphttp.metrics_service.input]
metrics = [{{ append (.Values.externalServices.prometheus.extraOutputs | default (list)) "otelcol.exporter.otlphttp.metrics_service.input" | join "," }}]
{{- end }}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ otelcol.processor.k8sattributes "default" {
{{- end }}
{{- if .Values.traces.enabled }}
traces = [
otelcol.processor.transform.default.input,
otelcol.processor.transform.default.input,
{{- if and .Values.metrics.enabled .Values.receivers.grafanaCloudMetrics.enabled }}
otelcol.connector.host_info.default.input,
{{- end }}
Expand Down Expand Up @@ -287,16 +287,16 @@ otelcol.processor.batch "batch_processor" {
{{- end }}
output {
{{- if .Values.metrics.enabled }}
metrics = [otelcol.exporter.prometheus.metrics_converter.input]
metrics = [{{ append ((.Values.receivers.processors.batch.output).metrics | default (list)) "otelcol.exporter.prometheus.metrics_converter.input" | join "," }}]
{{- end }}
{{- if .Values.logs.enabled }}
logs = [otelcol.exporter.loki.logs_converter.input]
logs = [{{ append ((.Values.receivers.processors.batch.output).logs | default (list)) "otelcol.exporter.loki.logs_converter.input" | join "," }}]
{{- end }}
{{- if .Values.traces.enabled }}
{{- if eq .Values.externalServices.tempo.protocol "otlp" }}
traces = [otelcol.exporter.otlp.traces_service.input]
traces = [{{ append ((.Values.receivers.processors.batch.output).traces | default (list)) "otelcol.exporter.otlp.traces_service.input" | join "," }}]
{{- else if eq .Values.externalServices.tempo.protocol "otlphttp" }}
traces = [otelcol.exporter.otlphttp.traces_service.input]
traces = [{{ append ((.Values.receivers.processors.batch.output).traces | default (list)) "otelcol.exporter.otlphttp.traces_service.input" | join "," }}]
{{- end }}
{{- end }}
}
Expand Down
23 changes: 20 additions & 3 deletions charts/k8s-monitoring/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@
"externalLabelsFrom": {
"type": "object"
},
"extraOutputs": {
"type": "array"
},
"host": {
"type": "string"
},
Expand Down Expand Up @@ -393,6 +396,9 @@
"externalLabelsFrom": {
"type": "object"
},
"extraOutputs": {
"type": "array"
},
"host": {
"type": "string"
},
Expand Down Expand Up @@ -757,9 +763,6 @@
"enabled": {
"type": "boolean"
},
"extraConfig": {
"type": "string"
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason behind removing this one here?

"extraRelabelingRules": {
"type": "string"
},
Expand Down Expand Up @@ -2120,6 +2123,20 @@
"maxSize": {
"type": "integer"
},
"output": {
"type": "object",
"properties": {
"logs": {
"type": "array"
},
"metrics": {
"type": "array"
},
"traces": {
"type": "array"
}
}
},
"size": {
"type": "integer"
},
Expand Down
21 changes: 21 additions & 0 deletions charts/k8s-monitoring/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ externalServices:
# @section -- External Services (Prometheus)
sendNativeHistograms: false

# -- Extra outputs configured in Alloy to send metics to at the end on the pipeline. When the protocol is "remote_write" the output is in the Prometheus format, while if the protocol is "otlp" or "otlphttp" it is the OTel format.
# @section -- External Services (Prometheus)
extraOutputs: []

# Connection information for Grafana Loki
loki:
# -- Loki host where logs and events will be sent
Expand Down Expand Up @@ -272,6 +276,10 @@ externalServices:
# @section -- External Services (Loki)
limit: 0MiB

# -- Extra outputs configured in Alloy to send logs to at the end on the pipeline. When the protocol is "loki" the output is in the Loki format, while if the protocol is "otlp" or "otlphttp" it is the OTel format.
# @section -- External Services (Loki)
extraOutputs: []

# Connection information for Grafana Tempo
tempo:
# -- Tempo host where traces will be sent
Expand Down Expand Up @@ -1733,6 +1741,19 @@ receivers:
# @section -- OTEL Receivers (Processors)
timeout: 2s

# Extra outputs to send the batched data to.
# @section -- OTEL Receivers (Processors)
output:
# -- Extra outputs to send the batched metrics to.
# @section -- OTEL Receivers (Processors)
metrics: []
# -- Extra outputs to send the batched logs to.
# @section -- OTEL Receivers (Processors)
logs: []
# -- Extra outputs to send the batched traces to.
# @section -- OTEL Receivers (Processors)
traces: []

# Attribute processor for OTLP/gRPC, OTLP/HTTP, Jaeger, or Zipkin receivers
# @section -- OTEL Receivers (Processors)
k8sattributes:
Expand Down