Skip to content

Commit

Permalink
feat(sumologic-mock): add full support to instrumentation (#3544)
Browse files Browse the repository at this point in the history
* feat(sumologic-mock): add full support for instrumentation

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>

* chore: changelog

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>

* chore: add missing value to README.md

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>

* Update .changelog/3544.changed.txt

* Apply suggestions from code review

---------

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>
  • Loading branch information
sumo-drosiek committed Feb 14, 2024
1 parent 8ea6b68 commit a5a6525
Show file tree
Hide file tree
Showing 16 changed files with 612 additions and 5 deletions.
1 change: 1 addition & 0 deletions .changelog/3544.changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat(sumologic-mock): add full support to instrumentation
1 change: 1 addition & 0 deletions deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `debug.instrumentation.otelcolInstrumentation.stopLogsIngestion` | Set to `true` to prevent sending otelcol-instrumentation collector logs to Sumo Logic. It prevents increasing ingestion and costs in case of huge amount of otelcol-instrumentation logs. | `false` |
| `debug.instrumentation.tracesGateway.print` | Set to `true` to print logs processed by otelcol-instrumentation on standard output. | `false` |
| `debug.instrumentation.tracesGateway.stopLogsIngestion` | Set to `true` to prevent sending traces-gateway logs to Sumo Logic. It prevents increasing ingestion and costs in case of huge amount of traces-gateway logs. | `false` |
| `debug.instrumentation.tracesSampler.forwardToSumologicMock` | Set to `true` to forward spans processed by traces-sampler also to Sumo Logic Mock. | `false` |
| `debug.instrumentation.tracesSampler.print` | Set to `true` to print logs processed by traces-gateway on standard output. | `false` |
| `debug.instrumentation.tracesSampler.stopLogsIngestion` | Set to `true` to prevent sending log collector logs to Sumo Logic. It prevents increasing ingestion and costs in case of huge amount of traces-sampler logs. | `false` |
| `debug.logs.collector.print` | Set to `true` to print logs processed by log collector on standard output. | `false` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,23 @@ service:
traces:
receivers: [jaeger, opencensus, otlp, otlp/deprecated, zipkin]
processors: [memory_limiter, k8s_tagger, source, resource, batch]
exporters:
{{- if eq .Values.tracesGateway.enabled true }}
exporters: [otlphttp/traces]
- otlphttp/traces
{{- else }}
exporters: [loadbalancing]
- loadbalancing
{{- end}}
{{- if eq .Values.debug.instrumentation.otelcolInstrumentation.print true }}
- debug
{{- end }}
metrics:
receivers: [otlp, otlp/deprecated]
processors: [memory_limiter, k8s_tagger, source, resource, batch]
exporters: [sumologic/metrics]
exporters:
- sumologic/metrics
{{- if eq .Values.debug.instrumentation.otelcolInstrumentation.print true }}
- debug
{{- end }}
telemetry:
logs:
level: {{ .Values.otelcolInstrumentation.logLevel }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ service:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [loadbalancing]
exporters:
- loadbalancing
{{- if eq .Values.debug.instrumentation.tracesGateway.print true }}
- debug
{{- end }}
telemetry:
logs:
level: {{ .Values.tracesGateway.logLevel }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ exporters:
debug:
verbosity: detailed
{{- end }}

{{- if eq (include "sumologic-mock.forward-instrumentation" .) "true" }}
otlphttp/sumologic-mock:
{{- if eq .Values.sumologic.traces.sourceType "http" }}
traces_endpoint: {{ include "sumologic-mock.receiver-endpoint" . }}
{{- else }}
endpoint: {{ include "sumologic-mock.receiver-endpoint" . }}
{{- end }}
compression: gzip
{{- end }}

## Following generates verbose logs with span content, useful to verify what
## metadata is being tagged. To enable, uncomment and add "logging" to exporters below.
## There are two levels that could be used: `debug` and `info` with the former
Expand Down Expand Up @@ -69,7 +80,14 @@ service:
traces:
receivers: [otlp]
processors: [memory_limiter, cascading_filter, batch]
exporters: [otlphttp]
exporters:
- otlphttp
{{- if eq (include "sumologic-mock.forward-instrumentation" .) "true" }}
- otlphttp/sumologic-mock
{{- end }}
{{- if eq .Values.debug.instrumentation.tracesSampler.print true }}
- debug
{{- end }}
telemetry:
logs:
level: {{ .Values.tracesSampler.logLevel }}
Expand Down
6 changes: 6 additions & 0 deletions deploy/helm/sumologic/templates/_helpers/_sumologic_mock.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ true
{{- end -}}
{{- end -}}

{{- define "sumologic-mock.forward-instrumentation"}}
{{- if and (eq .Values.debug.sumologicMock.enabled true) (eq .Values.debug.instrumentation.tracesSampler.forwardToSumologicMock true) -}}
true
{{- end -}}
{{- end -}}

{{- define "sumologic-mock.hostname" -}}
{{ template "sumologic.sumologic-mock.name.service" . }}.{{ template "sumologic.namespace" . }}
{{- end -}}
Expand Down
1 change: 1 addition & 0 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2389,6 +2389,7 @@ debug:
tracesSampler:
print: false
stopLogsIngestion: false
forwardToSumologicMock: false

events:
print: false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
otelcolInstrumentation:
sourceMetadata:
excludeNamespaceRegex: "kube\\s+"
excludePodRegex: "^foo.*"
excludeContainerRegex: "[123+]bar$|xyz"
excludeHostRegex: hhh123

tracesGateway:
enabled: false

debug:
instrumentation:
otelcolInstrumentation:
print: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
---
# Source: sumologic/templates/instrumentation/otelcol-instrumentation/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: RELEASE-NAME-sumologic-otelcol-instrumentation
namespace: sumologic
labels:
app: RELEASE-NAME-sumologic-otelcol-instrumentation
chart: "sumologic-%CURRENT_CHART_VERSION%"
release: "RELEASE-NAME"
heritage: "Helm"
data:
otelcol.instrumentation.conf.yaml: |
exporters:
debug:
verbosity: detailed
loadbalancing:
protocol:
otlp:
sending_queue:
enabled: true
num_consumers: 10
queue_size: 10000
timeout: 10s
tls:
insecure: true
resolver:
dns:
hostname: RELEASE-NAME-sumologic-traces-sampler-headless.sumologic
port: 4317
sumologic/metrics:
client: k8s_%CURRENT_CHART_VERSION%
compress_encoding: gzip
endpoint: ${SUMO_ENDPOINT_DEFAULT_METRICS_SOURCE}
log_format: text
max_request_body_size: 1048576
metric_format: prometheus
retry_on_failure:
enabled: true
initial_interval: 5s
max_elapsed_time: 120s
max_interval: 30s
sending_queue:
enabled: false
num_consumers: 10
queue_size: 5000
timeout: 5s
extensions:
health_check: {}
memory_ballast:
size_mib: 512
pprof: {}
processors:
batch:
send_batch_max_size: 512
send_batch_size: 256
timeout: 5s
k8s_tagger:
extract:
annotations:
- key: '*'
tag_name: k8s.pod.annotation.%s
labels:
- key: '*'
tag_name: k8s.pod.label.%s
metadata:
- containerId
- containerName
- daemonSetName
- deploymentName
- hostName
- namespace
- nodeName
- podId
- podName
- replicaSetName
- serviceName
- statefulSetName
namespace_labels:
- key: '*'
tag_name: k8s.namespace.label.%s
owner_lookup_enabled: true
passthrough: false
memory_limiter:
check_interval: 5s
limit_percentage: 75
spike_limit_percentage: 20
resource:
attributes:
- action: upsert
key: k8s.cluster.name
value: kubernetes
resourcedetection:
detectors:
- system
override: false
timeout: 10s
source:
annotation_prefix: k8s.pod.annotation.
collector: kubernetes
exclude:
k8s.container.name: '[123+]bar$|xyz'
k8s.host.name: hhh123
k8s.namespace.name: kube\s+
k8s.pod.name: ^foo.*
pod_key: k8s.pod.name
pod_name_key: k8s.pod.pod_name
pod_template_hash_key: k8s.pod.label.pod-template-hash
source_category: '%{k8s.namespace.name}/%{k8s.pod.pod_name}'
source_category_prefix: kubernetes/
source_category_replace_dash: /
source_host: '%{k8s.pod.hostname}'
source_name: '%{k8s.namespace.name}.%{k8s.pod.pod_name}.%{k8s.container.name}'
receivers:
jaeger:
protocols:
grpc:
endpoint: 0.0.0.0:14250
thrift_binary:
endpoint: 0.0.0.0:6832
thrift_compact:
endpoint: 0.0.0.0:6831
thrift_http:
endpoint: 0.0.0.0:14268
opencensus:
endpoint: 0.0.0.0:55678
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
otlp/deprecated:
protocols:
http:
endpoint: 0.0.0.0:55681
zipkin:
endpoint: 0.0.0.0:9411
service:
extensions:
- health_check
- memory_ballast
- pprof
pipelines:
metrics:
exporters:
- sumologic/metrics
- debug
processors:
- memory_limiter
- k8s_tagger
- source
- resource
- batch
receivers:
- otlp
- otlp/deprecated
traces:
exporters:
- loadbalancing
- debug
processors:
- memory_limiter
- k8s_tagger
- source
- resource
- batch
receivers:
- jaeger
- opencensus
- otlp
- otlp/deprecated
- zipkin
telemetry:
logs:
level: info
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
otelcolInstrumentation:
sourceMetadata:
excludeNamespaceRegex: "kube\\s+"
excludePodRegex: "^foo.*"
excludeContainerRegex: "[123+]bar$|xyz"
excludeHostRegex: hhh123

tracesGateway:
enabled: false

debug:
instrumentation:
otelcolInstrumentation:
print: true

0 comments on commit a5a6525

Please sign in to comment.