Skip to content

Commit

Permalink
Fix checkstyle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NipunaMadhushan committed Nov 22, 2024
1 parent 3b9b929 commit 0a2ad8d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
import io.ballerina.runtime.api.values.BError;
import io.ballerina.runtime.api.values.BString;
import io.ballerina.runtime.observability.ObserveUtils;
import io.ballerina.stdlib.observe.observers.BallerinaMetricsLogsObserver;
import io.ballerina.stdlib.observe.observers.BallerinaMetricsObserver;
import io.ballerina.runtime.observability.metrics.DefaultMetricRegistry;
import io.ballerina.runtime.observability.metrics.MetricRegistry;
import io.ballerina.runtime.observability.metrics.noop.NoOpMetricProvider;
import io.ballerina.runtime.observability.metrics.spi.MetricProvider;
import io.ballerina.stdlib.observe.observers.BallerinaTracingObserver;
import io.ballerina.runtime.observability.tracer.TracersStore;
import io.ballerina.runtime.observability.tracer.noop.NoOpTracerProvider;
import io.ballerina.runtime.observability.tracer.spi.TracerProvider;
import io.ballerina.stdlib.observe.observers.BallerinaMetricsLogsObserver;
import io.ballerina.stdlib.observe.observers.BallerinaMetricsObserver;
import io.ballerina.stdlib.observe.observers.BallerinaTracingObserver;

import java.io.PrintStream;
import java.util.ServiceLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.ballerina.runtime.api.values.BMap;
import io.ballerina.runtime.api.values.BString;
import io.ballerina.runtime.observability.BallerinaObserver;
import io.ballerina.runtime.observability.ObserveUtils;
import io.ballerina.runtime.observability.ObserverContext;
import io.ballerina.runtime.observability.metrics.Tag;

Expand All @@ -34,10 +33,13 @@
import java.util.Optional;
import java.util.Set;

import static io.ballerina.runtime.observability.ObservabilityConstants.*;
import static io.ballerina.runtime.observability.ObservabilityConstants.PROPERTY_KEY_HTTP_STATUS_CODE;
import static io.ballerina.runtime.observability.ObservabilityConstants.STATUS_CODE_GROUP_SUFFIX;
import static io.ballerina.runtime.observability.ObservabilityConstants.TAG_KEY_HTTP_STATUS_CODE_GROUP;

public class BallerinaMetricsLogsObserver implements BallerinaObserver {
private static final String ORG_NAME = "ballerinax";
private static final String MODULE_NAME = "metrics.logs";
private static final String METRIC_LOG_FUNCTION_NAME = "printMetricsLog";
private static final String PROPERTY_START_TIME = "_observation_start_time_";
private static final PrintStream consoleError = System.err;
Expand Down Expand Up @@ -121,7 +123,7 @@ private void handleError(String metricName, Set<Tag> tags, RuntimeException e) {

private static void printMetricLog(BMap<BString, Object> logAttributes) {
// TODO: Remove version when the API is finalized, and add the configured org name.
Module metricsLogsModule = new Module(ORG_NAME, ObserveUtils.getMetricsLogsProvider().getValue(), "1");
Module metricsLogsModule = new Module(ORG_NAME, MODULE_NAME, "1");
environment.getRuntime().callFunction(metricsLogsModule, METRIC_LOG_FUNCTION_NAME, null, logAttributes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,22 @@

import io.ballerina.runtime.observability.BallerinaObserver;
import io.ballerina.runtime.observability.ObserverContext;
import io.ballerina.runtime.observability.metrics.*;
import io.ballerina.runtime.observability.metrics.DefaultMetricRegistry;
import io.ballerina.runtime.observability.metrics.Gauge;
import io.ballerina.runtime.observability.metrics.MetricId;
import io.ballerina.runtime.observability.metrics.MetricRegistry;
import io.ballerina.runtime.observability.metrics.StatisticConfig;
import io.ballerina.runtime.observability.metrics.Tag;

import java.io.PrintStream;
import java.time.Duration;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import static io.ballerina.runtime.observability.ObservabilityConstants.*;
import static io.ballerina.runtime.observability.ObservabilityConstants.PROPERTY_KEY_HTTP_STATUS_CODE;
import static io.ballerina.runtime.observability.ObservabilityConstants.STATUS_CODE_GROUP_SUFFIX;
import static io.ballerina.runtime.observability.ObservabilityConstants.TAG_KEY_HTTP_STATUS_CODE_GROUP;

/**
* Observe the runtime and collect measurements.
Expand Down

0 comments on commit 0a2ad8d

Please sign in to comment.