Skip to content
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

Avoid ClassCastException on direct SDK access #931

Merged
merged 1 commit into from
Aug 9, 2020

Conversation

trask
Copy link
Member

@trask trask commented Aug 9, 2020

Closes #336

Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks just some suggestions for more context in messages

if (!messageAlreadyLogged.getAndSet(true)) {
String message =
"direct usage of the OpenTelemetry SDK is not supported when running agent"
+ " (run with debug logging to see stack trace)";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd include the flag here if mentioning debug logging

public Object unobfuscate() {
if (!messageAlreadyLogged.getAndSet(true)) {
String message =
"direct usage of the OpenTelemetry SDK is not supported when running agent"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the concrete operation can provide good context

Direct usage of the OpenTelemetry SDK by calling OpenTelemetrySdk.getTracrProvider() is not...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also maybe a link to how to configure the agent (presumably what they were trying to do).

@iNikem
Copy link
Contributor

iNikem commented Aug 9, 2020

These shaded and unshaded terms are very confusing to me and don't seem natural. Can we replace them with some words that reflect the problem domain, not the solution space?

I mean we have one set of classes that we bring as dependency, right? And another set which application can bring, right? So maybe agent/application or internal/external or something?

@anuraaga
Copy link
Contributor

anuraaga commented Aug 9, 2020

Yeah I think we can address it outside this PR but I agree with @iNikem. Actually, it seems to be the worst of all worlds right now, where unprefixed is shaded, and prefixed is unshaded which is highly unusual. So use-case specific package names like @iNikem suggests would be nice, if there's a technical problem with that, I think swapping so unprefixed is unshaded would be easier to make presentations about :P

@trask
Copy link
Member Author

trask commented Aug 9, 2020

Can we replace them with some words that reflect the problem domain, not the solution space?

Great idea, created #935

@trask trask merged commit 0eda3db into open-telemetry:master Aug 9, 2020
@trask trask deleted the class-cast-exception branch August 9, 2020 18:16
public Object unobfuscate() {
if (!messageAlreadyLogged.getAndSet(true)) {
String message =
"direct usage of the OpenTelemetry SDK is not supported when running agent"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean "not supported"? We don't throw, we don't exist, we have test it place to verify nothing is broken. So what exactly is not supported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not supported means that if you use OpenTelemetrySdk.getTraceProvider(), you won't get back the agent's TraceProvider bridge, and so any telemetry you emit won't get intercepted / correlated / exported by the agent the way we do if you use OpenTelemetry.getTraceProvider() from OpenTelemetry API

@iNikem
Copy link
Contributor

iNikem commented Aug 9, 2020

A! I was too late! :(

@trask
Copy link
Member Author

trask commented Aug 9, 2020

Oh my bad!! I meant to address @anuraaga's comments. Will submit another PR and we can continue discussing there.

@iNikem
Copy link
Contributor

iNikem commented Aug 9, 2020

Can we discuss this during special meeting?

@trask
Copy link
Member Author

trask commented Aug 9, 2020

👍 added special topic meeting to public calendar for Tue Aug 11, 10pm Pacific Time

https://calendar.google.com/event?action=TEMPLATE&tmeid=MnFjajExYW5xdmtsdTRpM2dzZWNqajM0YWEgZ29vZ2xlLmNvbV9iNzllM2U5MGo3YmJzYTJuMnA1YW41bGY2MEBn&tmsrc=google.com_b79e3e90j7bbsa2n2p5an5lf60%40group.calendar.google.com

@trask trask mentioned this pull request Aug 10, 2020
mabdinur pushed a commit to mabdinur/opentelemetry-java-instrumentation that referenced this pull request Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClassCastException when using opentelemetry SDK with auto agent
3 participants