Skip to content

Commit

Permalink
Revert removal of traces config (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Rosiek committed Aug 31, 2020
1 parent a941fa0 commit d901383
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
53 changes: 53 additions & 0 deletions deploy/helm/sumologic/conf/traces/traces.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<source>
@type zipkin
@label @TRACING
port 9411
</source>
<label @TRACING>
{{- if .Values.fluentd.monitoring.input }}
{{ include "fluentd.prometheus-metrics.input" (dict "Tag" "tracing.**") | nindent 4}}
{{- end }}
<filter tracing.**>
@type kubernetes_sumologic
tracing_format true
tracing_namespace {{ include "utils.get_default" (dict "Values" .Values "Keys" (list "otelcol" "config" "processors" "k8s_tagger" "extract" "tags" "namespace") "Default" "namespace") | quote }}
tracing_pod {{ include "utils.get_default" (dict "Values" .Values "Keys" (list "otelcol" "config" "processors" "k8s_tagger" "extract" "tags" "podName") "Default" "pod") | quote }}
tracing_pod_id {{ include "utils.get_default" (dict "Values" .Values "Keys" (list "otelcol" "config" "processors" "k8s_tagger" "extract" "tags" "podId") "Default" "pod_id") | quote }}
tracing_container_name {{ include "utils.get_default" (dict "Values" .Values "Keys" (list "otelcol" "config" "processors" "k8s_tagger" "extract" "tags" "containerName") "Default" "container_name") | quote }}
tracing_host {{ include "utils.get_default" (dict "Values" .Values "Keys" (list "otelcol" "config" "processors" "k8s_tagger" "extract" "tags" "hostName") "Default" "hostname") | quote }}
tracing_label_prefix 'pod_label_'
tracing_annotation_prefix 'pod_annotation_'
source_host_key_name '_sourceHost'
source_category_key_name '_sourceCategory'
source_name_key_name '_sourceName'
collector_key_name '_collector'
collector_value "{{- if .Values.sumologic.collectorName }}{{ .Values.sumologic.collectorName }}{{- else}}{{ .Values.sumologic.clusterName }}{{- end}}"
</filter>
{{- if .Values.sumologic.traces.fluentd_stdout }}
<filter tracing.**>
@type stdout
</filter>
{{- end }}
<match tracing.**>
@type copy
<store>
@type zipkin
endpoint "#{ENV['SUMO_ENDPOINT_DEFAULT_TRACES_SOURCE']}"
content_type application/json
open_timeout 1
spans_per_request {{ .Values.sumologic.traces.spans_per_request }}
<buffer>
{{- if or .Values.fluentd.persistence.enabled (eq .Values.fluentd.buffer.type "file") }}
@type file
path {{ .Values.fluentd.buffer.filePaths.traces }}
{{- else }}
@type memory
{{- end }}
@include buffer.output.conf
</buffer>
</store>
{{- if .Values.fluentd.monitoring.output }}
{{ include "fluentd.prometheus-metrics.output" . | nindent 6 }}
{{- end }}
</match>
</label>
27 changes: 27 additions & 0 deletions deploy/helm/sumologic/conf/traces/traces.otelcol.conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- $yamlFile := toYaml $.Values.otelcol.config }}
{{- $_collector := .Values.sumologic.collectorName | default .Values.sumologic.clusterName | quote }}
{{- $sourceName := .Values.sumologic.sourceName | quote }}
{{- $sourceCategory := .Values.sumologic.sourceCategory | quote }}
{{- $sourceCategoryPrefix := .Values.sumologic.sourceCategoryPrefix | quote }}
{{- $sourceCategoryReplaceDash := .Values.sumologic.sourceCategoryReplaceDash | quote }}
{{- $excludeNamespaceRegex := .Values.fluentd.logs.containers.excludeNamespaceRegex | quote }}
{{ if eq .Values.sumologic.collectionMonitoring false }}
{{- $excludeNamespaceRegex = printf "%s|%s" .Release.Namespace .Values.fluentd.logs.containers.excludeNamespaceRegex | quote }}
{{- end }}
{{- $excludePodRegex := .Values.fluentd.logs.containers.excludePodRegex | quote }}
{{- $excludeContainerRegex := .Values.fluentd.logs.containers.excludeContainerRegex | quote }}
{{- $excludeHostRegex := .Values.fluentd.logs.containers.excludeHostRegex | quote }}
{{- $clusterName := include "sumologic.clusterNameReplaceSpaceWithDash" . }}

{{- $yamlFile := replace "processors.source.collector.replace" $_collector $yamlFile }}
{{- $yamlFile := replace "processors.source.name.replace" $sourceName $yamlFile }}
{{- $yamlFile := replace "processors.source.category.replace" $sourceCategory $yamlFile }}
{{- $yamlFile := replace "processors.source.category_prefix.replace" $sourceCategoryPrefix $yamlFile }}
{{- $yamlFile := replace "processors.source.category_replace_dash.replace" $sourceCategoryReplaceDash $yamlFile }}
{{- $yamlFile := replace "processors.source.exclude_namespace_regex.replace" $excludeNamespaceRegex $yamlFile }}
{{- $yamlFile := replace "processors.source.exclude_pod_regex.replace" $excludePodRegex $yamlFile }}
{{- $yamlFile := replace "processors.source.exclude_container_regex.replace" $excludeContainerRegex $yamlFile }}
{{- $yamlFile := replace "processors.source.exclude_host_regex.replace" $excludeHostRegex $yamlFile }}
{{- $yamlFile := replace "processors.resource.cluster.replace" $clusterName $yamlFile }}

{{- $yamlFile | nindent 2 }}

0 comments on commit d901383

Please sign in to comment.