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

[ASCII-2428] Create a metaCollector singleton #30772

Closed

Conversation

GustavoCaso
Copy link
Member

@GustavoCaso GustavoCaso commented Nov 5, 2024

What does this PR do?

Create a metaCollector singleton

Motivation

That way we no longer need to provide an optional workloadmeta when calling the tagger functions

This would allow us to fully decouple the different tagger implementation into separate packages, and ensuring the remote tagger implementation do not have a reference to the workloadmeta component

The last three commits also refactor a few places in the codebase that there were passing an optional workloadmeta. component to get the MetaCollector

  • The workloadmeta component
  • Dogstatsd component
  • The pkg/flare

The future

Ideally the util/containers/metrics should become its own component. That would avoid the usage of globals. Creating the component is a much bigger change. This change unblocks us from splitting the tagger component into multiple implementations, but ideally, we should create a separate component and pass it as a dependency to the places that used it.

Describe how to test/QA your changes

Unit tests are updated

[TBD] How to to test origin detection mode

Possible Drawbacks / Trade-offs

Additional Notes

That way we no longer need to provide an optional workloadmeta when calling the tagger functions

This would allow us to fully decouple the different tagger implementation into separate packages, and ensuring the
remote tagger implementation do not have a reference to the workloadmeta component
@GustavoCaso GustavoCaso changed the title Create a metaCollector singleton [ASCII-2428] Create a metaCollector singleton Nov 5, 2024
@github-actions github-actions bot added team/container-platform The Container Platform Team medium review PR review might take time labels Nov 5, 2024
@GustavoCaso GustavoCaso added changelog/no-changelog and removed medium review PR review might take time labels Nov 5, 2024
@GustavoCaso GustavoCaso modified the milestones: 7.60.0, 7.61.0 Nov 5, 2024
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Nov 5, 2024

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv create-vm --pipeline-id=48328531 --os-family=ubuntu

Note: This applies to commit 3465c8f

@github-actions github-actions bot added the long review PR is complex, plan time to review it label Nov 5, 2024
@GustavoCaso GustavoCaso added qa/done QA done before merge and regressions are covered by tests and removed team/container-platform The Container Platform Team labels Nov 5, 2024
@GustavoCaso GustavoCaso marked this pull request as ready for review November 5, 2024 16:34
@GustavoCaso GustavoCaso requested review from a team as code owners November 5, 2024 16:34
@GustavoCaso GustavoCaso requested a review from ogaca-dd November 5, 2024 16:34
@GustavoCaso GustavoCaso requested review from a team as code owners November 6, 2024 10:04
@GustavoCaso GustavoCaso requested a review from dinooliva November 6, 2024 10:04
@GustavoCaso GustavoCaso removed the qa/done QA done before merge and regressions are covered by tests label Nov 6, 2024
@GustavoCaso GustavoCaso removed this from the 7.61.0 milestone Nov 6, 2024
@GustavoCaso GustavoCaso added this to the 7.60.0 milestone Nov 6, 2024
)

func TestStartCommand(t *testing.T) {
fxutil.TestOneShotSubcommand(t,
[]*cobra.Command{MakeCommand("defaultLogFile")},
[]string{"start", "--cfgpath", "PATH"},
[]string{"start"},
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change really necessary for workloadmeta decoupling?

@@ -81,7 +79,7 @@ func newParser(cfg model.Reader, float64List *float64ListPool, workerNum int, wm
readTimestamps: readTimestamps,
float64List: float64List,
dsdOriginEnabled: cfg.GetBool("dogstatsd_origin_detection_client"),
provider: provider.GetProvider(wmeta),
provider: provider.GetMetaCollector(),
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems unnecessarily fragile. Before this change the provider was made sure to be initialized whenever it was used, now this depends on the code scattered around cmd for this. (GetProvider starts a background process that feeds data into the meta collector, but GetMetaCollector does not). I get the need to decouple the tagger component from the workloadmeta, but is there really any need to decouple the dogstatsd server?

@GustavoCaso GustavoCaso marked this pull request as draft November 6, 2024 11:36
@GustavoCaso GustavoCaso closed this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants