Skip to content

Commit

Permalink
Merge pull request #43615 from NipunaMadhushan/java21-metrics-logs
Browse files Browse the repository at this point in the history
Add Ballerina metrics logs observer
  • Loading branch information
NipunaMadhushan authored Dec 19, 2024
2 parents 3d6147a + 70ee310 commit 53f6d83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public final class ObserveUtils {
private static final BString metricsReporter;
private static final boolean tracingEnabled;
private static final BString tracingProvider;
private static final boolean metricsLogsEnabled;

static {
// TODO: Move config initialization to ballerina level once checking config key is possible at ballerina level
Expand All @@ -88,13 +89,16 @@ public final class ObserveUtils {
, false);
VariableKey tracingProviderKey = new VariableKey(observeModule, "tracingProvider",
PredefinedTypes.TYPE_STRING, false);
VariableKey metricsLogsEnabledKey = new VariableKey(observeModule, "metricsLogsEnabled",
PredefinedTypes.TYPE_BOOLEAN, false);

metricsEnabled = readConfig(metricsEnabledKey, enabledKey, false);
metricsProvider = readConfig(metricsProviderKey, null, StringUtils.fromString("default"));
metricsReporter = readConfig(metricsReporterKey, providerKey, StringUtils.fromString("choreo"));
tracingEnabled = readConfig(tracingEnabledKey, enabledKey, false);
tracingProvider = readConfig(tracingProviderKey, providerKey, StringUtils.fromString("choreo"));
enabled = metricsEnabled || tracingEnabled;
metricsLogsEnabled = readConfig(metricsLogsEnabledKey, metricsLogsEnabledKey, false);
enabled = metricsEnabled || tracingEnabled || metricsLogsEnabled;
}

private ObserveUtils() {
Expand Down Expand Up @@ -136,6 +140,10 @@ public static BString getTracingProvider() {
return tracingProvider;
}

public static boolean isMetricsLogsEnabled() {
return metricsLogsEnabled;
}

/**
* Add metrics and tracing observers.
*
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 53f6d83

Please sign in to comment.