-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove AsyncInstrumentRegistry after update to SDK 1.12
- Loading branch information
Mateusz Rzeszutek
committed
Mar 9, 2022
1 parent
9e5fdce
commit 4d2aa5a
Showing
12 changed files
with
225 additions
and
452 deletions.
There are no files selected for viewing
303 changes: 0 additions & 303 deletions
303
.../src/main/java/io/opentelemetry/instrumentation/api/internal/AsyncInstrumentRegistry.java
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...main/java/io/opentelemetry/instrumentation/micrometer/v1_5/DoubleMeasurementRecorder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.micrometer.v1_5; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.ObservableDoubleMeasurement; | ||
import java.lang.ref.WeakReference; | ||
import java.util.function.Consumer; | ||
import java.util.function.ToDoubleFunction; | ||
import javax.annotation.Nullable; | ||
|
||
final class DoubleMeasurementRecorder<T> implements Consumer<ObservableDoubleMeasurement> { | ||
|
||
private final WeakReference<T> objWeakRef; | ||
private final ToDoubleFunction<T> metricFunction; | ||
private final Attributes attributes; | ||
|
||
DoubleMeasurementRecorder( | ||
@Nullable T obj, ToDoubleFunction<T> metricFunction, Attributes attributes) { | ||
this.objWeakRef = new WeakReference<>(obj); | ||
this.metricFunction = metricFunction; | ||
this.attributes = attributes; | ||
} | ||
|
||
@Override | ||
public void accept(ObservableDoubleMeasurement measurement) { | ||
T obj = objWeakRef.get(); | ||
if (obj != null) { | ||
measurement.record(metricFunction.applyAsDouble(obj), attributes); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...c/main/java/io/opentelemetry/instrumentation/micrometer/v1_5/LongMeasurementRecorder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.micrometer.v1_5; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.ObservableLongMeasurement; | ||
import java.lang.ref.WeakReference; | ||
import java.util.function.Consumer; | ||
import java.util.function.ToLongFunction; | ||
import javax.annotation.Nullable; | ||
|
||
final class LongMeasurementRecorder<T> implements Consumer<ObservableLongMeasurement> { | ||
|
||
private final WeakReference<T> objWeakRef; | ||
private final ToLongFunction<T> metricFunction; | ||
private final Attributes attributes; | ||
|
||
LongMeasurementRecorder( | ||
@Nullable T obj, ToLongFunction<T> metricFunction, Attributes attributes) { | ||
this.objWeakRef = new WeakReference<>(obj); | ||
this.metricFunction = metricFunction; | ||
this.attributes = attributes; | ||
} | ||
|
||
@Override | ||
public void accept(ObservableLongMeasurement measurement) { | ||
T obj = objWeakRef.get(); | ||
if (obj != null) { | ||
measurement.record(metricFunction.applyAsLong(obj), attributes); | ||
} | ||
} | ||
} |
Oops, something went wrong.