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

Support pushing span/trace through to splunk HEC #629

Merged
merged 19 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 10 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
11 changes: 9 additions & 2 deletions helm-charts/splunk-otel-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ Whether metrics enabled for Splunk Platform.
{{- and (eq (include "splunk-otel-collector.splunkPlatformEnabled" .) "true") .Values.splunkPlatform.metricsEnabled }}
{{- end -}}

{{/*
Whether traces enabled for Splunk Platform.
*/}}
{{- define "splunk-otel-collector.platformTracesEnabled" -}}
{{- and (eq (include "splunk-otel-collector.splunkPlatformEnabled" .) "true") .Values.splunkPlatform.tracesEnabled }}
{{- end -}}

{{/*
Whether metrics enabled for any destination.
*/}}
Expand All @@ -115,10 +122,10 @@ Whether metrics enabled for any destination.
{{- end -}}

{{/*
Whether traces enabled for any destination. (currently applicable to Splunk Observability only).
Whether traces enabled for any destination.
*/}}
{{- define "splunk-otel-collector.tracesEnabled" -}}
{{- include "splunk-otel-collector.o11yTracesEnabled" . }}
{{- or (eq (include "splunk-otel-collector.o11yTracesEnabled" .) "true") (eq (include "splunk-otel-collector.platformTracesEnabled" .) "true") }}
{{- end -}}

{{/*
Expand Down
38 changes: 37 additions & 1 deletion helm-charts/splunk-otel-collector/templates/config/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ splunk_hec/platform_logs:
{{- end }}

{{/*
Splunk Platform Logs exporter
Splunk Platform Metrics exporter
*/}}
{{- define "splunk-otel-collector.splunkPlatformMetricsExporter" -}}
splunk_hec/platform_metrics:
Expand Down Expand Up @@ -246,6 +246,42 @@ splunk_hec/platform_metrics:
queue_size: {{ .Values.splunkPlatform.sendingQueue.queueSize }}
{{- end }}

{{/*
Splunk Platform Traces exporter
*/}}
{{- define "splunk-otel-collector.splunkPlatformTracesExporter" -}}
splunk_hec/platform_traces:
endpoint: {{ .Values.splunkPlatform.endpoint | quote }}
token: "${SPLUNK_PLATFORM_HEC_TOKEN}"
index: {{ .Values.splunkPlatform.tracesIndex | quote }}
source: {{ .Values.splunkPlatform.source | quote }}
max_connections: {{ .Values.splunkPlatform.maxConnections }}
disable_compression: {{ .Values.splunkPlatform.disableCompression }}
timeout: {{ .Values.splunkPlatform.timeout }}
splunk_app_name: {{ .Chart.Name }}
splunk_app_version: {{ .Chart.Version }}
tls:
insecure_skip_verify: {{ .Values.splunkPlatform.insecureSkipVerify }}
{{- if .Values.splunkPlatform.clientCert }}
cert_file: /otel/etc/splunk_platform_hec_client_cert
{{- end }}
{{- if .Values.splunkPlatform.clientKey }}
key_file: /otel/etc/splunk_platform_hec_client_key
{{- end }}
{{- if .Values.splunkPlatform.caFile }}
ca_file: /otel/etc/splunk_platform_hec_ca_file
{{- end }}
retry_on_failure:
enabled: {{ .Values.splunkPlatform.retryOnFailure.enabled }}
initial_interval: {{ .Values.splunkPlatform.retryOnFailure.initialInterval }}
max_interval: {{ .Values.splunkPlatform.retryOnFailure.maxInterval }}
max_elapsed_time: {{ .Values.splunkPlatform.retryOnFailure.maxElapsedTime }}
sending_queue:
enabled: {{ .Values.splunkPlatform.sendingQueue.enabled }}
num_consumers: {{ .Values.splunkPlatform.sendingQueue.numConsumers }}
queue_size: {{ .Values.splunkPlatform.sendingQueue.queueSize }}
{{- end }}

