Skip to content

Commit

Permalink
Removes explicit approach
Browse files Browse the repository at this point in the history
Signed-off-by: Gagan Juneja <gjjuneja@amazon.com>
  • Loading branch information
Gagan Juneja committed Feb 5, 2024
1 parent 38bc0eb commit e1849a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import org.opensearch.common.concurrent.RefCountedReleasable;
import org.opensearch.telemetry.OTelTelemetryPlugin;
import org.opensearch.telemetry.tracing.OTelResourceProvider;

import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -82,12 +81,8 @@ public Counter createUpDownCounter(String name, String description, String unit)
*/
@Override
public Histogram createHistogram(String name, String description, String unit) {
String internalMetricName = name + OTelResourceProvider.DYNAMIC_HISTOGRAM_METRIC_NAME_SUFFIX;
DoubleHistogram doubleHistogram = AccessController.doPrivileged(
(PrivilegedAction<DoubleHistogram>) () -> otelMeter.histogramBuilder(internalMetricName)
.setUnit(unit)
.setDescription(description)
.build()
(PrivilegedAction<DoubleHistogram>) () -> otelMeter.histogramBuilder(name).setUnit(unit).setDescription(description).build()
);
return new OTelHistogram(doubleHistogram);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
* This class encapsulates all OpenTelemetry related resources
*/
public final class OTelResourceProvider {
/**
* SUFFIX to differentiate dynamic and explicit bucket histograms.
*/
public static final String DYNAMIC_HISTOGRAM_METRIC_NAME_SUFFIX = "-dynamic";

private OTelResourceProvider() {}

Expand Down Expand Up @@ -102,7 +98,7 @@ private static SdkMeterProvider createSdkMetricProvider(Settings settings, Resou
.build()
)
.registerView(
InstrumentSelector.builder().setName("*" + DYNAMIC_HISTOGRAM_METRIC_NAME_SUFFIX).setType(InstrumentType.HISTOGRAM).build(),
InstrumentSelector.builder().setType(InstrumentType.HISTOGRAM).build(),
View.builder().setAggregation(Base2ExponentialHistogramAggregation.getDefault()).build()
)
.build();
Expand Down

0 comments on commit e1849a2

Please sign in to comment.