-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extra OPTEL collector configuration.
Adds additional telemetry configuration fields to allow users to add their custom OpenTelemetry collector configuration together with the Kubewarden configuration. Signed-off-by: José Guilherme Vanz <[email protected]>
- Loading branch information
Showing
4 changed files
with
419 additions
and
0 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
303 changes: 303 additions & 0 deletions
303
charts/kubewarden-controller/tests/optel_collector_test.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,303 @@ | ||
suite: OpenTelemetry Collector tests | ||
templates: | ||
- opentelemetry-collector.yaml | ||
tests: | ||
- it: "should not add extra OPTEL collector configuration when not extra value is defined" | ||
documentSelector: | ||
path: metadata.name | ||
value: kubewarden | ||
set: | ||
telemetry: | ||
metrics: | ||
enabled: true | ||
port: 8080 | ||
tracing: | ||
enabled: true | ||
jaeger: | ||
endpoint: "all-in-one-collector.jaeger.svc.cluster.local:4317" | ||
tls: | ||
insecure: true | ||
asserts: | ||
- equal: | ||
path: spec.mode | ||
value: sidecar | ||
- isNull: | ||
path: spec.presets | ||
- isNull: | ||
path: spec.ports | ||
content: | ||
metrics: | ||
enabled: true | ||
- isNull: | ||
path: spec.envFrom | ||
content: | ||
secretRef: | ||
name: open-telemetry-collector | ||
- equal: | ||
path: spec.config | ||
value: | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: {} | ||
processors: | ||
batch: {} | ||
exporters: | ||
otlp/jaeger: | ||
endpoint: "all-in-one-collector.jaeger.svc.cluster.local:4317" | ||
tls: | ||
insecure: true | ||
prometheus: | ||
endpoint: ":8080" | ||
service: | ||
pipelines: | ||
metrics: | ||
receivers: [otlp] | ||
processors: [] | ||
exporters: [prometheus] | ||
traces: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [otlp/jaeger] | ||
- it: "should add extra OPTEL collector configuration when extra configuration is defined" | ||
documentSelector: | ||
path: metadata.name | ||
value: kubewarden | ||
set: | ||
telemetry: | ||
metrics: | ||
enabled: true | ||
port: 8080 | ||
tracing: | ||
enabled: true | ||
jaeger: | ||
endpoint: "all-in-one-collector.jaeger.svc.cluster.local:4317" | ||
tls: | ||
insecure: true | ||
extraOptelConfig: | ||
ports: | ||
metrics: | ||
enabled: true | ||
presets: | ||
kubernetesAttributes: | ||
enabled: true | ||
extractAllPodLabels: true | ||
envFrom: | ||
- secretRef: | ||
name: open-telemetry-collector | ||
extraConfig: | ||
receivers: | ||
otlp/stackstate: | ||
protocols: | ||
grpc: {} | ||
exporters: | ||
otlp/stackstate: | ||
auth: | ||
authenticator: bearertokenauth | ||
endpoint: "<otlp-stackstate-endpoint>:443" | ||
extensions: | ||
bearertokenauth: | ||
scheme: StackState | ||
token: "${env:API_KEY}" | ||
processors: | ||
tail_sampling: | ||
decision_wait: 10s | ||
policies: | ||
- name: rate-limited-composite | ||
type: composite | ||
composite: | ||
max_total_spans_per_second: 500 | ||
policy_order: [errors, slow-traces, rest] | ||
composite_sub_policy: | ||
- name: errors | ||
type: status_code | ||
status_code: | ||
status_codes: [ ERROR ] | ||
- name: slow-traces | ||
type: latency | ||
latency: | ||
threshold_ms: 1000 | ||
- name: rest | ||
type: always_sample | ||
rate_allocation: | ||
- policy: errors | ||
percent: 33 | ||
- policy: slow-traces | ||
percent: 33 | ||
- policy: rest | ||
percent: 34 | ||
resource: | ||
attributes: | ||
- key: k8s.cluster.name | ||
action: upsert | ||
value: <your-cluster-name> | ||
- key: service.instance.id | ||
from_attribute: k8s.pod.uid | ||
action: insert | ||
filter/dropMissingK8sAttributes: | ||
error_mode: ignore | ||
traces: | ||
span: | ||
- resource.attributes["k8s.node.name"] == nil | ||
- resource.attributes["k8s.pod.uid"] == nil | ||
- resource.attributes["k8s.namespace.name"] == nil | ||
- resource.attributes["k8s.pod.name"] == nil | ||
connectors: | ||
spanmetrics: | ||
metrics_expiration: 5m | ||
namespace: otel_span | ||
routing/traces: | ||
error_mode: ignore | ||
match_once: false | ||
table: | ||
- statement: route() | ||
pipelines: [traces/sampling, traces/spanmetrics] | ||
service: | ||
extensions: | ||
- health_check | ||
- bearertokenauth | ||
pipelines: | ||
ststraces: | ||
receivers: [otlp] | ||
processors: [filter/dropMissingK8sAttributes, memory_limiter, resource] | ||
exporters: [routing/traces] | ||
traces/spanmetrics: | ||
receivers: [routing/traces] | ||
processors: [] | ||
exporters: [spanmetrics] | ||
traces/sampling: | ||
receivers: [routing/traces] | ||
processors: [tail_sampling, batch] | ||
exporters: [debug, otlp/stackstate] | ||
stsmetrics: | ||
receivers: [otlp, spanmetrics, prometheus] | ||
processors: [memory_limiter, resource, batch] | ||
exporters: [debug, otlp/stackstate] | ||
asserts: | ||
- equal: | ||
path: spec.mode | ||
value: sidecar | ||
- isSubset: | ||
path: spec.presets | ||
content: | ||
kubernetesAttributes: | ||
enabled: true | ||
extractAllPodLabels: true | ||
- isSubset: | ||
path: spec.ports | ||
content: | ||
metrics: | ||
enabled: true | ||
- contains: | ||
path: spec.envFrom | ||
content: | ||
secretRef: | ||
name: open-telemetry-collector | ||
- isSubset: | ||
path: spec.config.receivers | ||
content: | ||
otlp/stackstate: | ||
protocols: | ||
grpc: {} | ||
- isSubset: | ||
path: spec.config.connectors | ||
content: | ||
spanmetrics: | ||
metrics_expiration: 5m | ||
namespace: otel_span | ||
routing/traces: | ||
error_mode: ignore | ||
match_once: false | ||
table: | ||
- statement: route() | ||
pipelines: [traces/sampling, traces/spanmetrics] | ||
- equal: | ||
path: spec.config.service.extensions | ||
value: | ||
- health_check | ||
- bearertokenauth | ||
- isSubset: | ||
path: spec.config.service.pipelines | ||
content: | ||
ststraces: | ||
receivers: [otlp] | ||
processors: [filter/dropMissingK8sAttributes, memory_limiter, resource] | ||
exporters: [routing/traces] | ||
traces/spanmetrics: | ||
receivers: [routing/traces] | ||
processors: [] | ||
exporters: [spanmetrics] | ||
traces/sampling: | ||
receivers: [routing/traces] | ||
processors: [tail_sampling, batch] | ||
exporters: [debug, otlp/stackstate] | ||
stsmetrics: | ||
receivers: [otlp, spanmetrics, prometheus] | ||
processors: [memory_limiter, resource, batch] | ||
exporters: [debug, otlp/stackstate] | ||
metrics: | ||
receivers: [otlp] | ||
processors: [] | ||
exporters: [prometheus] | ||
traces: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [otlp/jaeger] | ||
- isSubset: | ||
path: spec.config.exporters | ||
content: | ||
otlp/stackstate: | ||
auth: | ||
authenticator: bearertokenauth | ||
endpoint: "<otlp-stackstate-endpoint>:443" | ||
- isSubset: | ||
path: spec.config.extensions | ||
content: | ||
bearertokenauth: | ||
scheme: StackState | ||
token: "${env:API_KEY}" | ||
- isSubset: | ||
path: spec.config.processors | ||
content: | ||
tail_sampling: | ||
decision_wait: 10s | ||
policies: | ||
- name: rate-limited-composite | ||
type: composite | ||
composite: | ||
max_total_spans_per_second: 500 | ||
policy_order: [errors, slow-traces, rest] | ||
composite_sub_policy: | ||
- name: errors | ||
type: status_code | ||
status_code: | ||
status_codes: [ ERROR ] | ||
- name: slow-traces | ||
type: latency | ||
latency: | ||
threshold_ms: 1000 | ||
- name: rest | ||
type: always_sample | ||
rate_allocation: | ||
- policy: errors | ||
percent: 33 | ||
- policy: slow-traces | ||
percent: 33 | ||
- policy: rest | ||
percent: 34 | ||
resource: | ||
attributes: | ||
- key: k8s.cluster.name | ||
action: upsert | ||
value: <your-cluster-name> | ||
- key: service.instance.id | ||
from_attribute: k8s.pod.uid | ||
action: insert | ||
filter/dropMissingK8sAttributes: | ||
error_mode: ignore | ||
traces: | ||
span: | ||
- resource.attributes["k8s.node.name"] == nil | ||
- resource.attributes["k8s.pod.uid"] == nil | ||
- resource.attributes["k8s.namespace.name"] == nil | ||
- resource.attributes["k8s.pod.name"] == nil |
Oops, something went wrong.