{{/*
Add Extra Labels
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,13 @@ service:
{{- if (eq (include "splunk-otel-collector.tracesEnabled" .) "true") }}
# Default traces pipeline.
traces:
receivers: [otlp, jaeger, smartagent/signalfx-forwarder, zipkin]
receivers:
- otlp
- jaeger
{{- if (eq (include "splunk-otel-collector.o11yTracesEnabled" $) "true") }}
- smartagent/signalfx-forwarder
{{- end }}
- zipkin
processors:
- memory_limiter
- k8sattributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ exporters:
{{- include "splunk-otel-collector.splunkPlatformMetricsExporter" . | nindent 2 }}
{{- end }}

{{- if (eq (include "splunk-otel-collector.platformTracesEnabled" .) "true") }}
{{- include "splunk-otel-collector.splunkPlatformTracesExporter" . | nindent 2 }}
{{- end }}

atoulme marked this conversation as resolved.
Show resolved Hide resolved
service:
telemetry:
metrics:
Expand All @@ -179,7 +183,7 @@ service:
# The default pipelines should not need to be changed. You can add any custom pipeline instead.
# In order to disable a default pipeline just set it to `null` in gateway.config overrides.
pipelines:
{{- if (eq (include "splunk-otel-collector.o11yTracesEnabled" $) "true") }}
{{- if (eq (include "splunk-otel-collector.tracesEnabled" $) "true") }}
# default traces pipeline
traces:
receivers: [otlp, jaeger, zipkin]
Expand All @@ -194,7 +198,13 @@ service:
{{- if .Values.environment }}
- resource/add_environment
{{- end }}
exporters: [sapm]
exporters:
{{- if (eq (include "splunk-otel-collector.o11yTracesEnabled" .) "true") }}
- sapm
{{- end }}
{{- if (eq (include "splunk-otel-collector.platformTracesEnabled" .) "true") }}
- splunk_hec/platform_traces
{{- end }}
atoulme marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}

{{- if (eq (include "splunk-otel-collector.metricsEnabled" .) "true") }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ spec:
{{- end }}
ports:
{{- range $key, $port := $agent.ports }}
{{- if eq true (and (eq (include "splunk-otel-collector.metricsEnabled" $) "true") (has "metrics" $port.enabled_for)) (and (eq (include "splunk-otel-collector.o11yTracesEnabled" $) "true") (has "traces" $port.enabled_for)) (and (eq (include "splunk-otel-collector.logsEnabled" $) "true") (has "logs" $port.enabled_for)) (and (eq (include "splunk-otel-collector.profilingEnabled" $) "true") (has "profiling" $port.enabled_for)) }}
{{- if eq true (and (eq (include "splunk-otel-collector.metricsEnabled" $) "true") (has "metrics" $port.enabled_for)) (and (eq (include "splunk-otel-collector.tracesEnabled" $) "true") (has "traces" $port.enabled_for)) (and (eq (include "splunk-otel-collector.logsEnabled" $) "true") (has "logs" $port.enabled_for)) (and (eq (include "splunk-otel-collector.profilingEnabled" $) "true") (has "profiling" $port.enabled_for)) }}
- name: {{ $key }}
{{- omit $port "enabled_for" | toYaml | trim | nindent 10 }}
{{- end }}
Expand Down
7 changes: 7 additions & 0 deletions helm-charts/splunk-otel-collector/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"metricsIndex": {
"type": "string"
},
"tracesIndex": {
"type": "string"
},
"source": {
"type": "string"
},
Expand Down Expand Up @@ -81,6 +84,10 @@
"description": "Send Metrics to Splunk Platform",
"type": "boolean"
},
"tracesEnabled": {
"description": "Send Traces to Splunk Platform",
"type": "boolean"
},
"fieldNameConvention": {
"type": "object",
"additionalProperties": false,
Expand Down
8 changes: 6 additions & 2 deletions helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ clusterName: ""
# Enterprise.
splunkPlatform:
# Required for Splunk Enterprise/Cloud. URL to a Splunk instance to send data
# to. e.g. "http://X.X.X.X:8088/services/collector". Setting this parameter
# to. e.g. "http://X.X.X.X:8088/services/collector". Setting this parameter
atoulme marked this conversation as resolved.
Show resolved Hide resolved
# enables Splunk Platform as a destination.
endpoint: ""
# Required for Splunk Enterprise/Cloud (if `endpoint` is specified). Splunk
Expand All @@ -35,6 +35,8 @@ splunkPlatform:
index: "main"
# Name of the Splunk metric type index targeted. Required when ingesting metrics to Splunk Platform.
metricsIndex: ""
# Name of the Splunk event type index targeted. Required when ingesting traces to Splunk Platform.
tracesIndex: ""
# Optional. Default value for `source` field.
source: "kubernetes"
# Optional. Default value for `sourcetype` field. For container logs, it will
Expand Down Expand Up @@ -67,7 +69,9 @@ splunkPlatform:
logsEnabled: true
# If you enable metrics collection, make sure that `metricsIndex` is provided as well.
metricsEnabled: false

# If you enable traces collection, make sure that `tracesIndex` is provided as well.
tracesEnabled: false

atoulme marked this conversation as resolved.
Show resolved Hide resolved
# Field name conventions to use. (Only for those who are migrating from Splunk Connect for Kubernetes helm chart)
fieldNameConvention:
# Boolean for renaming pod metadata fields to match to Splunk Connect for Kubernetes helm chart.
Expand Down