opentelemetry-collector-contrib
opentelemetry-collector-contrib copied to clipboard
[mongodbreceiver] change 'Hosts' configuration type
Description: <Describe what has changed.>
what changed:mongodbreceiver Hosts
configuration use confignet.TCPAddrConfig
.
Hi master, I looked at the mongodbreceiver code:
- The error is caused by AddrConfig.Validate() return error.
func (na *AddrConfig) Validate() error {
switch na.Transport {
case TransportTypeTCP,
...
return nil
default:
return fmt.Errorf("invalid transport type %q", na.Transport)
}
}
-
mongodbreceiver
use go.mongodb.org/mongo-driverto connect mongodb.
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/mongodbreceiver/go.mod#L13
module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbreceiver
go 1.21
require (
...
go.mongodb.org/mongo-driver v1.15.0
...
)
-
go.mongodb.org/mongo-driver
based onTCP
.
https://github.com/mongodb/mongo-go-driver/blob/v1/x/mongo/driver/dns/dns.go#L82
_, addresses, err := r.LookupSRV(srvName, "tcp", host)
So I think mongodbreceiver only supporting TCP.
Link to tracking Issue: <Issue number if applicable> https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32199
Hi @TylerHelmuth , Thanks for your suggestion, the last commit has been fixed
Please make corresponding changes to the README. The example still shows setting transport: tcp
. I think we should also add a note to the parameters section stating that the transport
option is no longer available.