From 9e4726cc0356dcc482fe16aa6f6698360255e93e Mon Sep 17 00:00:00 2001 From: Arun Prabhakaran Date: Thu, 13 Jun 2024 16:53:36 +0530 Subject: [PATCH 1/3] fix: fix timeout in aws resource detector (#2186) * fix: fix timeout in aws resource detector Current timeout is 1 sec, which is causing EC2 metadata api request timed out. Increase the timeout to 5 sec. * Updated the timeouts as per comments --------- Co-authored-by: Marc Pichler --- .../src/detectors/AwsEc2Detector.ts | 2 +- .../test/detectors/AwsEc2Detector.test.ts | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEc2Detector.ts b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEc2Detector.ts index cc45e96f1d..5afec499d2 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEc2Detector.ts +++ b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEc2Detector.ts @@ -131,7 +131,7 @@ class AwsEc2Detector implements Detector { const timeoutId = setTimeout(() => { req.abort(); reject(new Error('EC2 metadata api request timed out.')); - }, 1000); + }, this.MILLISECOND_TIME_OUT); const req = http.request(options, res => { clearTimeout(timeoutId); diff --git a/detectors/node/opentelemetry-resource-detector-aws/test/detectors/AwsEc2Detector.test.ts b/detectors/node/opentelemetry-resource-detector-aws/test/detectors/AwsEc2Detector.test.ts index 62375965d1..501d019b59 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/test/detectors/AwsEc2Detector.test.ts +++ b/detectors/node/opentelemetry-resource-detector-aws/test/detectors/AwsEc2Detector.test.ts @@ -109,7 +109,8 @@ describe('awsEc2Detector', () => { scope.done(); }); - it('should throw when timed out', async () => { + it('should throw when timed out', function (done) { + this.timeout(6000); const expectedError = new Error('EC2 metadata api request timed out.'); const scope = nock(AWS_HOST) .put(AWS_TOKEN_PATH) @@ -120,17 +121,21 @@ describe('awsEc2Detector', () => { .reply(200, () => mockedIdentityResponse) .get(AWS_HOST_PATH) .matchHeader(AWS_METADATA_TOKEN_HEADER, mockedTokenResponse) - .delayConnection(2000) + .delayConnection(5000) .reply(200, () => mockedHostResponse); - try { - await awsEc2Detector.detect(); - assert.ok(false, 'Expected to throw'); - } catch (err) { - assert.deepStrictEqual(err, expectedError); - } - - scope.done(); + awsEc2Detector + .detect() + .then(() => { + assert.ok(false, 'Expected to throw'); + }) + .catch(err => { + assert.deepStrictEqual(err, expectedError); + }) + .finally(() => { + scope.done(); + done(); + }); }); it('should throw when replied with an Error', async () => { From 3c71ead22e7668d826fbf4c7c024cb1de4b625ba Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 13 Jun 2024 13:49:13 +0200 Subject: [PATCH 2/3] docs: add contributing guidelines for new instrumentations (#2259) * docs: add contributing guidelines for new instrumentations * Update CONTRIBUTING.md Co-authored-by: Jamie Danielson --------- Co-authored-by: Jamie Danielson --- ..._request.md => instrumentation_request.md} | 13 ++++++-- CONTRIBUTING.md | 33 +++++++++++++++++++ README.md | 1 + 3 files changed, 44 insertions(+), 3 deletions(-) rename .github/ISSUE_TEMPLATE/{plugin_request.md => instrumentation_request.md} (65%) diff --git a/.github/ISSUE_TEMPLATE/plugin_request.md b/.github/ISSUE_TEMPLATE/instrumentation_request.md similarity index 65% rename from .github/ISSUE_TEMPLATE/plugin_request.md rename to .github/ISSUE_TEMPLATE/instrumentation_request.md index 2f588b9759..408e111f7f 100644 --- a/.github/ISSUE_TEMPLATE/plugin_request.md +++ b/.github/ISSUE_TEMPLATE/instrumentation_request.md @@ -5,9 +5,7 @@ labels: instrumentation-request --- ### Is your instrumentation request related to a problem? Please describe @@ -27,6 +25,15 @@ Weekly Downloads: Versions: +### Code Owners + + + +- Owner 1 +- Owner 2 + ### Additional context