-
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
[receiver/apache] send port as a resource attribute #16053
[receiver/apache] send port as a resource attribute #16053
Conversation
receiver/apachereceiver/config.go
Outdated
if u.Scheme == "https" { | ||
cfg.port = httpsDefaultPort | ||
} else if u.Scheme == "http" { | ||
cfg.port = httpDefaultPort | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
9f84322
to
748aadc
Compare
I found an easy way to check the port in the tests anyway, so I modified it. |
…6053) * feat: add sending port as a resource attribute
…6053) * feat: add sending port as a resource attribute
Description:
Metrics sent by
apachereceiver
now useapache.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