datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

Add subscriptions support

Open djmitche opened this issue 3 years ago • 1 comments

What does this PR do?

This adds basic support for subscriptions between components, basically copied from the POC repo. This will be useful for several other components, so let's get it landed now to enable those.

Motivation

Functionality that will be useful in later components.

Additional Notes

~~This PR is against a base branch containing #13699 and #13662. Once those are merged, I'll change the base of this PR to main and rebase, but it can be reviewed in the interim.~~

Possible Drawbacks / Trade-offs

This doesn't handle the case where a subscriber fails to read from its channel quickly enough. As written, the transmitter will block until all receivers have space in their (1-element) channels for the message. This isn't actually new -- existing AD subscriptions, for example, have this issue.

This also doesn't support the functionality of workloadmeta where messages must be delivered synchronously to each subscription, waiting for that subscription to "fully process" the message.

We can take the time in this PR to figure out how best to address these two issues.

Describe how to test/QA your changes

Reviewer's Checklist

  • [ ] If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • [ ] Use the major_change label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.
  • [ ] A release note has been added or the changelog/no-changelog label has been applied.
  • [ ] Changed code has automated tests for its functionality.
  • [ ] Adequate QA/testing plan information is provided if the qa/skip-qa label is not applied.
  • [ ] At least one team/.. label has been applied, indicating the team(s) that should QA this change.
  • [ ] If applicable, docs team has been notified or an issue has been opened on the documentation repo.
  • [ ] If applicable, the need-change/operator and need-change/helm labels have been applied.
  • [ ] If applicable, the k8s/<min-version> label, indicating the lowest Kubernetes version compatible with this feature.
  • [ ] If applicable, the config template has been updated.

djmitche avatar Oct 03 '22 21:10 djmitche

Now much simpler!

djmitche avatar Oct 13 '22 16:10 djmitche