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

feature request: Set http client #132

Open
dennypenta opened this issue Sep 4, 2024 · 3 comments
Open

feature request: Set http client #132

dennypenta opened this issue Sep 4, 2024 · 3 comments
Assignees
Labels
feature Cool stuff

Comments

@dennypenta
Copy link

What problem did you meet?

Injecting a http client as a dependency is necessary for observability and the others purposes.
For instance, in order to send a trace to OTLP trace provider we have to use our implementation of http.Client with custom http.Transport.

Describe what you'd like Logto to have

There are following options to achieve it:

func WithHttpClient(c *http.Client) func(*LogtoClient) {
  return func(logtoClient *LogtoClient) {
    logtoClient.httpClient = c
  }
}
  • Add a setter for http.Client, In my opinion it shouldn't be thread safe, the client must be instantiate on the dependencies build step
func (logtoClient *LogtoClient) SetHttpClient(c *http.Client) {
  logtoClient.httpClient = c
}
@xiaoyijun
Copy link
Collaborator

Hi @dennypenta , thanks for your feedback, I will take a look.

@xiaoyijun xiaoyijun self-assigned this Sep 18, 2024
@xiaoyijun xiaoyijun added the feature Cool stuff label Sep 18, 2024
@dennypenta
Copy link
Author

hi @xiaoyijun
appreciate to hear any news.
it's quite minor change and it blocks to setup OTEL, the only option is to use my custom client or fork the sdk

@xiaoyijun
Copy link
Collaborator

Hi @dennypenta ,

Sorry for the delayed response! I said I would look into it but haven't had the chance to implement this yet.

Since you have a clear vision of how this feature should work and have already proposed some good solutions (like the functional options pattern), would you be interested in contributing this feature yourself? Your contribution would be greatly appreciated and would help other users who need OTEL integration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Cool stuff
Development

No branches or pull requests

2 participants