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 ability to modify middleware via a configured callback. #14 #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aglassman
Copy link
Contributor

@aglassman aglassman commented Sep 5, 2024

This allows dynamic configuration of the middleware passed to the Tesla client. If a middleware_callback is configured, the middleware is passed to the callback, and may be modified as needed.

This resolves #14

Usage for open telemetry middleware:

# config.exs
config :my_app, MyApp.KnockImpl,
       api_key: System.get_env("KNOCK_API_PRIVATE_KEY"),
       middleware_callback: &MyApp.Tesla.customize_middleware/1
       
# my_app/tesla.exs
defmodule MyApp.Tesla do

  def customize_middleware(middleware), do: [ Tesla.Middleware.OpenTelemetry | middleware]

end 

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.

Telemetry Support
1 participant