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 Ballerina metrics logs observer #43615

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
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 @@
, 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 @@
return tracingProvider;
}

public static boolean isMetricsLogsEnabled() {
return metricsLogsEnabled;

Check warning on line 144 in bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/observability/ObserveUtils.java

View check run for this annotation

Codecov / codecov/patch

bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/observability/ObserveUtils.java#L144

Added line #L144 was not covered by tests
}

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

This file was deleted.

This file was deleted.

Loading