Skip to content

Conversation

@starfy84
Copy link
Contributor

@starfy84 starfy84 commented Aug 1, 2025

Closes: DX-1642

This PR merges beta changes into the master branch, publishing the beta packages to the latest version

starfy84 and others added 4 commits July 18, 2025 12:43
…uter

This commit implements `opentelemetry` instrumentation for the `decode` and `sendEncoded` calls in `wrapRouter`.

Changes:
- `typed-express-wrapper`
  - `@opentelemetry/api@^1.0.0` added as an optional peer dependency
  - `@opentelemetry/sdk-trace-base@1.30.1` , `@opentelemetry/sdk-trace-node@1.30.1`, and `@opentelemetry/api@1.9.0` added as dev dependencies
  - `wrapRouter` modified to create decode and encode spans if `@opentelemetry/api` is installed
    - if `@opentelemetry/api` is not installed, spans are not created
  - `onDecodeError` option removed. Please use `decodeErrorFormatter` and `getDecodeErrorStatusCode`
    - `decodeErrorFormatter` takes in an array of `ValidationError`s and a `WrappedRequest`, returning a `Json` object.
    - `getDecodeErrorStatusCode` takes in an array of `ValidationError`s and a `WrappedRequest`, returning a number.
  - `onEncodeError` option removed. Please use `encodeErrorFormatter` and `getEncodeErrorStatusCode`
    - `encodeErrorFormatter` takes in an error and a `WrappedRequest`, returning a `Json` object.
    - `getEncodeErrorStatusCode` takes in an error and a `WrappedRequest`, returning a number.
  - `typed-express-router` now handles the sending of the http response when there is a decode or encode error
- `express-wrapper`
  - `routerForApiSpec` modified to pass in new parameters `decodeErrorFormatter`, `getDecodeErrorStatusCode`, `encodeErrorFormatter`, and `getEncodeErrorStatusCode`
    - These new parameters can also be customized by modifying the props passed into the function (see `CreateRouterProps`)

BREAKING CHANGE: `onDecodeError` and `onEncodeError` have been removed. Please use `decodeErrorFormatter`, `getDecodeErrorStatusCode`, `encodeErrorFormatter`, and `getEncodeErrorStatusCode`
…yped-express-router

feat(opentelemetry): create otel instrumentation for typed-express-router
docs: update README.md with information regarding new error formatters
@starfy84 starfy84 self-assigned this Aug 1, 2025
@starfy84 starfy84 marked this pull request as ready for review August 1, 2025 18:50
@starfy84 starfy84 requested a review from a team as a code owner August 1, 2025 18:50
Copy link
Contributor

@ericcrosson-bitgo ericcrosson-bitgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merges beta into master. Thanks @starfy84!

@ericcrosson-bitgo ericcrosson-bitgo merged commit 43dee8f into master Aug 1, 2025
7 checks passed
@ericcrosson-bitgo ericcrosson-bitgo deleted the beta branch August 1, 2025 18:56
@github-actions
Copy link

github-actions bot commented Aug 1, 2025

🎉 This PR is included in version @api-ts/typed-express-router@2.0.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Aug 1, 2025

🎉 This PR is included in version @api-ts/express-wrapper@2.0.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version @api-ts/openapi-generator@5.10.2 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants