@@ -40,6 +40,20 @@ func EnablePatroniLogging(ctx context.Context,
4040 },
4141 }
4242
43+ // https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/processor/resourceprocessor#readme
44+ outConfig .Processors ["resource/patroni" ] = map [string ]any {
45+ "attributes" : []map [string ]any {
46+ // Container and Namespace names need no escaping because they are DNS labels.
47+ // Pod names need no escaping because they are DNS subdomains.
48+ //
49+ // https://kubernetes.io/docs/concepts/overview/working-with-objects/names
50+ // https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/resource/k8s.md
51+ {"action" : "insert" , "key" : "k8s.container.name" , "value" : naming .ContainerDatabase },
52+ {"action" : "insert" , "key" : "k8s.namespace.name" , "value" : "${env:K8S_POD_NAMESPACE}" },
53+ {"action" : "insert" , "key" : "k8s.pod.name" , "value" : "${env:K8S_POD_NAME}" },
54+ },
55+ }
56+
4357 // https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/processor/transformprocessor#readme
4458 outConfig .Processors ["transform/patroni_logs" ] = map [string ]any {
4559 "log_statements" : []map [string ]any {{
@@ -90,8 +104,10 @@ func EnablePatroniLogging(ctx context.Context,
90104 Extensions : []ComponentID {"file_storage/patroni_logs" },
91105 Receivers : []ComponentID {"filelog/patroni_jsonlog" },
92106 Processors : []ComponentID {
107+ "resource/patroni" ,
93108 "transform/patroni_logs" ,
94109 SubSecondBatchProcessor ,
110+ CompactingProcessor ,
95111 },
96112 Exporters : []ComponentID {DebugExporter },
97113 }
0 commit comments