Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add x-request-id support for debug rest-api queries #354

Closed
mesilov opened this issue Nov 24, 2023 · 0 comments · Fixed by #355
Closed

add x-request-id support for debug rest-api queries #354

mesilov opened this issue Nov 24, 2023 · 0 comments · Fixed by #355
Assignees
Labels
2.x issue related with 2.x sdk version improve DX developer experience ⏳ WIP work in progress

Comments

@mesilov
Copy link
Owner

mesilov commented Nov 24, 2023

Add an option to set the x-request-id header for debug problem rest-api queries

Request-Id, it's uniquely identifies every HTTP request involved in operation processing, and is generated on the caller side and passed to callee.

Requirements

  1. Autogenerate x-request-id if not set
  2. pass exists x-request-id from different sources: http-query, call args, etc
  3. write x-request-id to existing logs
  4. add x-request-id to the response meta information

Example

Default flow

  1. The user clicks on a button in the Bitrix24 application
  2. Browser send request to server
  3. The server creates a unique x-request-id key and adds it to request headers
  4. The PHP application calls bitrix24-php-sdk and try to request bitrix24 rest-api
  5. SDK find exists x-request-id key and add this key to request headers
  6. Bitrix24 API-GATEWAY finds x-request-id key and writes it in his logs
  7. Bitrix24 send response to bitrix24-php-sdk
  8. bitrix24-php-sdk sign response with this x-request-id key and write it to logs

If a developer needs to investigate some problems in rest-api calls they can send x-request-id key to bitrix24 support and they try to find his request

Default fields in $_SERVER to pass exists request id into sdk

  • HTTP_X_REQUEST_ID
  • UNIQUE_ID

Server configuration

@mesilov mesilov added 2.x issue related with 2.x sdk version improve DX developer experience ⏳ WIP work in progress labels Nov 24, 2023
@mesilov mesilov self-assigned this Nov 24, 2023
@mesilov mesilov changed the title add x-request-id support for debug problem rest-api queries add x-request-id support for debug rest-api queries Nov 24, 2023
@mesilov mesilov linked a pull request Nov 24, 2023 that will close this issue
@mesilov mesilov closed this as completed Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x issue related with 2.x sdk version improve DX developer experience ⏳ WIP work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant