Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

receivers/oracledb conflates IDs with Types #31457

Closed
hughesjj opened this issue Feb 27, 2024 · 1 comment · Fixed by #31504
Closed

receivers/oracledb conflates IDs with Types #31457

hughesjj opened this issue Feb 27, 2024 · 1 comment · Fixed by #31504
Labels
bug Something isn't working receiver/oracledb

Comments

@hughesjj
Copy link
Contributor

hughesjj commented Feb 27, 2024

Component(s)

receiver/oracledb

What happened?

Description

Note that scraper.go passes in id.String() to scraperhelper.NewScraper(...). However, NewScraper currently converts this string value to an ID of just the name component.NewID(component.MustNewType(name)),.

The net result of this is that the cannonical string for IDs with names (type + / + name) is treated as a (nameless, type-only) ID in ScraperHelper

This, combined with the new strict MustBlah methods, breaks discovery/observers, as the convention for observer/receiver_creator places `{end . We configure endpoints as part of the name, and such are disallowed by the new conventions.

Steps to Reproduce

Expected Result

Actual Result

Collector version

v0.94

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

No response

Log output

From our downstream distro,


=== RUN   TestOracledbDockerObserver
<logs omitted due to length>
{"level":"debug","ts":1709071841.7361474,"caller":"[email protected]/observerhandler.go:86","msg":"handling added endpoint","kind":"receiver","env":{"alternate_port":1521,"command":"","container_id":"45bee8d74a58b395274691f5890f05273cc527b5ef42d69b69cf164ea2afb18a","endpoint":"172.17.0.3:1521","host":"172.17.0.3","id":"45bee8d74a58b395274691f5890f05273cc527b5ef42d69b69cf164ea2afb18a:1521","image":"dca89199-34e9-49f9-a778-d43f641b9a1f","labels":{"io.buildah.version":"1.22.4-dev","org.opencontainers.image.source":"https://github.com/gvenzl/oci-oracle-xe","org.testcontainers":"true","org.testcontainers.lang":"go","org.testcontainers.sessionId":"de3f8a3f30676accfb1d6ed669da43f2714d64a2d7b8633de154fadfaa4f4a2a","org.testcontainers.version":"0.27.0"},"name":"oracledb","port":1521,"tag":"a7946821-71aa-406b-aa68-b7595114a48d","transport":"TCP","type":"container"}}
{"level":"debug","ts":1709071841.7362206,"msg":"evaluating statement","kind":"receiver","statement":{"Message":"starting receiver","Fields":{"caller":"[email protected]/observerhandler.go:96","endpoint":"172.17.0.3:1521","endpoint_id":"45bee8d74a58b395274691f5890f05273cc527b5ef42d69b69cf164ea2afb18a:1521","kind":"receiver","name":"oracledb"},"Level":"info","Time":"2024-02-27T22:10:41.736203226Z","LoggerName":"","Caller":{"Defined":true,"PC":62074799,"File":"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/observerhandler.go","Line":96,"Function":"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*observerHandler).OnAdd"},"Stack":""}}
{"level":"debug","ts":1709071841.7364082,"msg":"Adding watch_observer to embedded receiver config receiver attrs","kind":"receiver","observer":"docker_observer","receiver.type":"oracledb","receiver.name":"","receiverid":"oracledb","correp":"Endpoint{ID: 45bee8d74a58b395274691f5890f05273cc527b5ef42d69b69cf164ea2afb18a:1521, Target: 172.17.0.3:1521, Details: *observer.Container&{Name:oracledb Image:dca89199-34e9-49f9-a778-d43f641b9a1f Tag:a7946821-71aa-406b-aa68-b7595114a48d Port:1521 AlternatePort:1521 Command: ContainerID:45bee8d74a58b395274691f5890f05273cc527b5ef42d69b69cf164ea2afb18a Host:172.17.0.3 Transport:TCP Labels:map[io.buildah.version:1.22.4-dev org.opencontainers.image.source:https://github.com/gvenzl/oci-oracle-xe org.testcontainers:true org.testcontainers.lang:go org.testcontainers.sessionId:de3f8a3f30676accfb1d6ed669da43f2714d64a2d7b8633de154fadfaa4f4a2a org.testcontainers.version:0.27.0]}}"}
{"level":"debug","ts":1709071841.7364225,"msg":"non-strict matches will be evaluated with pattern map","kind":"receiver","map":"{\"endpoint\":\"172.17.0.3:1521\",\"endpoint_id\":\"45bee8d74a58b395274691f5890f05273cc527b5ef42d69b69cf164ea2afb18a:1521\",\"kind\":\"receiver\",\"message\":\"starting receiver\"}"}
panic: invalid character(s) in type "oracledb//receiver_creator/docker_observer{endpoint=\"172.17.0.3:1521\"}/45bee8d74a58b395274691f5890f05273cc527b5ef42d69b69cf164ea2afb18a:1521"

goroutine 212 [running]:
go.opentelemetry.io/collector/component.MustNewType(...)
	go.opentelemetry.io/collector/[email protected]/config.go:149
go.opentelemetry.io/collector/receiver/scraperhelper.NewScraper({0xc000d4c480?, 0x68f61aa?}, 0xc002b2f710, {0xc0027b6b58, 0x2, 0xc000d4c360?})
	go.opentelemetry.io/collector/[email protected]/scraperhelper/scraper.go:70 +0x13c
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver.newScraper({{0x68f61aa?, 0x0?}, {0xc000d4c360?, 0x1000100010001?}}, 0xc002ad6c00, {{{0x0, 0x0}, {0x1, 0x0}, {0x0, ...}, ...}, ...}, ...)
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/scraper.go:77 +0x328
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver.createReceiverFunc.func1({0x7ffeed?, 0xc002aba640?}, {{{0x68f61aa, 0x8}, {0xc000d4c360, 0x83}}, {0xc002ac7380, {0x7585718, 0xc002ac1160}, {0x7585358, ...}, ...}, ...}, ...)
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/factory.go:60 +0x2ef
go.opentelemetry.io/collector/receiver.CreateMetricsFunc.CreateMetricsReceiver(...)
	go.opentelemetry.io/collector/[email protected]/receiver.go:129
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*receiverRunner).createMetricsRuntimeReceiver(0xc0027b7460?, {0x75d2620, 0xc0006a4fa0}, {{0x68f61aa?, 0x45?}, {0xc000d4c360?, 0x75d2620?}}, {0x592a460, 0xc002b3e8c0}, {0x7579f30, ...})
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/runner.go:196 +0x273
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*receiverRunner).start(0xc00043a700, {{{0xc0027bbd48, 0x8}, {0x0, 0x0}}, 0xc002b22d80, {0xc00058ee10, 0x45}}, 0xc00058ee10?, 0xc002b20b40)
	github.com/open-telemetry/opentelemetry-c


### Additional context

_No response_
@hughesjj hughesjj added bug Something isn't working needs triage New item requiring triage labels Feb 27, 2024
@atoulme atoulme added receiver/oracledb and removed needs triage New item requiring triage labels Feb 27, 2024
Copy link
Contributor

Pinging code owners for receiver/oracledb: @dmitryax @crobert-1 @atoulme. See Adding Labels via Comments if you do not have permissions to add labels yourself.

dmitryax pushed a commit that referenced this issue Feb 29, 2024
**Description:** 
Use metadata.Type for the scraper id to avoid invalid scraper IDs.

**Link to tracking Issue:**
Fixes
#31457
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this issue Mar 13, 2024
…31504)

**Description:** 
Use metadata.Type for the scraper id to avoid invalid scraper IDs.

**Link to tracking Issue:**
Fixes
open-telemetry#31457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working receiver/oracledb
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants