Skip to content

Add ability to modify middleware via a configured callback. #14 #33

Open
aglassman wants to merge 1 commit intoknocklabs:mainfrom
KGG-Inc:main
Open

Add ability to modify middleware via a configured callback. #14 #33
aglassman wants to merge 1 commit intoknocklabs:mainfrom
KGG-Inc:main

Conversation

@aglassman
Copy link
Copy Markdown
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 

@oliver-kriska
Copy link
Copy Markdown
Contributor

any update about this please?

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

2 participants