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

sdk-exporter: allow passing a custom client to the OtlpSpanExporterAutoConfigure #578

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

iRevive
Copy link
Contributor

@iRevive iRevive commented Apr 1, 2024

No description provided.

@iRevive iRevive added the sdk exporter module Features and improvements to the sdk exporter module label Apr 1, 2024
* @param client
* the custom http4s client to use
*/
def customClient[
Copy link
Contributor Author

Choose a reason for hiding this comment

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

customClient vs overloaded apply 🤔

Copy link

Choose a reason for hiding this comment

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

I like customClient

@iRevive
Copy link
Contributor Author

iRevive commented Apr 1, 2024

@hygt could you take a look, please? Will this API work for your use cases?

import java.net.{InetSocketAddress, ProxySelector}
import java.net.http.HttpClient
import org.http4s.jdkhttpclient.JdkHttpClient

val jdkHttpClient = HttpClient
  .newBuilder()
  .proxy(ProxySelector.of(InetSocketAddress.createUnresolved("localhost", 3312)))
  .build()
  
OpenTelemetrySdk.autoConfigured[IO](
  _.addSpanExporterConfigurer(
    OtlpSpanExporterAutoConfigure.customClient[IO](JdkHttpClient(jdkHttpClient))
  )
).use { sdk =>
  ...
}

@iRevive iRevive requested a review from NthPortal April 1, 2024 17:45
@iRevive iRevive force-pushed the sdk-exporter/otlp-custom-client branch from 10d4f2b to 7c8fe64 Compare April 1, 2024 17:47
@iRevive iRevive changed the title sdk-exporter: allow passing a custom client to the OtlpHttpClient sdk-exporter: allow passing a custom client to the OtlpSpanExporterAutoConfigure Apr 1, 2024
@iRevive iRevive linked an issue Apr 8, 2024 that may be closed by this pull request
@hygt
Copy link

hygt commented Apr 8, 2024

Hi @iRevive sorry for not getting back to you quicker, I kinda missed the notification.

I published your branch locally to try it out in a real app using Skunk, this fulfills my needs perfectly. 👍

@iRevive iRevive merged commit 48f1152 into typelevel:main Apr 9, 2024
10 checks passed
@iRevive iRevive deleted the sdk-exporter/otlp-custom-client branch April 9, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sdk exporter module Features and improvements to the sdk exporter module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proxy support in OtlpHttpClient?
2 participants