Skip to content

Commit a877923

Browse files
authored
[processor/resourcedetection] fix when panic when AKS detector is used (#24549)
**Description:** Address the following panic when AKS detector is used. This issue was introduced by this change 04327f5 ```` panic: interface conversion: internal.DetectorConfig is nil, not aks.Config goroutine 1 [running]: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/azure/aks.NewDetector({{{0xc0023d5638, 0x11}, {0x0, 0x0}}, {0xc002568fc0, {0x6877700, 0xc0024f1580}, {0x68a1850, 0xc00251b590}, 0x0, ...}, ...}, ...) github.com/open-telemetry/opentelemetry-collector-contrib/processor/[email protected]/internal/azure/aks/aks.go:34 +0x10a github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal.(*ResourceProviderFactory).getDetectors(0xc00082ffe0, {{{0xc0023d5638, 0x11}, {0x0, 0x0}}, {0xc002568fc0, {0x6877700, 0xc0024f1580}, {0x68a1850, 0xc00251b590}, ...}, ...}, ...) github.com/open-telemetry/opentelemetry-collector-contrib/processor/[email protected]/internal/resourcedetection.go:73 +0x182 github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal.(*ResourceProviderFactory).CreateResourceProvider(0xc001dbfeb8?, {{{0xc0023d5638, 0x11}, {0x0, 0x0}}, {0xc002568fc0, {0x6877700, 0xc0024f1580}, {0x68a1850, 0xc00251b590}, ...}, ...}, ...) github.com/open-telemetry/opentelemetry-collector-contrib/processor/[email protected]/internal/resourcedetection.go:49 +0x9d ```` Signed-off-by: Dani Louca <[email protected]>
1 parent 6c5baea commit a877923

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use this changelog template to create an entry for release notes.
2+
# If your change doesn't affect end users, such as a test fix or a tooling change,
3+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
4+
5+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
6+
change_type: bug_fix
7+
8+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
9+
component: processor/resourcedetection
10+
11+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
12+
note: make sure to use a aks config struct instead of nil to avoid collector panic
13+
14+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
15+
issues: [24549]
16+
17+
# (Optional) One or more lines of additional information to render under the primary note.
18+
# These lines will be padded with 2 spaces and then inserted directly into the document.
19+
# Use pipe (|) for multiline entries.
20+
subtext:

processor/resourcedetectionprocessor/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ func (d *DetectorConfig) GetConfigFromType(detectorType internal.DetectorType) i
116116
return d.LambdaConfig
117117
case azure.TypeStr:
118118
return d.AzureConfig
119+
case aks.TypeStr:
120+
return d.AksConfig
119121
case consul.TypeStr:
120122
return d.ConsulConfig
121123
case docker.TypeStr:

processor/resourcedetectionprocessor/testdata/config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ resourcedetection/openshift:
99
tls:
1010
insecure: true
1111

12+
resourcedetection/aks:
13+
detectors: [ env, aks ]
14+
timeout: 2s
15+
override: false
16+
1217
resourcedetection/gcp:
1318
detectors: [env, gcp]
1419
timeout: 2s

0 commit comments

Comments
 (0)