forked from AkkomaGang/akkoma
Take tesla telemetry
This commit is contained in:
parent
0995fa1410
commit
63be819661
2 changed files with 12 additions and 1 deletions
|
@ -65,7 +65,7 @@ def request(method, url, body, headers, options) when is_binary(url) do
|
||||||
options = put_in(options[:adapter], adapter_opts)
|
options = put_in(options[:adapter], adapter_opts)
|
||||||
params = options[:params] || []
|
params = options[:params] || []
|
||||||
request = build_request(method, headers, options, url, body, params)
|
request = build_request(method, headers, options, url, body, params)
|
||||||
client = Tesla.client([Tesla.Middleware.FollowRedirects])
|
client = Tesla.client([Tesla.Middleware.FollowRedirects, Tesla.Middleware.Telemetry])
|
||||||
|
|
||||||
request(client, request)
|
request(client, request)
|
||||||
end
|
end
|
||||||
|
|
|
@ -92,6 +92,17 @@ def metrics do
|
||||||
reporter_options: [
|
reporter_options: [
|
||||||
buckets: [0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 2.5, 5, 10]
|
buckets: [0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 2.5, 5, 10]
|
||||||
]
|
]
|
||||||
|
),
|
||||||
|
distribution(
|
||||||
|
"tesla_request_completed",
|
||||||
|
event_name: [:tesla, :request, :stop],
|
||||||
|
measurement: :duration,
|
||||||
|
tags: [:response_code],
|
||||||
|
tag_values: fn tags -> Map.put(tags, :response_code, tags.env.status) end,
|
||||||
|
unit: {:native, :second},
|
||||||
|
reporter_options: [
|
||||||
|
buckets: [0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 2.5, 5, 10]
|
||||||
|
]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue