From 1c2d05c7ee9256fdee5a0e2d75559ad408d96a31 Mon Sep 17 00:00:00 2001 From: "Mateusz \"mat\" Rumian" <58699800+mat-rumian@users.noreply.github.com> Date: Fri, 26 Apr 2024 12:27:20 +0200 Subject: [PATCH] chore: add instrumentation examples (#3680) --- .../custom-values-cascading-filter.yaml | 71 ++++++++++++++++ ...le-cascading-filter-sampler-instances.yaml | 81 +++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 examples/instrumentation/custom-values-cascading-filter.yaml create mode 100644 examples/instrumentation/multiple-cascading-filter-sampler-instances.yaml diff --git a/examples/instrumentation/custom-values-cascading-filter.yaml b/examples/instrumentation/custom-values-cascading-filter.yaml new file mode 100644 index 0000000000..3c96b43a96 --- /dev/null +++ b/examples/instrumentation/custom-values-cascading-filter.yaml @@ -0,0 +1,71 @@ +sumologic: + accessId: + accessKey: + clusterName: + traces: + enabled: true +## Following configures OpenTelemetry Collector (traces-sampler) +tracesSampler: + config: + processors: + ## Following enables a smart cascading filtering rules with preset limits. + ## https://github.com/SumoLogic/sumologic-otel-collector/tree/main/pkg/processor/cascadingfilterprocessor + cascading_filter: + ## (default = 30s): Wait time since the first span of a trace before making + ## a filtering decision + decision_wait: 30s + ## (default = 100000): Number of traces kept in memory + num_traces: 200000 + ## (default = 0): Expected number of new traces (helps in allocating data structures) + expected_new_traces_per_sec: 100 + ## (default = 0): defines maximum number of spans per second + spans_per_second: 1600 + ## Number of spans that are always probabilistically filtered + ## (hence might be used for metrics calculation). + probabilistic_filtering_rate: 100 + ## Rules that will reject all traces matching them + trace_reject_filters: + # Adjust or remove the example as needed + - name: remove-all-traces-with-health-span + name_pattern: "health.*" + # Adjust or remove the example as needed + - name: remove-all-traces-with-healthcheck-service + attributes: + - key: service.name + values: + - "healthcheck/.*" + use_regex: true + ## Rules that will accept traces with this criteria, but only to a given volume + trace_accept_filters: + # Adjust or remove the example as needed + - name: sampling-priority, + attributes: + - key: sampling.priority + values: + - "1" + spans_per_second: 400 # <- adjust the output traffic level + # Adjust or remove the example as needed + - name: traces-with-errors + properties: + min_number_of_errors: 1 + spans_per_second: 400 # <- adjust the output traffic level + # Adjust or remove the example as needed + - name: traces-with-and-high-latency + properties: + min_duration: 10s + spans_per_second: 800 # <- adjust the output traffic level + # Adjust or remove the example as needed + # - name: some-service-traces-with-some-attribute + # attributes: + # - key: service.name + # values: + # - some-service + # - key: important-key + # values: + # - value1 + # - value2 + # use_regex: true + # spans_per_second: 300 # <- adjust the output traffic level + # Adjust or remove the example as needed + - name: everything_else + spans_per_second: -1 # If there's anything left in the budget, it will randomly select remaining traces diff --git a/examples/instrumentation/multiple-cascading-filter-sampler-instances.yaml b/examples/instrumentation/multiple-cascading-filter-sampler-instances.yaml new file mode 100644 index 0000000000..aefefaf7dd --- /dev/null +++ b/examples/instrumentation/multiple-cascading-filter-sampler-instances.yaml @@ -0,0 +1,81 @@ +sumologic: + accessId: + accessKey: + clusterName: + traces: + enabled: true +## Following configures OpenTelemetry Collector (traces-sampler) +tracesSampler: + ## In case of multiple pods sharing single configuration map of the cascadingfilter, + ## environment variable called SUMO_COLLECTOR_INSTANCES should be used to scale down properly + ## spans_per_second global and policy limits. SUMO_COLLECTOR_INSTANCES should be positive integer + ## corresponding to the number of collectors with configured cascadingfilters e.g. SUMO_COLLECTOR_INSTANCES=5. + ## As a result configured spans_per_second limit will be divided by 5 for global and policy limits. + deployment: + replicas: 5 # Number of traces-sampler (cascading_filter) pods + extraEnvVars: + - name: SUMO_COLLECTOR_INSTANCES + value: "5" # Number of traces-sampler (cascading_filter) pods + config: + processors: + ## Following enables a smart cascading filtering rules with preset limits. + ## https://github.com/SumoLogic/sumologic-otel-collector/tree/main/pkg/processor/cascadingfilterprocessor + cascading_filter: + ## (default = 30s): Wait time since the first span of a trace before making + ## a filtering decision + decision_wait: 30s + ## (default = 100000): Number of traces kept in memory + num_traces: 200000 + ## (default = 0): Expected number of new traces (helps in allocating data structures) + expected_new_traces_per_sec: 100 + ## (default = 0): defines maximum number of spans per second + spans_per_second: 1600 + ## Number of spans that are always probabilistically filtered + ## (hence might be used for metrics calculation). + probabilistic_filtering_rate: 100 + ## Rules that will reject all traces matching them + trace_reject_filters: + # Adjust or remove the example as needed + - name: remove-all-traces-with-health-span + name_pattern: "health.*" + # Adjust or remove the example as needed + - name: remove-all-traces-with-healthcheck-service + attributes: + - key: service.name + values: + - "healthcheck/.*" + use_regex: true + ## Rules that will accept traces with this criteria, but only to a given volume + trace_accept_filters: + # Adjust or remove the example as needed + - name: sampling-priority, + attributes: + - key: sampling.priority + values: + - "1" + spans_per_second: 400 # <- adjust the output traffic level + # Adjust or remove the example as needed + - name: traces-with-errors + properties: + min_number_of_errors: 1 + spans_per_second: 400 # <- adjust the output traffic level + # Adjust or remove the example as needed + - name: traces-with-and-high-latency + properties: + min_duration: 10s + spans_per_second: 800 # <- adjust the output traffic level + # Adjust or remove the example as needed + # - name: some-service-traces-with-some-attribute + # attributes: + # - key: service.name + # values: + # - some-service + # - key: important-key + # values: + # - value1 + # - value2 + # use_regex: true + # spans_per_second: 300 # <- adjust the output traffic level + # Adjust or remove the example as needed + - name: everything_else + spans_per_second: -1 # If there's anything left in the budget, it will randomly select remaining traces