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

Add metrics qualifiers for structs that inject metrics #237

Merged
merged 2 commits into from
Mar 25, 2021

Conversation

MikeGoldsmith
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith commented Mar 25, 2021

When using dependency injection, all dependencies listed in structs must use the same name qualifier. The dependency builder does not auto inject based on property name match.

This PR sets the metrics inject qualifier for the main metrics config that is registered when executing main.go.

This was missed because tests manually create their dependencies and do not rely on dependency injection which I've now added for any struct that injects a metrics instance.

@MikeGoldsmith MikeGoldsmith marked this pull request as ready for review March 25, 2021 16:56
@MikeGoldsmith MikeGoldsmith requested a review from a team March 25, 2021 16:56
Copy link
Contributor

@vreynolds vreynolds left a comment

Choose a reason for hiding this comment

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

That's a sneaky one, I wish this surfaced at compile time, but I suppose that's the DI world we live in. ❤️ the tests

@vreynolds vreynolds merged commit 76ab1a9 into main Mar 25, 2021
@vreynolds vreynolds deleted the mike/inject-metrics branch March 25, 2021 17:48
ghost pushed a commit to opsramp/tracing-proxy that referenced this pull request Jul 5, 2024
* add metrics qualifiers for structs that inject metrics

* add tests for verifying named metrics dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants