-
Notifications
You must be signed in to change notification settings - Fork 854
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add APIs to determine if tracer, logger, instruments are enabled (#6502)
- Loading branch information
Showing
37 changed files
with
773 additions
and
81 deletions.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
api/incubator/src/main/java/io/opentelemetry/api/incubator/logs/ExtendedLogger.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,23 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.logs; | ||
|
||
import io.opentelemetry.api.logs.Logger; | ||
|
||
/** Extended {@link Logger} with experimental APIs. */ | ||
public interface ExtendedLogger extends Logger { | ||
|
||
/** | ||
* Returns {@code true} if the logger is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #logRecordBuilder()}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...incubator/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedDoubleCounter.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.metrics; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.DoubleCounter; | ||
import io.opentelemetry.context.Context; | ||
|
||
/** Extended {@link DoubleCounter} with experimental APIs. */ | ||
public interface ExtendedDoubleCounter extends DoubleCounter { | ||
|
||
/** | ||
* Returns {@code true} if the counter is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #add(double)}, {@link #add(double, Attributes)}, or {@link #add(double, | ||
* Attributes, Context)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
api/incubator/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedDoubleGauge.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.metrics; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.DoubleGauge; | ||
import io.opentelemetry.context.Context; | ||
|
||
/** Extended {@link DoubleGauge} with experimental APIs. */ | ||
public interface ExtendedDoubleGauge extends DoubleGauge { | ||
|
||
/** | ||
* Returns {@code true} if the gauge is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #set(double)}, {@link #set(double, Attributes)}, or {@link #set(double, | ||
* Attributes, Context)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...cubator/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedDoubleHistogram.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.metrics; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.DoubleHistogram; | ||
import io.opentelemetry.context.Context; | ||
|
||
/** Extended {@link DoubleHistogram} with experimental APIs. */ | ||
public interface ExtendedDoubleHistogram extends DoubleHistogram { | ||
|
||
/** | ||
* Returns {@code true} if the histogram is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #record(double)}, {@link #record(double, Attributes)}, or {@link #record(double, | ||
* Attributes, Context)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...tor/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedDoubleUpDownCounter.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.metrics; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.DoubleUpDownCounter; | ||
import io.opentelemetry.context.Context; | ||
|
||
/** Extended {@link DoubleUpDownCounter} with experimental APIs. */ | ||
public interface ExtendedDoubleUpDownCounter extends DoubleUpDownCounter { | ||
|
||
/** | ||
* Returns {@code true} if the up down counter is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #add(double)}, {@link #add(double, Attributes)}, or {@link #add(double, | ||
* Attributes, Context)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
api/incubator/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedLongCounter.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,27 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.metrics; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.DoubleCounter; | ||
import io.opentelemetry.api.metrics.LongCounter; | ||
import io.opentelemetry.context.Context; | ||
|
||
/** Extended {@link DoubleCounter} with experimental APIs. */ | ||
public interface ExtendedLongCounter extends LongCounter { | ||
|
||
/** | ||
* Returns {@code true} if the counter is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #add(long)}, {@link #add(long, Attributes)}, or {@link #add(long, Attributes, | ||
* Context)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
api/incubator/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedLongGauge.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.metrics; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.LongGauge; | ||
import io.opentelemetry.context.Context; | ||
|
||
/** Extended {@link LongGauge} with experimental APIs. */ | ||
public interface ExtendedLongGauge extends LongGauge { | ||
|
||
/** | ||
* Returns {@code true} if the gauge is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #set(long)}, {@link #set(long, Attributes)}, or {@link #set(long, Attributes, | ||
* Context)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...incubator/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedLongHistogram.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.metrics; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.LongHistogram; | ||
import io.opentelemetry.context.Context; | ||
|
||
/** Extended {@link LongHistogram} with experimental APIs. */ | ||
public interface ExtendedLongHistogram extends LongHistogram { | ||
|
||
/** | ||
* Returns {@code true} if the histogram is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #record(long)}, {@link #record(long, Attributes)}, or {@link #record(long, | ||
* Attributes, Context)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...bator/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedLongUpDownCounter.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.metrics; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.metrics.LongUpDownCounter; | ||
import io.opentelemetry.context.Context; | ||
|
||
/** Extended {@link LongUpDownCounter} with experimental APIs. */ | ||
public interface ExtendedLongUpDownCounter extends LongUpDownCounter { | ||
|
||
/** | ||
* Returns {@code true} if the up down counter is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #add(long)}, {@link #add(long, Attributes)}, or {@link #add(long, Attributes, | ||
* Context)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
api/incubator/src/main/java/io/opentelemetry/api/incubator/trace/ExtendedTracer.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,23 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.incubator.trace; | ||
|
||
import io.opentelemetry.api.trace.Tracer; | ||
|
||
/** Extended {@link Tracer} with experimental APIs. */ | ||
public interface ExtendedTracer extends Tracer { | ||
|
||
/** | ||
* Returns {@code true} if the tracer is enabled. | ||
* | ||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because | ||
* the response is subject to change over the application, callers should call this before each | ||
* call to {@link #spanBuilder(String)}. | ||
*/ | ||
default boolean isEnabled() { | ||
return true; | ||
} | ||
} |
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
Oops, something went wrong.