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

Mongo version never collected #27441

Closed
gsanchezgavier opened this issue Oct 5, 2023 · 3 comments
Closed

Mongo version never collected #27441

gsanchezgavier opened this issue Oct 5, 2023 · 3 comments
Assignees
Labels
bug Something isn't working receiver/mongodb

Comments

@gsanchezgavier
Copy link
Contributor

Component(s)

receiver/mongodb

What happened?

Description

After this bugfix #23860 version is never collected.

Steps to Reproduce

Configure the receiver to scrape a v4.4 mongo instance.

Expected Result

This metric not being collected because of the mongo version

Actual Result

Error logged

 Error scraping metrics    {"kind": "receiver", "name": "mongodb", "data_type": "metrics", "error": "failed to collect metric mongodb.extent.count with attribute(s) admin: could not find key for metric; failed to fetch index stats metrics: (Unauthorized) not authorized on admin to execute command... 

Collector version

v0.86.0

Environment information

Environment

mongodb v4.4

OpenTelemetry Collector configuration

mongodb:
    hosts:
      - endpoint: localhost:27017
    username: root
    password: fake
    tls:
      insecure: true
      insecure_skip_verify: true

Log output

No response

Additional context

I'm submitting the fix PR

@gsanchezgavier gsanchezgavier added bug Something isn't working needs triage New item requiring triage labels Oct 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1
Copy link
Member

I checked the PR, I agree this is a bug. A code owner has also commented on the PR, so I'm removing needs triage.

@crobert-1 crobert-1 removed the needs triage New item requiring triage label Oct 5, 2023
djaglowski pushed a commit that referenced this issue Oct 6, 2023
**Description:** <Describe what has changed.>
- Improve the unit-test to catch similar errors in the future. 
- Fix mongodb version collection. 

**Link to tracking Issue:** <Issue number if applicable>
#27441 
**Testing:** <Describe what testing was performed and which tests were
added.>
Added the expectation assert for the Mock. 
This is the log output from running the tests in the first catching the
bug
```
--- FAIL: TestScraperScrape (0.00s)
    --- FAIL: TestScraperScrape/Failed_to_fetch_database_names (0.00s)
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: FAIL:	GetVersion(string)
            		at: [pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:146 pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:292]
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: PASS:	ListDatabaseNames(string,string,string)
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: FAIL: 1 out of 2 expectation(s) were met.
            	The code you are testing needs to make 1 more call(s).
            	at: [pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316]
```
**Documentation:** <Describe the documentation added.>
@crobert-1
Copy link
Member

crobert-1 commented Oct 6, 2023

Fixed by #27442, thanks @gsanchezgavier!

jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this issue Nov 12, 2023
**Description:** <Describe what has changed.>
- Improve the unit-test to catch similar errors in the future. 
- Fix mongodb version collection. 

**Link to tracking Issue:** <Issue number if applicable>
open-telemetry#27441 
**Testing:** <Describe what testing was performed and which tests were
added.>
Added the expectation assert for the Mock. 
This is the log output from running the tests in the first catching the
bug
```
--- FAIL: TestScraperScrape (0.00s)
    --- FAIL: TestScraperScrape/Failed_to_fetch_database_names (0.00s)
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: FAIL:	GetVersion(string)
            		at: [pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:146 pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:292]
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: PASS:	ListDatabaseNames(string,string,string)
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: FAIL: 1 out of 2 expectation(s) were met.
            	The code you are testing needs to make 1 more call(s).
            	at: [pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316]
```
**Documentation:** <Describe the documentation added.>
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/mongodb
Projects
None yet
Development

No branches or pull requests

2 participants