Skip to content

Commit

Permalink
feat: add tracing to corpus API
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetto committed Nov 15, 2024
1 parent 54e4b31 commit eebf621
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 213 deletions.
5 changes: 5 additions & 0 deletions infrastructure/curated-corpus-api/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@ export const config = {
timeout: 5,
startPeriod: 0,
},
tracing: {
url: isDev
? 'https://otel-collector.getpocket.dev:443'
: 'https://otel-collector.readitlater.com:443',
},
};
23 changes: 16 additions & 7 deletions infrastructure/curated-corpus-api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,14 @@ class CuratedCorpusAPI extends TerraformStack {
name: 'AWS_REGION',
value: region.name,
},
{
name: 'OTLP_COLLECTOR_URL',
value: config.tracing.url,
},
{
name: 'LOG_LEVEL',
// do not log http, graphql, or debug events in production
value: config.environment === 'Prod' ? 'info' : 'debug',
// do not log http, graphql, or debug events
value: 'info',
},
],
logGroup: this.createCustomLogGroup('app'),
Expand All @@ -286,6 +290,14 @@ class CuratedCorpusAPI extends TerraformStack {
name: 'DATABASE_URL',
valueFrom: `${rds.secretARN}:database_url::`,
},
{
name: 'UNLEASH_ENDPOINT',
valueFrom: `arn:aws:ssm:${region.name}:${caller.accountId}:parameter/Shared/${config.environment}/UNLEASH_ENDPOINT`,
},
{
name: 'UNLEASH_KEY',
valueFrom: `arn:aws:secretsmanager:${region.name}:${caller.accountId}:secret:${config.name}/${config.environment}/UNLEASH_KEY`,
},
],
},
],
Expand Down Expand Up @@ -329,6 +341,8 @@ class CuratedCorpusAPI extends TerraformStack {
resources: [
`arn:aws:ssm:${region.name}:${caller.accountId}:parameter/${config.name}/${config.environment}`,
`arn:aws:ssm:${region.name}:${caller.accountId}:parameter/${config.name}/${config.environment}/*`,
`arn:aws:ssm:${region.name}:${caller.accountId}:parameter/Shared/${config.environment}/*`,
`arn:aws:ssm:${region.name}:${caller.accountId}:parameter/Shared/${config.environment}`,
],
effect: 'Allow',
},
Expand All @@ -353,11 +367,6 @@ class CuratedCorpusAPI extends TerraformStack {
'logs:CreateLogStream',
'logs:DescribeLogStreams',
'logs:DescribeLogGroups',
'xray:PutTraceSegments',
'xray:PutTelemetryRecords',
'xray:GetSamplingRules',
'xray:GetSamplingTargets',
'xray:GetSamplingStatisticSummaries',
],
resources: ['*'],
effect: 'Allow',
Expand Down
Loading

0 comments on commit eebf621

Please sign in to comment.