Skip to content

Commit

Permalink
Add opentelemetry 0.23 feature, crates and tests (#163)
Browse files Browse the repository at this point in the history
* Add opentelemetry 0.23 feature and crates

* Add cargo deny

* Update CHANGELOG and bump version
  • Loading branch information
cottinisimone committed Jul 4, 2024
1 parent 8a2ba62 commit a93b186
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 45 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ jobs:
- run: rustup toolchain install 1.72.0
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-make
- uses: taiki-e/install-action@cargo-deny
- run: cargo make fmt-check
- run: cargo make clippy
- run: cargo make deny-check
- run: cargo make docs
test:
# Avoid duplicate jobs on PR from a branch on the same repo
Expand All @@ -36,4 +38,4 @@ jobs:
- lint
- test
steps:
- run: ${{ !contains(needs.*.result, 'failure') }}
- run: ${{ !contains(needs.*.result, 'failure') }}
128 changes: 87 additions & 41 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

---

## [0.16.4] - 2024-07-04

### Added

- Support for opentelemetry 0.23, now the default version.
- `tracing_opentelemetry_0_23` feature

---

## [0.16.3] - 2024-05-22

### Fixed

- The authority server successful response might not include the `scope` field, that is now optional.
- The authority server successful response might not include the `scope` field,
that is now optional.

---

Expand All @@ -23,9 +34,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Support for opentelemetry 0.22
- `tracing_opentelemetry_0_22` feature
- `tracing_opentelemetry` is now an alias for the latest version of otel(so `tracing_opentelemetry_0_22`)
- `tracing_opentelemetry` is now an alias for the latest version of otel(so
`tracing_opentelemetry_0_22`)

Opentelemetry 0.20 or 0.21 support can be enabled by enabling the `tracing_opentelemetry_0_20` or `tracing_opentelemetry_0_21` features respectively instead of tracing_opentelemetry.
Opentelemetry 0.20 or 0.21 support can be enabled by enabling the
`tracing_opentelemetry_0_20` or `tracing_opentelemetry_0_21` features
respectively instead of tracing_opentelemetry.

---

Expand All @@ -44,18 +58,21 @@ Opentelemetry 0.20 or 0.21 support can be enabled by enabling the `tracing_opent

- Support for opentelemetry 0.21
- `tracing_opentelemetry_0_20` and `tracing_opentelemetry_0_21` features
- `tracing_opentelemetry` is now an alias for the latest version of otel(so `tracing_opentelemetry_0_21`)
- `tracing_opentelemetry` is now an alias for the latest version of otel(so
`tracing_opentelemetry_0_21`)

Opentelemetry 0.20 support can be enabled by enabling the `tracing_opentelemetry_0_20` feature instead of tracing_opentelemetry.
We are going to support at least the last 3 versions of opentelemetry. After that we mightremove support for older otel version without it being a breaking change.
Opentelemetry 0.20 support can be enabled by enabling the
`tracing_opentelemetry_0_20` feature instead of tracing_opentelemetry. We are
going to support at least the last 3 versions of opentelemetry. After that we
mightremove support for older otel version without it being a breaking change.

---

## [0.15.1] - 2023-10-20

### Added

- `scope` for auth0 token request
- `scope` for auth0 token request

---

Expand Down Expand Up @@ -91,7 +108,8 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### Changed

- Updates Auth0 token refresh logic to reduce the number of token renewals (#122)
- Updates Auth0 token refresh logic to reduce the number of token renewals
(#122)

---

Expand All @@ -105,40 +123,54 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### Added

- Introduced the new `redis-tls` feature that enables the tls authentication for the redis client
- Introduced the new `redis-tls` feature that enables the tls authentication for
the redis client

## [0.14.1] - 2022-09-28

### Added

- Reintroduced `{RestRequest, GraphQLRequest}.get_body` for public use.
The method was publicly accessible before 0.14.0 but was undocumented and meant only for internal use.
- Added `BridgeBuilder.with_redirect_policy` to specify how the Bridge should handle HTTP redirects
- Reintroduced `{RestRequest, GraphQLRequest}.get_body` for public use.\
The method was publicly accessible before 0.14.0 but was undocumented and
meant only for internal use.
- Added `BridgeBuilder.with_redirect_policy` to specify how the Bridge should
handle HTTP redirects

---

## [0.14.0] - 2022-09-26

### Added

- Added the ability to send files via REST multipart requests by using the new `RestRequest.multipart_body` method.
- Added the ability to send files via REST multipart requests by using the new
`RestRequest.multipart_body` method.\
Refer to the example in the repository to see how to use the new APIs.
- Added `{RestRequest, GraphQLRequest}.with_custom_header` to set a single custom header for a request
- Added `{RestRequest, GraphQLRequest}.with_custom_header` to set a single
custom header for a request

### Changed

- **(BREAKING)** `Multipart` has been renamed into `GraphQLMultipart` to avoid ambiguity with `RestMultipart`
- `MultipartFile::new` now accepts anything that can be converted into a `Body` instead of just a `Vec<u8>`.
This allows to provide the file content from a stream, which can be useful in case you want to send a file, but you don't want to load it in memory all at once.
- To better support this use case, a [tokio::fs::File](https://docs.rs/tokio/latest/tokio/fs/struct.File.html) can now be converted into a `Body` too
- **(BREAKING)** `Multipart` has been renamed into `GraphQLMultipart` to avoid
ambiguity with `RestMultipart`
- `MultipartFile::new` now accepts anything that can be converted into a `Body`
instead of just a `Vec<u8>`.\
This allows to provide the file content from a stream, which can be useful in
case you want to send a file, but you don't want to load it in memory all at
once.
- To better support this use case, a
[tokio::fs::File](https://docs.rs/tokio/latest/tokio/fs/struct.File.html)
can now be converted into a `Body` too
- Reduced cloning and allocations throughout the library
- Re-exported more types at the top level of the crate

### Removed

- **(BREAKING)** `{RestRequest, GraphQLRequest}.add_custom_headers` and `set_custom_headers`: use `with_custom_headers` instead
- `(GraphQL)Multipart.into_form`: it is a private API that wasn't meant to be exported publicly
- `async` feature: it was enabled by default and disabling it caused compilation to break
- **(BREAKING)** `{RestRequest, GraphQLRequest}.add_custom_headers` and
`set_custom_headers`: use `with_custom_headers` instead
- `(GraphQL)Multipart.into_form`: it is a private API that wasn't meant to be
exported publicly
- `async` feature: it was enabled by default and disabling it caused compilation
to break

---

Expand All @@ -154,7 +186,8 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### Changed

- removed `block_modes` deprecated dependency in favour of the new `cbc` dependency
- removed `block_modes` deprecated dependency in favour of the new `cbc`
dependency
- broaden the dependency on uuid to support 1.x versions

---
Expand All @@ -163,19 +196,23 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### Removed

- `blocking` feature. The library is now async only. (*breaking change*)
- `blocking` feature. The library is now async only. (_breaking change_)
- the old `new` and `with_user_agent` functions deprecated in 0.7.3

### Added

- graphql multipart request as specified [here](https://github.com/jaydenseric/graphql-multipart-request-spec).
- examples for rest, graphql, graphql multipart and generic request with auth0 authentication.
- graphql multipart request as specified
[here](https://github.com/jaydenseric/graphql-multipart-request-spec).
- examples for rest, graphql, graphql multipart and generic request with auth0
authentication.

---

## [0.11.0]

- opentelemetry updated to version 0.17. **Careful!!!** The opentelemetry version in your project should match the one in this library (*breaking change*)
- opentelemetry updated to version 0.17. **Careful!!!** The opentelemetry
version in your project should match the one in this library (_breaking
change_)
- various dependency updates
- removed log dependency, use tracing everywhere

Expand Down Expand Up @@ -210,14 +247,16 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

## [0.8.0]

- added new function `with_auth0` in bridge builder. This enables jwt authentication to called endpoint.
- added new function `with_auth0` in bridge builder. This enables jwt
authentication to called endpoint.

---

## [0.7.3]

- deprecated the `new` and `with_user_agent` functions in favor of a builder
- opentelemetry updated to version 0.16. **Careful!!!** The opentelemetry version in your project should match the one in this library
- opentelemetry updated to version 0.16. **Careful!!!** The opentelemetry
version in your project should match the one in this library
- several dependencies updated
- docker file based on Rust 1.54

Expand All @@ -228,7 +267,8 @@ We are going to support at least the last 3 versions of opentelemetry. After tha
### features

- fixes the double header issue (#17)
- adds support for the ```gzip``` feature, which decompress the response content based on the content-type header
- adds support for the `gzip` feature, which decompress the response content
based on the content-type header
- proper handling of graphql errors with a new `ParsedGraphqlResponse` type
- adds ability to specify a request timeout

Expand All @@ -238,7 +278,8 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### breaking change

- opentelemetry updated to version 0.13. **Careful!!!** The opentelemetry version in your project should match the one in this library
- opentelemetry updated to version 0.13. **Careful!!!** The opentelemetry
version in your project should match the one in this library
- several dependencies updated
- docker file based on Rust 1.51

Expand All @@ -248,7 +289,8 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### breaking change

- opentelemetry updated to version 0.12. **Careful!!!** The opentelemetry version in your project should match the one in this library
- opentelemetry updated to version 0.12. **Careful!!!** The opentelemetry
version in your project should match the one in this library
- several dependencies updated

### bugfix
Expand Down Expand Up @@ -277,8 +319,11 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### breaking change

- opentelemetry updated to version 0.11. **Careful!!!** The opentelemetry version in your project should match the one in this library
- tracing-opentelemetry updated to version 0.10. **Careful!!!** The tracing-opentelemetry version in your project should match the one in this library
- opentelemetry updated to version 0.11. **Careful!!!** The opentelemetry
version in your project should match the one in this library
- tracing-opentelemetry updated to version 0.10. **Careful!!!** The
tracing-opentelemetry version in your project should match the one in this
library

---

Expand All @@ -294,19 +339,22 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### breaking change

- opentelemetry updated to version 0.10.0. **Careful!!!** The opentelemetry version in your project should match the one in this library
- opentelemetry updated to version 0.10.0. **Careful!!!** The opentelemetry
version in your project should match the one in this library

---

## [0.3.0]

### features

- adds support for raw body response ([PR #21](https://github.com/primait/bridge.rs/pull/21))
- adds support for raw body response
([PR #21](https://github.com/primait/bridge.rs/pull/21))

### breaking change

- removed the bridge.request api (deprecated) in favor of `Request::get` or `RestRequest::new` and `GraphQLRequest::new` functions.
- removed the bridge.request api (deprecated) in favor of `Request::get` or
`RestRequest::new` and `GraphQLRequest::new` functions.

---

Expand Down Expand Up @@ -346,7 +394,8 @@ We are going to support at least the last 3 versions of opentelemetry. After tha

### features

- adds the ability to use a binary as the body of a request. The api has changed:
- adds the ability to use a binary as the body of a request. The api has
changed:

**before**

Expand All @@ -365,9 +414,6 @@ Request::rest(&bridge).send()

The old API is still available but deprecated. It will be removed soon.




[Unreleased]: https://github.com/primait/bridge.rs/compare/0.16.3...HEAD
[0.16.3]: https://github.com/primait/bridge.rs/compare/0.16.2...0.16.2
[0.16.2]: https://github.com/primait/bridge.rs/compare/0.16.1...0.16.2
Expand Down
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "MIT"
name = "prima_bridge"
readme = "README.md"
repository = "https://github.com/primait/bridge.rs"
version = "0.16.3"
version = "0.16.4"
# See https://github.com/rust-lang/rust/issues/107557
rust-version = "1.72"

Expand All @@ -16,11 +16,12 @@ default = ["tracing_opentelemetry"]
auth0 = ["rand", "redis", "jsonwebtoken", "jwks_client_rs", "chrono", "aes", "cbc", "dashmap", "tracing"]
gzip = ["reqwest/gzip"]
redis-tls = ["redis/tls", "redis/tokio-native-tls-comp"]
tracing_opentelemetry = [ "tracing_opentelemetry_0_22" ]
tracing_opentelemetry = [ "tracing_opentelemetry_0_23" ]

tracing_opentelemetry_0_20 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_21_pkg", "opentelemetry_0_20_pkg"]
tracing_opentelemetry_0_21 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_22_pkg", "opentelemetry_0_21_pkg", "opentelemetry_sdk_0_21_pkg"]
tracing_opentelemetry_0_22 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_23_pkg", "opentelemetry_0_22_pkg", "opentelemetry_sdk_0_22_pkg"]
tracing_opentelemetry_0_23 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_24_pkg", "opentelemetry_0_23_pkg", "opentelemetry_sdk_0_23_pkg"]

_any_otel_version = []

Expand Down Expand Up @@ -51,11 +52,14 @@ http = "1.0.0"
opentelemetry_0_20_pkg = { package = "opentelemetry", version = "0.20", optional = true }
opentelemetry_0_21_pkg = { package = "opentelemetry", version = "0.21", optional = true }
opentelemetry_0_22_pkg = { package = "opentelemetry", version = "0.22", optional = true }
opentelemetry_0_23_pkg = { package = "opentelemetry", version = "0.23", optional = true }
opentelemetry_sdk_0_21_pkg = { package = "opentelemetry_sdk", version = "0.21", optional = true }
opentelemetry_sdk_0_22_pkg = { package = "opentelemetry_sdk", version = "0.22", optional = true }
opentelemetry_sdk_0_23_pkg = { package = "opentelemetry_sdk", version = "0.23", optional = true }
tracing-opentelemetry_0_21_pkg = { package = "tracing-opentelemetry", version = "0.21", optional = true }
tracing-opentelemetry_0_22_pkg = { package = "tracing-opentelemetry", version = "0.22", optional = true }
tracing-opentelemetry_0_23_pkg = { package = "tracing-opentelemetry", version = "0.23", optional = true }
tracing-opentelemetry_0_24_pkg = { package = "tracing-opentelemetry", version = "0.24", optional = true }

[dev-dependencies]
flate2 = "1.0"
Expand Down
Loading

0 comments on commit a93b186

Please sign in to comment.