Skip to content

Commit

Permalink
Merge pull request #291 from cardanoapi/feat/apm-trace-correlation
Browse files Browse the repository at this point in the history
Add traceparent header support for APM
  • Loading branch information
mesudip authored Dec 31, 2024
2 parents 075ec05 + df6a8ff commit b72b406
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dbsync-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const dynamicCors = (req:Request, res:Response, next:any) => {
// Allow requests from any origin but with credentials
res.header('Access-Control-Allow-Origin', origin || '*');
res.header('Access-Control-Allow-Methods', 'GET,HEAD,PUT,PATCH,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Tracestate, Traceparent');
res.header('Access-Control-Allow-Credentials', 'true');

// Handle preflight requests
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@ function embedApmScript() {
environment: environments.IS_IN_PRODUCTION_MODE
? environments.network
: 'local',
serverUrlPrefix: '/status'
serverUrlPrefix: '/status',
breakdownMetrics: true,
propagateTracestate: true,
distributedTracingOrigins: [
"https://sanchonet.api.agents.cardanoapi.io",
"https://api.agents.cardanoapi.io",
"https://preprod.api.agents.cardanoapi.io",
"https://preview.api.agents.cardanoapi.io"
],
};
const htmlStr = 'elasticApm.init(' + JSON.stringify(config) + ')';
return process.env.NEXT_PUBLIC_APM_ENABLED ? (
Expand Down

0 comments on commit b72b406

Please sign in to comment.