Commit d638a79
committed
[exporter/awscloudwatchlogsexporter] resolve {PodName} placeholder via k8s.pod.name attribute
Motivation:
Issue #46202 reports that the `{PodName}` placeholder in
`log_group_name`/`log_stream_name` does not resolve for standard EKS
pipelines. The root cause, identified in the issue thread, is that
`patternKeyToAttributeMap` only mapped `PodName` to the legacy attribute
name `pod`. The `k8sattributesprocessor` sets the semantic-convention
attribute `k8s.pod.name` (confirmed in
processor/k8sattributesprocessor/metadata.yaml, enabled by default), not
`pod`, so `{PodName}` silently resolved to `undefined` for the common
case of a k8sattributesprocessor + awscloudwatchlogsexporter pipeline,
unless users added an extra processor to rename the attribute.
Approach:
Change `patternKeyToAttributeMap` from `map[string]string` to
`map[string][]string` so each placeholder can list multiple candidate
resource attribute names, checked in order. `PodName` now checks `pod`
first (preserving existing behavior), then falls back to `k8s.pod.name`.
All other placeholders keep their single existing attribute name, just
wrapped in a one-element slice, so their behavior is unchanged.
Validation:
Ran `go test ./...` and `go vet ./...` in
exporter/awscloudwatchlogsexporter — all tests pass, including the new
TestReplacePatternValidPodNameFromK8sSemconv (verifies `{PodName}`
resolves from `k8s.pod.name` alone) and
TestReplacePatternPodNamePrefersLegacyPodAttribute (verifies `pod` still
wins over `k8s.pod.name` when both are present, preserving backwards
compatibility).
Fixes #46202
Assisted-by: Claude Sonnet 5
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>1 parent 4c1583c commit d638a79
4 files changed
Lines changed: 82 additions & 14 deletions
File tree
- .chloggen
- exporter/awscloudwatchlogsexporter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | | - | |
63 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
107 | 139 | | |
108 | 140 | | |
109 | 141 | | |
| |||
0 commit comments