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

Adding optional spanlogs feature for converting OTEL traces to logs #981

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ otelcol.processor.resourcedetection "default" {
{{- if .Values.logs.enabled }}
logs = [otelcol.processor.k8sattributes.default.input]
{{- end }}
{{- if .Values.traces.enabled }}
{{- if or .Values.traces.enabled .Values.receivers.processors.otlp_traces_to_logs.enabled }}
traces = [otelcol.processor.k8sattributes.default.input]
{{- end }}
}
Expand Down Expand Up @@ -86,7 +86,7 @@ otelcol.processor.k8sattributes "default" {
{{- if .Values.logs.enabled }}
logs = [otelcol.processor.attributes.default.input]
{{- end }}
{{- if .Values.traces.enabled }}
{{- if or .Values.traces.enabled .Values.receivers.processors.otlp_traces_to_logs.enabled }}
traces = [otelcol.processor.attributes.default.input]
{{- end }}
}
Expand Down Expand Up @@ -155,10 +155,10 @@ otelcol.processor.attributes "default" {
{{- if .Values.logs.enabled }}
logs = [otelcol.processor.transform.default.input]
{{- end }}
{{- if .Values.traces.enabled }}
{{- if or .Values.traces.enabled .Values.receivers.processors.otlp_traces_to_logs.enabled }}
traces = [
otelcol.processor.transform.default.input,
{{- if and .Values.metrics.enabled .Values.receivers.grafanaCloudMetrics.enabled }}
{{- if and .Values.metrics.enabled .Values.traces.enabled .Values.receivers.grafanaCloudMetrics.enabled }}
otelcol.connector.host_info.default.input,
{{- end }}
]
Expand Down Expand Up @@ -257,7 +257,7 @@ otelcol.processor.transform "default" {
}
{{- end }}
{{- end }}
{{- if .Values.traces.enabled }}
{{- if or .Values.traces.enabled .Values.receivers.processors.otlp_traces_to_logs.enabled }}
trace_statements {
context = "resource"
statements = [
Expand Down Expand Up @@ -298,7 +298,7 @@ otelcol.processor.transform "default" {
{{- if .Values.logs.enabled }}
logs = [otelcol.processor.filter.default.input]
{{- end }}
{{- if .Values.traces.enabled }}
{{- if or .Values.traces.enabled .Values.receivers.processors.otlp_traces_to_logs.enabled }}
traces = [otelcol.processor.filter.default.input]
{{- end }}
}
Expand Down Expand Up @@ -334,7 +334,7 @@ otelcol.processor.filter "default" {
]
}
{{- end }}
{{- if and .Values.traces.enabled (or .Values.traces.receiver.filters.span .Values.traces.receiver.filters.spanevent) }}
{{- if and (or .Values.traces.enabled .Values.receivers.processors.otlp_traces_to_logs.enabled) (or .Values.traces.receiver.filters.span .Values.traces.receiver.filters.spanevent) }}
traces {
{{- if .Values.traces.receiver.filters.span }}
span = [
Expand All @@ -360,12 +360,28 @@ otelcol.processor.filter "default" {
{{- if .Values.logs.enabled }}
logs = [otelcol.processor.batch.batch_processor.input]
{{- end }}
{{- if .Values.traces.enabled }}

{{- if and .Values.traces.enabled .Values.receivers.processors.otlp_traces_to_logs.enabled }}
traces = [otelcol.connector.spanlogs.default.input, otelcol.processor.batch.batch_processor.input]
{{- else if .Values.receivers.processors.otlp_traces_to_logs.enabled }}
traces = [otelcol.connector.spanlogs.default.input]
{{- else if .Values.traces.enabled }}
traces = [otelcol.processor.batch.batch_processor.input]
{{- end }}
}
}

{{- if .Values.receivers.processors.otlp_traces_to_logs.enabled }}
otelcol.connector.spanlogs "default" {
roots = true
spans = true
processes = true
output {
logs = [otelcol.processor.batch.batch_processor.input]
}
}
{{- end }}

otelcol.processor.batch "batch_processor" {
{{- with .Values.receivers.processors.batch }}
send_batch_size = {{ .size | int }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ otelcol.receiver.otlp "receiver" {
{{- if .Values.logs.enabled }}
logs = [otelcol.processor.resourcedetection.default.input]
{{- end }}
{{- if .Values.traces.enabled }}
{{- if or .Values.traces.enabled .Values.receivers.processors.otlp_traces_to_logs.enabled }}
traces = [otelcol.processor.resourcedetection.default.input]
{{- end }}
}
Expand Down
5 changes: 5 additions & 0 deletions charts/k8s-monitoring-v1/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,11 @@ receivers:
- os
resourceAttributes: {}

# Use a spanlog to convert OTLP traces to logs
otlp_traces_to_logs:
enabled: false


grafanaCloudMetrics:
# -- Generate host info metrics from telemetry data, used in Application Observability in Grafana Cloud.
# @section -- OTEL Receivers (Processors)
Expand Down