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

X-Request-Id support #190

Open
jace opened this issue Apr 17, 2018 · 0 comments
Open

X-Request-Id support #190

jace opened this issue Apr 17, 2018 · 0 comments

Comments

@jace
Copy link
Member

jace commented Apr 17, 2018

To facilitate log correlation, Baseframe must check for the X-Request-Id header in incoming requests and play it back in the outgoing response. If the header is missing in incoming (Nginx must provide it), it must be generated.

In API calls, the caller may provide this header, so it could originate even before Nginx. This requires the header to be sanitised as downstream uses (PostgreSQL) may have limitations on what it can contain. Our expected use case is a UUID1 or UUID4. (Caveat: since third party values are not guaranteed unique, we may want to treat it as a distinct X-Correlation-Id header and log both.)

PostgreSQL does not support such a header, but instead supports a set application_name command that can be issued at the beginning of a connection. This value can be included in logs. Assuming it is safe to issue this command on every transaction, Baseframe must facilitate this via a SQLAlchemy signal.

In addition:

  1. If Flask supports this header in any way, such built in support must be used.
  2. SQLAlchemy is not known to support this, so we have to add our patches.
  3. Coaster's error logging must include this.
  4. Hasjob's event logging must support this.
  5. The id must be included in HTML pages as a data header on the body element for future uses. Error pages may want to include it as visible element to facilitate customer support (for example, a mailto link to support with this id included in the subject).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant