-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[chore][exporter/datadog] Only start hostmetadata.Reporter
if host_metadata.enabled
#36669
Merged
mx-psi
merged 8 commits into
open-telemetry:main
from
jade-guiton-dd:36522-remove-host-metrics-workaround
Dec 10, 2024
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1262a34
Only start `Reporter` if `HostMetadata.Enabled`
jade-guiton-dd a03a583
Shadowing is bad, mkay?
jade-guiton-dd d587277
Fix test that was modifying config in-flight
jade-guiton-dd 035cf82
Add `ReporterPeriod` to test config
jade-guiton-dd 33e1fb1
Lint
jade-guiton-dd d3aeb98
We've fixed one, yes. But what about second broken test?
jade-guiton-dd 46161c1
Refactor and add comments
jade-guiton-dd 639ce64
Minify diff
jade-guiton-dd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 find this comment a bit confusing, why not define them inside the
if
block then?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.
Because they're referenced below. Unless we structure the whole function, we need these variables to be defined for the rest of the function, with
metadataReporter
left asnil
if theif
branch wasn't taken.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 guess I find the usage of "referenced" and "used" here confusing on the comment then: from your message I take that they are "used" (mentioned in code) both if HostMetadata.Enabled and if not, right?
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.
Right, I guess we have different definitions of "used".
The two variables are mentioned / referenced in the code below, which requires their scope to be larger than the
if
statement if we want the code to compile. This is independent of what path the code takes.Even when
!HostMetadata.Enabled
,metadataReporter
will still be read (notpcfg
however), in order to be passed to thenew(Logs|Traces|Metrics)Exporter
function. It will benil
in that case, and gets stored as theexp.metadataReporter
field.But the pointer won't be used later down the line, ie. no methods will be called on it. (Which is good, because that would cause a segfault.)
I can reword the comment to make this clearer if you'd like.
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.
Ah, right, thanks! I will let you decide whether to reword it. I did find it confusing, and I don't feel like this is standard wording for this, but maybe it's just me 😄
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 simplified the logic and the comments somewhat, tell me if you think things are clearer or not