-
Notifications
You must be signed in to change notification settings - Fork 77
feat: start sending impact metrics in payload #341
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
Conversation
| List<CollectedMetric> impactMetricsOrNull = | ||
| impactMetrics.isEmpty() ? null : impactMetrics; | ||
|
|
||
| ClientMetrics metrics = | ||
| new ClientMetrics(unleashConfig, bucket, impactMetricsOrNull); |
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.
There is design from node SDK, that if we do not have any metrics, we do not add the empty array to payload.
| } | ||
|
|
||
| @Test | ||
| public void should_serialize_histogram_with_positive_infinity_as_plus_inf_string() { |
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.
Moving this to http level, so we can catch also if serializer was not mounted.
| } | ||
|
|
||
| @Test | ||
| public void should_send_impact_metrics_with_histogram_and_plus_inf_bucket() |
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.
Following the java test style, we verify that +Inf is being sent.
| } | ||
|
|
||
| @Test | ||
| public void should_include_impact_metrics_in_clientmetrics_payload() throws YggdrasilError { |
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.
These tests are same as in node SDK.
| 300, | ||
| unleashConfig.getUnleashURLs().getClientMetricsURL()); | ||
| this.engine = engine; | ||
| ImpactMetricsDataSource configuredRegistry = unleashConfig.getImpactMetricsRegistry(); |
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.
why the registry lives in the config and is not passed as other dependencies via constructor?
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.
ImpactMetricsDataSource is configurable, so it belongs in UnleashConfig, and UnleashMetricServiceImpl reads it from there (with a default fallback), just like it does for other configurable dependencies.
| unleashConfig.getUnleashURLs().getClientMetricsURL()); | ||
| this.engine = engine; | ||
| ImpactMetricsDataSource configuredRegistry = unleashConfig.getImpactMetricsRegistry(); | ||
| this.impactMetricsRegistry = |
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.
this is a code smell (https://lab.abilian.com/Tech/Architecture%20%26%20Software%20Design/Dependency%20Inversion/DI%20anti-patterns/#bastard-injection-poor-mans-injection). as a user I don't know when I should pass the registry and when it will be created automatically.
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.
Good catch, fixed it by following what we do with UnleashScheduledExecutorImpl
Pull Request Test Coverage Report for Build 20338631979Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Start sending impact metrics in metrics payload.