-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
don't throw class cast exception when we have a noop tracer, meter, logger #6617
Merged
jack-berg
merged 12 commits into
open-telemetry:main
from
zeitlinger:avoid-class-cast-exception
Sep 5, 2024
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8475095
don't throw class cast exception when we have a noop tracer
zeitlinger 96fea45
use reflection to load incubating noop apis if available
zeitlinger 807157c
add tests
zeitlinger 46ac766
use reflection to load incubating noop apis if available
zeitlinger a44c930
use reflection to load incubating noop apis if available
zeitlinger c39c70e
test graal with and without incubating
zeitlinger 0289719
don't load class that doesn't exist
zeitlinger a46f3e4
javadoc
zeitlinger 516d92f
reduce visibility
zeitlinger a95e6ff
format
zeitlinger 49d1b0e
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
jack-berg e7d7114
fix build
jack-berg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first usage of java-test-fixtures in this repo. I kind of like it, but would be good to update
otel.java-conventions.gradle.kts
to include all the standard test dependencies:https://github.com/open-telemetry/opentelemetry-java/blob/main/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts#L237-L270
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you give me a hint how to do that?
fixtures {
or similar doesn't exist