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

[receiver/apache] send port as a resource attribute #16053

Merged

Conversation

aboguszewski-sumo
Copy link
Member

@aboguszewski-sumo aboguszewski-sumo commented Nov 3, 2022

Description:
Metrics sent by apachereceiver now use apache.server.port resource attribute. This feature is hidden behind a feature gate.

Link to tracking Issue: #14791

Testing:
Unit tests for the config and scraper.

Documentation:
mdatagen

Comment on lines 65 to 69
if u.Scheme == "https" {
cfg.port = httpsDefaultPort
} else if u.Scheme == "http" {
cfg.port = httpDefaultPort
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Validate function should not change the configuration.

I suggest moving the port field to the scraper and setting it in the factory.

Copy link
Member Author

@aboguszewski-sumo aboguszewski-sumo Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the reason, but serverName is set in this function anyway - shouldn't it also be changed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, really it should. I think it's an inconsequential change but is better for the sake of consistency, so it's fine to do in this PR in my opinion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have caught a bug here.
After the fix, the integration tests stopped passing - the expected value of serverName was "", while the receiver returned "localhost". I checked immediately - and it happens that Validate is called only inside unit tests - so outside the tests, serverName wasn't actually set and was always an empty string.
I fixed this and pushed the changes on this branch.

@aboguszewski-sumo
Copy link
Member Author

I found an easy way to check the port in the tests anyway, so I modified it.

@djaglowski djaglowski merged commit f3ea473 into open-telemetry:main Nov 4, 2022
dineshg13 pushed a commit to DataDog/opentelemetry-collector-contrib that referenced this pull request Nov 21, 2022
shalper2 pushed a commit to shalper2/opentelemetry-collector-contrib that referenced this pull request Dec 6, 2022
@plantfansam plantfansam mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants