-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't throw class cast exception when we have a noop tracer, meter, l…
…ogger (#6617) Co-authored-by: Jack Berg <[email protected]>
- Loading branch information
1 parent
1f6de35
commit f85a57b
Showing
34 changed files
with
1,889 additions
and
536 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
29 changes: 29 additions & 0 deletions
29
api/all/src/main/java/io/opentelemetry/api/internal/IncubatingUtil.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,29 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.api.internal; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Incubating utilities. | ||
* | ||
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change | ||
* at any time. | ||
*/ | ||
public class IncubatingUtil { | ||
private IncubatingUtil() {} | ||
|
||
@SuppressWarnings("unchecked") | ||
public static <T> T incubatingApiIfAvailable(T stableApi, String incubatingClassName) { | ||
try { | ||
Class<?> incubatingClass = Class.forName(incubatingClassName); | ||
Method getInstance = incubatingClass.getDeclaredMethod("getNoop"); | ||
return (T) getInstance.invoke(null); | ||
} catch (Exception e) { | ||
return stableApi; | ||
} | ||
} | ||
} |
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
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
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
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
33 changes: 0 additions & 33 deletions
33
api/all/src/test/java/io/opentelemetry/api/logs/DefaultLoggerProviderTest.java
This file was deleted.
Oops, something went wrong.
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
29 changes: 0 additions & 29 deletions
29
api/all/src/test/java/io/opentelemetry/api/metrics/DefaultMeterProviderTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.