#78 feat: add request ID threading

Merged Chad Carbert chadian

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 6 files from the diff.
Newly tracked file
src/request-id.ts created.
Other files ignored by Codecov

@@ -0,0 +1,34 @@
Loading
1 +
import * as uuid from 'uuid'
2 +
3 +
export const requestIdHeader = 'Request-Id'
4 +
5 +
// tslint:disable-next-line: no-unnecessary-class
6 +
export class RequestId {
7 +
  static ids: string[] = []
8 +
9 +
  static track(...ids: string[]) {
10 +
    const tracked = RequestId.ids
11 +
    ids = ids.filter(id => !(tracked.includes(id)))
12 +
    RequestId.ids = [...ids, ...tracked]
13 +
    return RequestId.ids
14 +
  }
15 +
16 +
  static create(): string[] {
17 +
    const tracked = RequestId.ids
18 +
    const generatedId = RequestId._generate()
19 +
    RequestId.ids = [generatedId, ...tracked]
20 +
    return RequestId.ids
21 +
  }
22 +
23 +
  static empty(): void {
24 +
    RequestId.ids = []
25 +
  }
26 +
27 +
  static get headerValue() {
28 +
    return RequestId.ids.join(',')
29 +
  }
30 +
31 +
  static _generate() {
32 +
    return uuid.v4()
33 +
  }
34 +
}

Learn more Showing 1 files with coverage changes found.

New file src/request-id.ts
New
Loading file...
Files Coverage
src 0.00%
Project Totals (8 files) 0.00%
Loading