-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Collector fails to start with error in mongodb receiver invalid transport type "" #32199
Comments
Pinging code owners for receiver/mongodb: @djaglowski @schmikei. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@ashish121092 please format your configuration and share the entire error message |
The issue is happening because you are specifying mongodb:
hosts:
- endpoint: 10.224.10.25:27017
transport: "tcp"
- endpoint: 10.224.10.28:27017
transport: "tcp"
- endpoint: 10.224.10.31:27017
transport: "tcp" It should work. |
@djaglowski @schmikei this is happening because validation was added to Reviewing the receiver, I don't see the component taking advantage of If you need to use |
@TylerHelmuth thanks it works after adding transport to the collector configuration. |
I think we should only be supporting TCP, if I have some extra time I can take a look at this |
Have seen same issue in memcached receiver as well. Its not documented to use transport attribute in the config. |
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> what changed:mongodbreceiver `Hosts` configuration use `confignet.TCPAddrConfig`. Hi master, I looked at the mongodbreceiver code: 1. The error is caused by [AddrConfig.Validate()](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/confignet/confignet.go#L122) return error. ```go func (na *AddrConfig) Validate() error { switch na.Transport { case TransportTypeTCP, ... return nil default: return fmt.Errorf("invalid transport type %q", na.Transport) } } ``` 2. `mongodbreceiver` use [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver)to connect mongodb. https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/mongodbreceiver/go.mod#L13 ```go module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbreceiver go 1.21 require ( ... go.mongodb.org/mongo-driver v1.15.0 ... ) ``` 3. `go.mongodb.org/mongo-driver` based on `TCP`. https://github.com/mongodb/mongo-go-driver/blob/v1/x/mongo/driver/dns/dns.go#L82 ```go _, addresses, err := r.LookupSRV(srvName, "tcp", host) ``` So I think mongodbreceiver only supporting TCP. **Link to tracking Issue:** <Issue number if applicable> #32199 --------- Co-authored-by: Tyler Helmuth <[email protected]> Co-authored-by: Daniel Jaglowski <[email protected]> Co-authored-by: Curtis Robert <[email protected]>
@sumoanema please open a new issue, as this one was specifically for mongodb and was fixed |
Using the following configuration for collector it fails to startup with error invalid configuration for mongodb receiver : invalid transport type "".
Collector image : otel/opentelemetry-collector-contrib:0.97.0
Collector configuration:
What is the expected behavior?
The mongodb receiver collects metrics from the hosts.
What is the actual behavior?
The collector fails to start with error invalid configuration for mongodb receiver. Invalid transport type "".
Error message : Error: invalid configuration: receivers::mongodb: invalid transport type ""; invalid transport type ""; invalid transport type ""
2024/04/05 17:05:32 collector server run finished with error: invalid configuration: receivers::mongodb: invalid transport type ""; invalid transport type ""; invalid transport type ""
The text was updated successfully, but these errors were encountered: