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

Add OtelJava.autoConfigured() #420

Merged
merged 2 commits into from
Jan 18, 2024

Conversation

NthPortal
Copy link
Contributor

No description provided.

@NthPortal NthPortal requested a review from iRevive January 3, 2024 17:33
@iRevive
Copy link
Contributor

iRevive commented Jan 4, 2024

It's a solid addition, thanks!

I guess we should highlight a few cases via Scaladoc notes:

  1. autoConfigured with setResultAsGlobal will fail if there is another instance registered as global
  2. If you rely on the automatic instrumentation via agent you must use global, otherwise you may end up with two instances (depending on the setResultAsGlobal)

@NthPortal
Copy link
Contributor Author

autoConfigured with setResultAsGlobal will fail if there is another instance registered as global

also, because it is a Resource, it will also fail if you attempt to use it more than once, which isn't great

@NthPortal
Copy link
Contributor Author

@iRevive this good?

Copy link
Contributor

@iRevive iRevive left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! One minor question before we can merge.

AutoConfiguredOpenTelemetrySdk => AutoConfigOtelSdk
}
import io.opentelemetry.sdk.autoconfigure.{
AutoConfiguredOpenTelemetrySdkBuilder => AutoConfigOtelSdkBuilder
Copy link
Member

Choose a reason for hiding this comment

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

I thought these aliases appeared in Scaladoc, but proved to myself that's not the case. I don't mind them as long as they don't add any public aliases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

having the type of the function be two lines long was just too much for me

Add `OtelJava.autoConfigured(customize: B => B)` method returning a
`Resource` of an automatically configured `OpenTelemetrySdk`
instance, where `type B = AutoConfiguredOpenTelemetrySdkBuilder`.
@NthPortal
Copy link
Contributor Author

NthPortal commented Jan 18, 2024

build failure after rebase, and I can't repro locally. giving it one more shot until I start poking at the test (SdkSpanBackendSuite .getAttribute(:AttributeKey)) to see if there's a bug or it's flaky or something else

Update: it's flaky!

@NthPortal NthPortal merged commit 25cafa7 into typelevel:main Jan 18, 2024
10 checks passed
@NthPortal NthPortal deleted the OtelJava-autoconfig/PR branch January 18, 2024 00:57
@iRevive iRevive mentioned this pull request Jan 18, 2024
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.

4 participants