Skip to content

Commit

Permalink
Merge branch 'master' into fix-648-fetch-url-object
Browse files Browse the repository at this point in the history
  • Loading branch information
berndfuhrmann authored Dec 23, 2024
2 parents 96043e3 + 72d523d commit baf338a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/continuous-monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
schedule:
- cron: '0/10 * * * *'

permissions:
id-token: write
contents: read

jobs:
smoke-tests:
name: Run smoke tests
Expand All @@ -14,10 +18,9 @@ jobs:
uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.AWS_INTEG_TEST_ROLE_ARN }}
aws-region: us-east-1

- name: Setup Node
Expand Down
5 changes: 3 additions & 2 deletions sdk_contrib/fastify/lib/hooks/on-request.hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = function onRequestHook(request, reply, done) {

ns.run(() => {
AWSXRay.setSegment(segment);
done();
});
} else {
request.log.info('Manual mode, skipping segment');
Expand All @@ -25,7 +26,7 @@ module.exports = function onRequestHook(request, reply, done) {
} else {
request.log.warn('Request already has a segment, skipping');
}
}

done();
done();
}
};
5 changes: 3 additions & 2 deletions sdk_contrib/fastify/lib/plugin.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// @ts-check
const fp = require('fastify-plugin').default;
const configureAWSXRaySync = require('./private/configure-aws-x-ray-sync');
const onRequestHook = require('./hooks/on-request.hook');
const onResponseHook = require('./hooks/on-response.hook');
const onErrorHook = require('./hooks/on-error.hook');

/** @type {import('fastify').FastifyPluginAsync} */
const xRayFastifyPlugin = async (fastify, opts) => {
const xRayFastifyPlugin = fp(async (fastify, opts) => {
configureAWSXRaySync(fastify, opts);

fastify.decorateRequest('segment', null);
fastify
.addHook('onRequest', onRequestHook)
.addHook('onResponse', onResponseHook)
.addHook('onError', onErrorHook);
};
});

module.exports = xRayFastifyPlugin;

Expand Down

0 comments on commit baf338a

Please sign in to comment.