Skip to content

Commit

Permalink
Address review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
NipunaMadhushan committed Aug 2, 2024
1 parent b815b06 commit 71215d6
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions ballerina/natives.bal
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

import ballerina/jballerina.java;

isolated final StatisticConfig[] DEFAULT_GAUGE_STATS_CONFIG = [{ timeWindow: 600000, buckets: 5,
final StatisticConfig[] & readonly defaultGaugeStatsConfig = [{ timeWindow: 600000, buckets: 5,
percentiles: [0.33, 0.5, 0.66, 0.75, 0.95, 0.99, 0.999] }];

isolated final map<string> defaultTags = {};
const map<string> DEFAULT_TAGS = {};

# Start a span with no parent span.
#
Expand Down Expand Up @@ -126,9 +126,7 @@ public isolated class Counter {
if (tags is map<string>) {
self.metricTags = tags.cloneReadOnly();
} else {
lock {
self.metricTags = defaultTags.cloneReadOnly();
}
self.metricTags = DEFAULT_TAGS;
}
externCounterInit(self);
}
Expand Down Expand Up @@ -227,12 +225,8 @@ public isolated class Gauge {
StatisticConfig[]? statisticConfig = ()) {
self.name = name;
self.description = desc ?: "";
lock {
self.metricTags = tags.cloneReadOnly() ?: defaultTags.cloneReadOnly();
}
lock {
self.statisticConfigs = statisticConfig.cloneReadOnly() ?: DEFAULT_GAUGE_STATS_CONFIG.cloneReadOnly();
}
self.metricTags = tags.cloneReadOnly() ?: DEFAULT_TAGS;
self.statisticConfigs = statisticConfig.cloneReadOnly() ?: defaultGaugeStatsConfig;
externGaugeInit(self);
}

Expand Down

0 comments on commit 71215d6

Please sign in to comment.