Skip to content

Commit 861fac3

Browse files
authored
Add process name to OTel (#4192)
* Add process name to OTel Issue: [PGO-2426]
1 parent d6800dd commit 861fac3

File tree

10 files changed

+42
-0
lines changed

10 files changed

+42
-0
lines changed

internal/collector/patroni.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func EnablePatroniLogging(ctx context.Context,
6565
{"action": "insert", "key": "k8s.container.name", "value": naming.ContainerDatabase},
6666
{"action": "insert", "key": "k8s.namespace.name", "value": "${env:K8S_POD_NAMESPACE}"},
6767
{"action": "insert", "key": "k8s.pod.name", "value": "${env:K8S_POD_NAME}"},
68+
{"action": "insert", "key": "process.executable.name", "value": "patroni"},
6869
},
6970
}
7071

internal/collector/patroni_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ processors:
6363
- action: insert
6464
key: k8s.pod.name
6565
value: ${env:K8S_POD_NAME}
66+
- action: insert
67+
key: process.executable.name
68+
value: patroni
6669
resourcedetection:
6770
detectors: []
6871
override: false
@@ -163,6 +166,9 @@ processors:
163166
- action: insert
164167
key: k8s.pod.name
165168
value: ${env:K8S_POD_NAME}
169+
- action: insert
170+
key: process.executable.name
171+
value: patroni
166172
resourcedetection:
167173
detectors: []
168174
override: false

internal/collector/pgadmin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func EnablePgAdminLogging(ctx context.Context, spec *v1beta1.InstrumentationSpec
5454
{"action": "insert", "key": "k8s.container.name", "value": naming.ContainerPGAdmin},
5555
{"action": "insert", "key": "k8s.namespace.name", "value": "${env:K8S_POD_NAMESPACE}"},
5656
{"action": "insert", "key": "k8s.pod.name", "value": "${env:K8S_POD_NAME}"},
57+
{"action": "insert", "key": "process.executable.name", "value": "pgadmin"},
5758
},
5859
}
5960

internal/collector/pgadmin_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ collector.yaml: |
6767
- action: insert
6868
key: k8s.pod.name
6969
value: ${env:K8S_POD_NAME}
70+
- action: insert
71+
key: process.executable.name
72+
value: pgadmin
7073
resourcedetection:
7174
detectors: []
7275
override: false
@@ -192,6 +195,9 @@ collector.yaml: |
192195
- action: insert
193196
key: k8s.pod.name
194197
value: ${env:K8S_POD_NAME}
198+
- action: insert
199+
key: process.executable.name
200+
value: pgadmin
195201
resourcedetection:
196202
detectors: []
197203
override: false

internal/collector/pgbackrest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func NewConfigForPgBackrestRepoHostPod(
8787
{"action": "insert", "key": "k8s.container.name", "value": naming.PGBackRestRepoContainerName},
8888
{"action": "insert", "key": "k8s.namespace.name", "value": "${env:K8S_POD_NAMESPACE}"},
8989
{"action": "insert", "key": "k8s.pod.name", "value": "${env:K8S_POD_NAME}"},
90+
{"action": "insert", "key": "process.executable.name", "value": "pgbackrest"},
9091
},
9192
}
9293

internal/collector/pgbackrest_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ processors:
6565
- action: insert
6666
key: k8s.pod.name
6767
value: ${env:K8S_POD_NAME}
68+
- action: insert
69+
key: process.executable.name
70+
value: pgbackrest
6871
resourcedetection:
6972
detectors: []
7073
override: false
@@ -172,6 +175,9 @@ processors:
172175
- action: insert
173176
key: k8s.pod.name
174177
value: ${env:K8S_POD_NAME}
178+
- action: insert
179+
key: process.executable.name
180+
value: pgbackrest
175181
resourcedetection:
176182
detectors: []
177183
override: false

internal/collector/pgbouncer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func EnablePgBouncerLogging(ctx context.Context,
9090
{"action": "insert", "key": "k8s.container.name", "value": naming.ContainerPGBouncer},
9191
{"action": "insert", "key": "k8s.namespace.name", "value": "${env:K8S_POD_NAMESPACE}"},
9292
{"action": "insert", "key": "k8s.pod.name", "value": "${env:K8S_POD_NAME}"},
93+
{"action": "insert", "key": "process.executable.name", "value": "pgbouncer"},
9394
},
9495
}
9596

internal/collector/pgbouncer_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ processors:
6262
- action: insert
6363
key: k8s.pod.name
6464
value: ${env:K8S_POD_NAME}
65+
- action: insert
66+
key: process.executable.name
67+
value: pgbouncer
6568
resourcedetection:
6669
detectors: []
6770
override: false
@@ -162,6 +165,9 @@ processors:
162165
- action: insert
163166
key: k8s.pod.name
164167
value: ${env:K8S_POD_NAME}
168+
- action: insert
169+
key: process.executable.name
170+
value: pgbouncer
165171
resourcedetection:
166172
detectors: []
167173
override: false

internal/collector/postgres.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ func EnablePostgresLogging(
197197
{"action": "insert", "key": "k8s.container.name", "value": naming.ContainerDatabase},
198198
{"action": "insert", "key": "k8s.namespace.name", "value": "${env:K8S_POD_NAMESPACE}"},
199199
{"action": "insert", "key": "k8s.pod.name", "value": "${env:K8S_POD_NAME}"},
200+
{"action": "insert", "key": "process.executable.name", "value": "postgres"},
200201

201202
// https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/database#readme
202203
{"action": "insert", "key": "db.system", "value": "postgresql"},
@@ -276,6 +277,7 @@ func EnablePostgresLogging(
276277
{"action": "insert", "key": "k8s.container.name", "value": naming.ContainerDatabase},
277278
{"action": "insert", "key": "k8s.namespace.name", "value": "${env:K8S_POD_NAMESPACE}"},
278279
{"action": "insert", "key": "k8s.pod.name", "value": "${env:K8S_POD_NAME}"},
280+
{"action": "insert", "key": "process.executable.name", "value": "pgbackrest"},
279281
},
280282
}
281283

internal/collector/postgres_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ processors:
7171
- action: insert
7272
key: k8s.pod.name
7373
value: ${env:K8S_POD_NAME}
74+
- action: insert
75+
key: process.executable.name
76+
value: pgbackrest
7477
resource/postgres:
7578
attributes:
7679
- action: insert
@@ -82,6 +85,9 @@ processors:
8285
- action: insert
8386
key: k8s.pod.name
8487
value: ${env:K8S_POD_NAME}
88+
- action: insert
89+
key: process.executable.name
90+
value: postgres
8591
- action: insert
8692
key: db.system
8793
value: postgresql
@@ -331,6 +337,9 @@ processors:
331337
- action: insert
332338
key: k8s.pod.name
333339
value: ${env:K8S_POD_NAME}
340+
- action: insert
341+
key: process.executable.name
342+
value: pgbackrest
334343
resource/postgres:
335344
attributes:
336345
- action: insert
@@ -342,6 +351,9 @@ processors:
342351
- action: insert
343352
key: k8s.pod.name
344353
value: ${env:K8S_POD_NAME}
354+
- action: insert
355+
key: process.executable.name
356+
value: postgres
345357
- action: insert
346358
key: db.system
347359
value: postgresql

0 commit comments

Comments
 (0)