-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to create default Instrumentation for operator based auto…
…-instrumentation
- Loading branch information
Showing
13 changed files
with
324 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
examples/enable-operator-and-auto-instrumentation/instrumentation.yaml
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
...auto-instrumentation/instrumentation/instrumentation_add_custom_environment_span_tag.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/operator/instrumentation.yaml | ||
# Description: Set a custom value (dev) for the deployment.environment tag on exported spans | ||
# Input values.yaml: | ||
# operator: | ||
# enabled: true | ||
# instrumentation: | ||
# spec: | ||
# env: | ||
# - name: OTEL_RESOURCE_ATTRIBUTES | ||
# value: "deployment.environment=dev" | ||
# Output instrumentation.yaml: | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: Instrumentation | ||
metadata: | ||
name: splunk-instrumentation | ||
spec: | ||
dotnet: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 | ||
env: | ||
- name: OTEL_RESOURCE_ATTRIBUTES | ||
value: deployment.environment=dev | ||
exporter: | ||
endpoint: http://$(SPLUNK_OTEL_AGENT):4317 | ||
propagators: | ||
- tracecontext | ||
- baggage | ||
- b3 | ||
python: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 |
40 changes: 40 additions & 0 deletions
40
...-operator-and-auto-instrumentation/instrumentation/instrumentation_add_trace_sampler.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/operator/instrumentation.yaml | ||
# Description: Add a trace sampler to control how many traces are exported | ||
# Input values.yaml: | ||
# operator: | ||
# enabled: true | ||
# instrumentation: | ||
# spec: | ||
# sampler: | ||
# type: traceidratio | ||
# argument: "0.95" | ||
# Output instrumentation.yaml: | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: Instrumentation | ||
metadata: | ||
name: splunk-instrumentation | ||
spec: | ||
dotnet: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 | ||
env: | ||
- name: SPLUNK_OTEL_AGENT | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: status.hostIP | ||
exporter: | ||
endpoint: http://$(SPLUNK_OTEL_AGENT):4317 | ||
propagators: | ||
- tracecontext | ||
- baggage | ||
- b3 | ||
python: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 | ||
sampler: | ||
argument: "0.95" | ||
type: traceidratio |
59 changes: 59 additions & 0 deletions
59
...e-operator-and-auto-instrumentation/instrumentation/instrumentation_enable_profiling.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/operator/instrumentation.yaml | ||
# Description: Enable Java always on profiler | ||
# Documentation: https://docs.splunk.com/Observability/gdi/get-data-in/application/java/configuration/advanced-java-otel-configuration.html#java-settings-for-alwayson-profiling | ||
# Input values.yaml: | ||
# splunkObservability: | ||
# profilingEnabled: true | ||
# operator: | ||
# enabled: true | ||
# instrumentation: | ||
# spec: | ||
# java: | ||
# env: | ||
# - name: SPLUNK_PROFILER_ENABLED | ||
# value: "true" | ||
# - name: SPLUNK_PROFILER_MEMORY_ENABLED | ||
# value: "true" | ||
# Output instrumentation.yaml: | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: Instrumentation | ||
metadata: | ||
name: default-splunk-otel-collector | ||
labels: | ||
app.kubernetes.io/name: splunk-otel-collector | ||
helm.sh/chart: splunk-otel-collector-0.80.0 | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/instance: default | ||
app.kubernetes.io/version: "0.80.0" | ||
app: splunk-otel-collector | ||
component: otel-operator | ||
chart: splunk-otel-collector-0.80.0 | ||
release: default | ||
heritage: Helm | ||
app.kubernetes.io/component: otel-operator | ||
spec: | ||
dotnet: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 | ||
env: | ||
- name: SPLUNK_OTEL_AGENT | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: status.hostIP | ||
- name: SPLUNK_PROFILER_ENABLED | ||
value: "true" | ||
- name: SPLUNK_PROFILER_MEMORY_ENABLED | ||
value: "true" | ||
exporter: | ||
endpoint: http://$(SPLUNK_OTEL_AGENT):4317 | ||
propagators: | ||
- tracecontext | ||
- baggage | ||
- b3 | ||
python: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 |
39 changes: 39 additions & 0 deletions
39
...enable-operator-and-auto-instrumentation/rendered_manifests/operator/instrumentation.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/operator/instrumentation.yaml | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: Instrumentation | ||
metadata: | ||
name: default-splunk-otel-collector | ||
labels: | ||
app.kubernetes.io/name: splunk-otel-collector | ||
helm.sh/chart: splunk-otel-collector-0.80.0 | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/instance: default | ||
app.kubernetes.io/version: "0.80.0" | ||
app: splunk-otel-collector | ||
component: otel-operator | ||
chart: splunk-otel-collector-0.80.0 | ||
release: default | ||
heritage: Helm | ||
app.kubernetes.io/component: otel-operator | ||
spec: | ||
dotnet: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 | ||
env: | ||
- name: SPLUNK_OTEL_AGENT | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: status.hostIP | ||
exporter: | ||
endpoint: http://$(SPLUNK_OTEL_AGENT):4317 | ||
propagators: | ||
- tracecontext | ||
- baggage | ||
- b3 | ||
python: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 |
32 changes: 32 additions & 0 deletions
32
helm-charts/splunk-otel-collector/templates/operator/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{- define "validation-rules" -}} | ||
{{- $tracesEnabled := or (include "splunk-otel-collector.platformTracesEnabled" .) (include "splunk-otel-collector.o11yTracesEnabled" .) -}} | ||
{{- $endpointOverridden := and .Values.operator.instrumentation.spec .Values.operator.instrumentation.spec.exporter .Values.operator.instrumentation.spec.exporter.endpoint (ne .Values.operator.instrumentation.spec.exporter.endpoint "") -}} | ||
{{- if and .Values.operator.enabled .Values.operator.instrumentation.create $tracesEnabled (not $endpointOverridden) -}} | ||
{{/* If no endpoint override was provided, the environment variable/tag must be set by the agent, gateway, or instrumentation.*/}} | ||
{{- if or (not .Values.environment) (eq .Values.environment "") -}} | ||
{{- $envSet := false -}} | ||
{{- if and .Values.operator.instrumentation.spec .Values.operator.instrumentation.spec.env -}} | ||
{{- range .Values.operator.instrumentation.spec.env -}} | ||
{{- if and (eq .name "OTEL_RESOURCE_ATTRIBUTES") .value -}} | ||
{{- $envSet = true -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- if not $envSet -}} | ||
{{- fail "When operator.enabled=true, operator.instrumentation.create=true, (splunkPlatform.tracesEnabled=true or splunkObservability.tracesEnabled=true), (agent.enabled=true or gateway.enabled=true), and .Values.operator.instrumentation.spec.exporter.endpoint is not set, either environment must be a non-empty string or operator.instrumentation.spec.env must contain an item with {name: OTEL_RESOURCE_ATTRIBUTES, value: non-empty string}" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "splunk-otel-collector.operator.instrumentation.exporter.endpoint" -}} | ||
{{- if and .Values.operator.instrumentation.spec .Values.operator.instrumentation.spec.exporter .Values.operator.instrumentation.spec.exporter.endpoint (ne .Values.operator.instrumentation.spec.exporter.endpoint "") }} | ||
"{{ .Values.operator.instrumentation.spec.exporter.endpoint }}" | ||
{{- else if .Values.agent.enabled }} | ||
"http://$(SPLUNK_OTEL_AGENT):4317" | ||
{{- else if .Values.gateway.enabled }} | ||
"http://{{ include "splunk-otel-collector.fullname" . }}:4317" | ||
{{- else -}} | ||
{{- fail "When operator.enabled=true, operator.instrumentation.create=true, (splunkPlatform.tracesEnabled=true or splunkObservability.tracesEnabled=true), (agent.enabled=true or gateway.enabled=true), and .Values.operator.instrumentation.spec.exporter.endpoint is not set, either environment must be a non-empty string or operator.instrumentation.spec.env must contain an item with {name: OTEL_RESOURCE_ATTRIBUTES, value: non-empty string}" -}} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.