Fetch goal state before sending telemetry #1751
Merged
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.
Some of the code that emits telemetry is relying on something else initializing the container ID (which comes from the goal state).
I made an explicit call to fetch the goal state in the extension handler.
For the daemon, provisioning must be completed before being able to fetch the goal state, so I moved some initialization code (whose telemetry we are interested in) after provisioning. As a result of this, resource usage would not be monitored/enforced for provisioning on non-systemd distros, but I think that is OK (in fact, I am considering whether enforcement should include provisioning on systemd distros).
There is still one telemetry event without a container ID. It is emitted at the end of provisioning; I am hesitant to touch that code at this point so I will leave it alone for now.
I verified this change using the telemetry emitted by DCR.
This change is