Skip to content

Commit

Permalink
[IOPAE-1133] setAutoCollectConsole on ApplicationInsight (#235)
Browse files Browse the repository at this point in the history
* setAutoCollectConsole on ApplicationInsight

* Add sampling percentage

* disable tslint
  • Loading branch information
giamma1295 committed May 13, 2024
1 parent 2123390 commit 52c63e2
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 85 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@pagopa/ts-commons": "^9.1.0",
"@pagopa/io-functions-commons": "^19.2.0",
"@types/memoizee": "^0.4.2",
"applicationinsights": "^1.0.3",
"applicationinsights": "^2.9.0",
"auto-changelog": "^2.2.1",
"@azure/arm-apimanagement": "^9.1.0",
"@azure/identity": "^4.2.0",
Expand Down
9 changes: 8 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ import { getApimUser } from "./apim_operations";
import { getApimAccountEmail } from "./utils/session";

// collect monotoring metrics automatically
appinsights.setup(process.env.APPINSIGHTS_INSTRUMENTATIONKEY);
appinsights
.setup(process.env.APPINSIGHTS_INSTRUMENTATIONKEY)
.setAutoCollectConsole(true, true)
.setDistributedTracingMode(appinsights.DistributedTracingModes.AI_AND_W3C);

// tslint:disable-next-line: no-object-mutation
appinsights.defaultClient.config.samplingPercentage = 33;

appinsights.start();

process.on("unhandledRejection", e => logger.error(JSON.stringify(e)));
Expand Down
Loading

0 comments on commit 52c63e2

Please sign in to comment.