Functional Tests create metrics which can give a distorted view of system usage
jsanhc opened this issue · 1 comments
jsanhc commented
Description
- We discover that when any test process runs against a cluster the metrics are populated.
- For some cases we don't want populated these metrics values to avoid mix test values with the metric values created by the real requests.
Reproduction
- Check how many TPPs have been created in the system in analytics.master.forgerock.financial for example
- Run the functional tests against master DOMAIN=master.forgerock.financial gradle clean build
- See how many TPPs have been created now in the system
Expected
No more TPPs have been created in the system
Actual
Many TPPs have been created in the system
Current Behaviour
To enable or disable the population of metrics values created by metrics service and consumed by analytics service there is a header named x-obri-analytics-enabled
to set true/false.
The gateway service check that header in the filter AddInteractionIdHeaderGatewayFilter
with the below behaviour:
- If the header doesn't exist the filter set the the header and is value to
true
and propagate the header through all services. - If the header exist then the filter propagate the value through all service with the value that comes from the request.
//Filter for analytics
String isAnalyticsEnabled = request.getHeaders().getFirst(ANALYTICS_ENABLED_HEADER_NAME);
if (isAnalyticsEnabled == null) {
isAnalyticsEnabled = "true";
}
ExtraFieldPropagation.set(tracer.currentSpan().context(), ANALYTICS_ENABLED_HEADER_NAME, isAnalyticsEnabled);
Solution
Add the header x-obri-analytics-enabled
through all tests projects to set true or false depending of the flavour of tests.
Tasks
- Identify the tests projects that need to be fix
- Add header
x-obri-analytics-enabled
to these tests projects that must be fix.
BohoCode commented
Above PR addresses the metrics updates happening from the ob-functional-tests project.