use of io.helidon.config.Config in project helidon by oracle.
the class TestSystemTagsManager method checkForGlobalButNoMetricTags.
@Test
void checkForGlobalButNoMetricTags() {
Config metricsConfig = Config.just(ConfigSources.create(GLOBAL_AND_APP_TAG_SETTINGS)).get("metrics");
MetricsSettings metricsSettings = MetricsSettings.create(metricsConfig);
SystemTagsManager mgr = SystemTagsManager.create(metricsSettings);
MetricID metricID = new MetricID("no-tags-metric");
Map<String, String> fullTags = new HashMap<>();
mgr.allTags(metricID).forEach(entry -> fullTags.put(entry.getKey(), entry.getValue()));
assertThat("Global tags derived from tagless metric ID", fullTags, allOf(hasEntry(GLOBAL_TAG_1, GLOBAL_VALUE_1), hasEntry(GLOBAL_TAG_2, GLOBAL_VALUE_2), hasKey(SystemTagsManager.APP_TAG)));
}
use of io.helidon.config.Config in project helidon by oracle.
the class TestSystemTagsManager method checkMetricsSettingsForGlobalTagsConfig.
@Test
void checkMetricsSettingsForGlobalTagsConfig() {
Config metricsConfig = Config.just(ConfigSources.create(GLOBAL_ONLY_TAGS_SETTINGS)).get("metrics");
MetricsSettings metricsSettings = MetricsSettings.create(metricsConfig);
Map<String, String> tags = metricsSettings.globalTags();
assertThat("Global tags in settings", tags, allOf(hasEntry(GLOBAL_TAG_1, GLOBAL_VALUE_1), hasEntry(GLOBAL_TAG_2, GLOBAL_VALUE_2), not(hasKey(MetricsSettings.Builder.APP_TAG_CONFIG_KEY))));
}
use of io.helidon.config.Config in project helidon by oracle.
the class TestSystemTagsManager method checkSystemTagsManagerForGlobalTags.
@Test
void checkSystemTagsManagerForGlobalTags() {
Config metricsConfig = Config.just(ConfigSources.create(GLOBAL_ONLY_TAGS_SETTINGS)).get("metrics");
MetricsSettings metricsSettings = MetricsSettings.create(metricsConfig);
SystemTagsManager mgr = SystemTagsManager.create(metricsSettings);
MetricID metricID = new MetricID("my-metric", new Tag(METRIC_TAG_NAME, METRIC_TAG_VALUE));
Map<String, String> fullTags = new HashMap<>();
mgr.allTags(metricID).forEach(entry -> fullTags.put(entry.getKey(), entry.getValue()));
assertThat("Global tags derived from tagless metric ID", fullTags, allOf(hasEntry(GLOBAL_TAG_1, GLOBAL_VALUE_1), hasEntry(GLOBAL_TAG_2, GLOBAL_VALUE_2), hasEntry(METRIC_TAG_NAME, METRIC_TAG_VALUE), not(hasKey(SystemTagsManager.APP_TAG))));
}
use of io.helidon.config.Config in project helidon by oracle.
the class TestSystemTagsManager method checkForGlobalAndAppTags.
@Test
void checkForGlobalAndAppTags() {
Config metricsConfig = Config.just(ConfigSources.create(GLOBAL_AND_APP_TAG_SETTINGS)).get("metrics");
MetricsSettings metricsSettings = MetricsSettings.create(metricsConfig);
SystemTagsManager mgr = SystemTagsManager.create(metricsSettings);
MetricID metricID = new MetricID("my-metric", new Tag(METRIC_TAG_NAME, METRIC_TAG_VALUE));
Map<String, String> fullTags = new HashMap<>();
mgr.allTags(metricID).forEach(entry -> fullTags.put(entry.getKey(), entry.getValue()));
assertThat("Global tags derived from tagless metric ID", fullTags, allOf(hasEntry(GLOBAL_TAG_1, GLOBAL_VALUE_1), hasEntry(GLOBAL_TAG_2, GLOBAL_VALUE_2), hasEntry(METRIC_TAG_NAME, METRIC_TAG_VALUE), hasKey(SystemTagsManager.APP_TAG)));
}
use of io.helidon.config.Config in project helidon by oracle.
the class TestMetricsSettings method loadConfig.
@BeforeAll
static void loadConfig() throws IOException {
Config all = Config.just(ConfigSources.classpath(CONFIG_FILE));
topLevelDisabled = all.get("topLevelDisabled").get("metrics");
baseDisabled = all.get("baseDisabled").get("metrics");
baseSelectiveDisabled = all.get("baseSelectiveDisabled").get("metrics");
withKpi = all.get("withKpi").get("metrics");
withRESTSettings = all.get("withRESTSettings").get("metrics");
withOneRegistrySettings = all.get("withOneRegistrySettings").get("metrics");
withTwoRegistrySettings = all.get("withTwoRegistrySettings").get("metrics");
registrySettingsWithBadFilterSyntax = all.get("registrySettingsWithBadFilterSyntax").get("metrics");
withSimpleFilter = all.get("withSimpleFilter").get("metrics");
}
Aggregations