Commit Graph

106 Commits (3422e7338c4daa7fa981d313d29351f995eb71f9)

Author SHA1 Message Date
Christopher Serr 3422e7338c Match stable Semantic Conventions for HTTP Spans
The stable [Semantic Conventions for HTTP
Spans](https://opentelemetry.io/docs/specs/semconv/http/http-spans/) use
different keys than the ones used in this crate. This changes them to
match the keys as defined by the stable specification.
2024-04-10 09:55:52 +01:00
Ethan Brierley 94a38211f7
feat!: prepare breaking release (#143) 2024-04-10 09:55:41 +01:00
Ethan Brierley e778b7df11
chore: revert change switching from `Arc` to `Box` in public APIs (#142)
fixes #139

There are other potential long term solutions listed [here](https://github.com/TrueLayer/reqwest-middleware/issues/139#issuecomment-2045946644)

> I didn't put much thought into it. Internally there used to be a `Box<[Arc<dyn Middleware>]>` which is cloned about quite often.
>
> * https://docs.rs/reqwest-middleware/0.2.5/src/reqwest_middleware/client.rs.html#87
> * https://docs.rs/reqwest-middleware/0.2.5/src/reqwest_middleware/client.rs.html#139
>
> Because of all the cloning, I decided to flip it to be `Arc<Box>` instead of `Box<Arc>`.
>
> I see three solutions here.
>
> 1. The one I'd lean towards is `Arc<Arc>` even if it's a bit silly, but prevents extra unnecessary allocations on each request.
> 2. An alternative is to implement Middleware for Arc and then you can use the regular with(...) api. This would mean there's an extra box around your middleware
> 3. Revert this particular change

In the short term, I think it's best to go with option 3. This will unblock the next release. We can consider the other options for future releasees
2024-04-10 09:30:17 +01:00
Ethan Brierley 0bdb2b6ef4
feat!: upgrade to matchit `0.8.0` (#140)
A copy of #134 but just with the matchit upgrade.

Thank you @matiu2 for raising the original PR
2024-04-10 09:05:51 +01:00
Ethan Brierley cb083ad66e
Revert "Init dependabot (#116)" (#138)
This reverts commit 79dbb2d194.
2024-04-05 14:19:05 +01:00
Ethan Brierley 938a3a0e3c
chore: `cargo-fmt` 2024-04-03 18:23:30 +01:00
Conrad Ludgate 60212ae451
reqwest 0.12 and other breaking changes (#135)
* update reqwest and http crates

remove task_local_extensions

* remove older opentelemetry packages

* remove more legacy and add new otel

* attempt to make features additive

* features are additive

* delete commented out code

* build split

* docs

* more uniform with reqwest::Client

* remove arcs

* slight optimisation

* update readmes

* update changelog
2024-04-03 18:13:10 +01:00
Ethan Brierley 69269e183a
chore(request-middleware): release patch version 🚀 (#131) 2024-03-15 16:27:00 +00:00
Ethan Brierley a7df7657e6
chore(request-tracing): release patch version 🚀 (#123) 2024-03-15 16:26:17 +00:00
dependabot[bot] 89ce2efb88
Bump actions/checkout from 2 to 4 (#125)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 16:18:36 +00:00
Pohan 0edce5364e
Update reqwest version to 0.11.10 (#115)
* Update reqwest version to 0.11.10

* chore: udpate the correct version

---------

Co-authored-by: Ethan Brierley <ethan.brierley@truelayer.com>
2024-03-15 16:18:04 +00:00
Vasiliy Taranov 79dbb2d194
Init dependabot (#116) 2024-03-12 15:10:38 +00:00
Vasiliy Taranov 2a3f239a05
fix typos, add github action (#122) 2024-03-12 15:10:18 +00:00
Ethan Brierley d20903e2f7
fix(reqwest-tracing): fix missing deps (#124)
Missed in https://github.com/TrueLayer/reqwest-middleware/pull/118
2024-03-12 15:03:25 +00:00
Robert Collins d44458f402
Support opentelemetry 0.22 (#118) 2024-03-11 17:04:51 +00:00
Ethan Brierley b53d355aea
chore!(reqwest-retry): bump minor version 🚀 2024-03-05 12:10:10 +00:00
bbaldino 4bdf56f2e0
Adapt to retry-policies changes (#113) 2024-03-05 12:05:19 +00:00
Pro 8d40b60776
Fix typo in readme (#117) 2024-02-23 08:53:40 +00:00
Ethan Brierley 1c31f4bc7f
chore!(reqwest-tracing): bump patch version 🚀 2024-01-21 20:04:58 +00:00
Julian Tescher 32cc268f07
Add support for `opentelemetry` version `0.21` (#112)
* Add support for `opentelemetry` version `0.21`

* Fix tracer provider import
2024-01-19 11:17:54 +00:00
Ethan Brierley d297b1c5df
chore: `cargo fmt` 2023-11-07 09:59:22 +00:00
Jan Srzednicki b7017dca6f
Document using `tokio::time::sleep` (#111)
* Document using `tokio::time::sleep`

* Update reqwest-retry/src/middleware.rs

---------

Co-authored-by: Ethan Brierley <ethanboxx@gmail.com>
2023-11-07 09:35:16 +00:00
Ethan Brierley 304d6f1ebc
ci: fix `rustdoc::redundant_explicit_links` (#110) 2023-10-24 10:50:53 +01:00
Ari de1b651bcc
add fetch_mode_no_cors_method (#108)
* add fetch_mode_no_cors_method

* Update changelog

* Bump verion
2023-10-24 10:39:06 +01:00
Tom Milligan efdd52f2fa
readme: add link to reqwest-chain crate (#103) 2023-09-12 11:45:07 +01:00
Thom Wright 7eb52bbe65
[EWT-319] Upgrade retry-policies (#104) 2023-09-08 10:22:46 +01:00
tl-rodrigo-gryzinski f1e71bef3c
Disable wasm tests and add warning to README (#105) 2023-09-07 14:46:53 +01:00
tl-rodrigo-gryzinski c2d477edae
[reqwest-retry] Patch release (#102) 2023-08-30 13:15:36 +01:00
Ethan Brierley a54319a9d6
Patch release `v0.4.6` 🚀 (#100)
* Add support for OpenTelemetry v0.20

* Add back dev-deps

* Attempt at tests

* Update reqwest-tracing/src/otel.rs

* Update reqwest-tracing/src/otel.rs

* Update reqwest-tracing/Cargo.toml

* Update reqwest-tracing/CHANGELOG.md
2023-08-23 12:34:20 +01:00
Conrad Ludgate 7b3493d96c
add opentelementry 0.20 support (#101) 2023-08-23 11:49:15 +01:00
Ethan Brierley a530ea7f93
Cut `reqwest-middleware` patch release `0.2.3 (#98) 2023-08-07 10:50:56 +01:00
Oleh Martsokha 31f8aebce4
Impl reqwest::Error methods (#96)
* impl reqwest::Error methods

* update changelog

* use reqwest::StatusCode

* typo

* consistent comments

* fn is_middleware()
2023-08-07 10:34:01 +01:00
Conrad Ludgate b8b9400858
disable context propagation (#94)
* disable context propagation

* bump version

* removes leftover feature

* fix new test

* add back disabled test
2023-06-20 18:07:12 +01:00
Rutger 594075583c
Added a way to specify custom functions which decide whether a request should be retried or not (#33)
* Add a generic function to the middleware struct for the `Retryable` decision.

The generic function can be used to define custom behaviour to decide whether to retry a request or not.

By default, this function is `Retryable::from_reqwest_response` which is the same as it was before.

* Add a way to create custom retry policies.

A RetryStrategy will dictate what decision will be made based on the result of the sent request.

* Add RetryableStrategy in the `RetryTransientMiddleware` struct instead of the seperate functions

* Add constructor to create a `RetryTransientMiddleware` with a custom `RetryableStrategy`

* Run `cargo fmt`

* Add example code to the `RetryableStrategy` struct

* Run `cargo fmt`

* Updated changelog

* use a trait

* docs

* include latest changes

Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
2023-05-22 11:53:31 +01:00
Conrad Ludgate fb7a964ba3
add default_span_name helper function (#93) 2023-05-15 14:55:56 +01:00
Conrad Ludgate 385314a298
fix otel status (#92)
* fix otel status

* bump
2023-05-15 11:45:55 +01:00
Alex Wakefield af1080f21c
Move path matching changes to right log (#91)
* doc: move path matching changes to right log

* update

---------

Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
2023-05-12 11:16:42 +01:00
Conrad Ludgate 80d56d89f3
release middleware 2023-05-11 14:17:05 +01:00
Jeramy Singleton d5e71a0c89
Added version function to RequestBuilder impl (#90)
* Adds version function to RequestBuilder impl

Addresses an issue where the Http version of a request cannot be changed when using reqwest_middleware

* Removes  function from wasm compiles

---------

Co-authored-by: Jeramy Singleton <wisingle@microsoft.com>
2023-05-11 13:30:15 +01:00
Alex Wakefield 3457bf5702
Add `OtelPathNames` for span names (#89)
* feat: add `OtelPathNames` for span names

If this extension is provided span names will be `<method> <path name>`.
These path names will include parameter names rather than IDs or other elements that would increase the cardinality.

* doc: update changelog

* refactor: update `known_paths` to return error

* refactor: return `anyhow::Error` instead

This is as `reqwest_middleware::Error` is more focused on handling a
request.
2023-04-26 15:28:32 +01:00
Matthew Gapp f8ff599f50
fix: remove middleware retry limit (#87)
* refactor: Simplify retry middleware in reqwest.

Removed retry limit:

- Remove MAXIMUM_NUMBER_OF_RETRIES metadata and references in middleware.rs
- Correct mispelling: retry_decision to retry_decision in middleware.rs
- Update Retryable matching to only match Retryable::Transient in middleware.rs
- Simplify branching by removing n_past_retries < MAXIMUM_NUMBER_OF_RETRIES condition in middleware.rs

* test: Remove retry cap assertion from test file

remove retry limit assertion test
2023-04-17 13:02:13 +01:00
Léo Gaspard fef18b3506
feat: wasm32-unknown-unknown support (#79)
* feat: wasm32-unknown-unknown support

This replaces task-local-extensions with http's extensions, as http was
already in the dependency closure anyway and the other features of
task-local-extensions (that required an incompatible-with-wasm part of
tokio) were not used anyway.

* feat: have ci check that wasm32-unknown-unknown keeps compiling

* revert back to task-local-extensions

* fix ci

* fix random on wasm

* fix ci again

* bump

---------

Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
2023-03-09 11:33:13 +00:00
tl-helge-hoff f854725791
feat: classify io error connection reset by peer (#78)
* feat: classify io error connection reset by peer

* doc: explain tests

* chore: add changelog

* fix: use and_then

* chore: docs and clippy

* chore: bump reqwest-retry to 0.2.1

* fix: use get_source_error_type

* fix: remove unused import

* fix: make clippy happy

* doc: describe canceled
2022-12-02 10:57:24 +01:00
John Vandenberg 8763ab1e30
README.md: Add third party middleware list (#75) 2022-11-23 11:20:21 +00:00
John Vandenberg a7f9a112ed
Update example in tracing README (#76) 2022-11-23 07:39:54 +00:00
Conrad Ludgate 289bb0452c
bump all versions (#71) 2022-11-15 10:31:34 +00:00
tl-rodrigo-gryzinski 197f19781d
Make http.url field opt-in (#70) 2022-11-10 13:21:07 +00:00
Robert Collins 4fb158f785
Fix indents in Changelog. (#67) 2022-11-07 14:23:43 +00:00
Balaji Arun 2e57e95f99
Borrow self when try_clone and clone inner client. (#60)
Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
2022-11-07 13:14:02 +00:00
Robert Collins 07d154cadf
Custom otel names (#65)
* Breaking change(macros): require explicit name for tracing middleware

Closes: #52

This is suggested by the Opentelemetry spec, which requires "Therefore,
HTTP client spans SHOULD be using conservative, low cardinality names
formed from the available parameters of an HTTP request, such as "HTTP
{METHOD_NAME}". Instrumentation MUST NOT default to using URI path as
span name, but MAY provide hooks to allow custom logic to override the
default span name.
"

* Permit customisation of otel span names via OtelName
2022-11-07 13:07:23 +00:00