Skip to content

Commit 19af9a3

Browse files
committed
Capture HTTP requests after daemon address is obained
1 parent 01c423d commit 19af9a3

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ async function start(): Promise<void> {
3535
const address = await services.ServiceDiscovery.discoverInstance(namespace, name);
3636

3737
(services.Trace as any).setDaemonAddress(address);
38+
(services.Trace as any).captureHTTPRequests();
3839
}
3940

4041
server.listen(config.port, () => {

src/services/trace/AWSXRay.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import https from 'https';
55
class AWSXRay implements Services.Trace {
66
constructor (plugins: string) {
77
this.setPlugins(plugins);
8-
9-
XRay.captureHTTPsGlobal(http, true);
10-
XRay.captureHTTPsGlobal(https, true);
118
}
129

1310
public openSegment(defaultName: string) {
@@ -63,6 +60,11 @@ class AWSXRay implements Services.Trace {
6360

6461
XRay.config(xrayPlugins);
6562
}
63+
64+
public captureHTTPRequests(): void {
65+
XRay.captureHTTPsGlobal(http, true);
66+
XRay.captureHTTPsGlobal(https, true);
67+
}
6668
}
6769

6870
export default AWSXRay;

src/worker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async function start() {
7676
const address = await services.ServiceDiscovery.discoverInstance(namespace, name);
7777

7878
(services.Trace as any).setDaemonAddress(address);
79+
(services.Trace as any).captureHTTPRequests();
7980
}
8081

8182
logger.info('Upload worker is running');

0 commit comments

Comments
 (0)