@ogcio/o11y-sdk-react 0.4.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk-core/index.d.ts +2 -0
- package/dist/sdk-core/index.d.ts.map +1 -0
- package/dist/sdk-core/index.js +2 -0
- package/dist/sdk-core/index.js.map +1 -0
- package/dist/sdk-core/lib/index.d.ts +3 -0
- package/dist/sdk-core/lib/index.d.ts.map +1 -0
- package/dist/sdk-core/lib/index.js +3 -0
- package/dist/sdk-core/lib/index.js.map +1 -0
- package/dist/sdk-core/lib/redaction/basic-redactor.d.ts +8 -0
- package/dist/sdk-core/lib/redaction/basic-redactor.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/basic-redactor.js +19 -0
- package/dist/sdk-core/lib/redaction/basic-redactor.js.map +1 -0
- package/dist/sdk-core/lib/redaction/email-redactor.d.ts +9 -0
- package/dist/sdk-core/lib/redaction/email-redactor.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/email-redactor.js +18 -0
- package/dist/sdk-core/lib/redaction/email-redactor.js.map +1 -0
- package/dist/sdk-core/lib/redaction/index.d.ts +10 -0
- package/dist/sdk-core/lib/redaction/index.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/index.js +5 -0
- package/dist/sdk-core/lib/redaction/index.js.map +1 -0
- package/dist/sdk-core/lib/redaction/ip-redactor.d.ts +10 -0
- package/dist/sdk-core/lib/redaction/ip-redactor.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/ip-redactor.js +24 -0
- package/dist/sdk-core/lib/redaction/ip-redactor.js.map +1 -0
- package/dist/sdk-core/lib/redaction/ppsn-redactor.d.ts +9 -0
- package/dist/sdk-core/lib/redaction/ppsn-redactor.d.ts.map +1 -0
- package/dist/sdk-core/lib/redaction/ppsn-redactor.js +18 -0
- package/dist/sdk-core/lib/redaction/ppsn-redactor.js.map +1 -0
- package/dist/sdk-core/lib/utils/data-structures.d.ts +16 -0
- package/dist/sdk-core/lib/utils/data-structures.d.ts.map +1 -0
- package/dist/sdk-core/lib/utils/data-structures.js +58 -0
- package/dist/sdk-core/lib/utils/data-structures.js.map +1 -0
- package/dist/sdk-core/lib/utils/index.d.ts +3 -0
- package/dist/sdk-core/lib/utils/index.d.ts.map +1 -0
- package/dist/sdk-core/lib/utils/index.js +3 -0
- package/dist/sdk-core/lib/utils/index.js.map +1 -0
- package/dist/sdk-core/lib/utils/string-decoding.d.ts +8 -0
- package/dist/sdk-core/lib/utils/string-decoding.d.ts.map +1 -0
- package/dist/sdk-core/lib/utils/string-decoding.js +23 -0
- package/dist/sdk-core/lib/utils/string-decoding.js.map +1 -0
- package/dist/sdk-react/index.d.ts +7 -0
- package/dist/sdk-react/index.d.ts.map +1 -0
- package/dist/{index.js → sdk-react/index.js} +1 -0
- package/dist/sdk-react/index.js.map +1 -0
- package/dist/{lib → sdk-react/lib}/index.d.ts +12 -0
- package/dist/sdk-react/lib/index.d.ts.map +1 -0
- package/dist/sdk-react/lib/index.js +2 -0
- package/dist/sdk-react/lib/index.js.map +1 -0
- package/dist/{lib → sdk-react/lib}/instrumentation.faro.d.ts +1 -0
- package/dist/sdk-react/lib/instrumentation.faro.d.ts.map +1 -0
- package/dist/{lib → sdk-react/lib}/instrumentation.faro.js +7 -1
- package/dist/sdk-react/lib/instrumentation.faro.js.map +1 -0
- package/dist/sdk-react/lib/internals/hooks.d.ts +4 -0
- package/dist/sdk-react/lib/internals/hooks.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/hooks.js +8 -0
- package/dist/sdk-react/lib/internals/hooks.js.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/email.d.ts +6 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/email.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/email.js +22 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/email.js.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/index.d.ts +5 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/index.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/index.js +9 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/index.js.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ip.d.ts +6 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ip.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ip.js +23 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ip.js.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.d.ts +8 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.d.ts.map +1 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.js +21 -0
- package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.js.map +1 -0
- package/dist/{vitest.config.d.ts → sdk-react/vitest.config.d.ts} +1 -0
- package/dist/sdk-react/vitest.config.d.ts.map +1 -0
- package/dist/{vitest.config.js → sdk-react/vitest.config.js} +3 -2
- package/dist/sdk-react/vitest.config.js.map +1 -0
- package/package.json +13 -9
- package/CHANGELOG.md +0 -83
- package/dist/index.d.ts +0 -5
- package/dist/lib/index.js +0 -1
- package/dist/lib/internals/hooks.d.ts +0 -3
- package/dist/lib/internals/hooks.js +0 -34
- package/dist/lib/internals/redaction/pii-detection.d.ts +0 -26
- package/dist/lib/internals/redaction/pii-detection.js +0 -47
- package/dist/lib/internals/redaction/redactors/email.d.ts +0 -8
- package/dist/lib/internals/redaction/redactors/email.js +0 -55
- package/dist/lib/internals/redaction/redactors/index.d.ts +0 -4
- package/dist/lib/internals/redaction/redactors/index.js +0 -6
- package/dist/lib/internals/redaction/redactors/ip.d.ts +0 -10
- package/dist/lib/internals/redaction/redactors/ip.js +0 -61
- package/index.ts +0 -10
- package/lib/index.ts +0 -63
- package/lib/instrumentation.faro.ts +0 -102
- package/lib/internals/hooks.ts +0 -55
- package/lib/internals/redaction/pii-detection.ts +0 -64
- package/lib/internals/redaction/redactors/email.ts +0 -68
- package/lib/internals/redaction/redactors/index.ts +0 -12
- package/lib/internals/redaction/redactors/ip.ts +0 -78
- package/test/config.test.ts +0 -215
- package/test/lib/hooks.test.ts +0 -150
- package/test/lib/internals/redactors/email.test.ts +0 -81
- package/test/lib/internals/redactors/ip.test.ts +0 -86
- package/test/lib/pii-detection.test.ts +0 -179
- package/test/validation.test.ts +0 -65
- package/tsconfig.json +0 -14
- package/vitest.config.ts +0 -26
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ip.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/ip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAmB,MAAM,kCAAkC,CAAC;AAG/E,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IACzC,aAAa,CACrB,OAAkD,EAClD,MAAyB,EACzB,IAAgB;QAEhB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YAC3D,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;gBAChB,IAAI,CAAC,GAAG,CAAC,eAAe,CACtB;oBACE,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE;wBACN,QAAQ,EAAE,OAAO;qBAClB;iBACF,EACD;oBACE,OAAO,EAAE;wBACP,QAAQ,EAAE,IAAI;wBACd,gBAAgB,EAAE,MAAM;wBACxB,UAAU,EAAE,IAAI;qBACjB;iBACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PpsnRedactor, type StringKind } from "../../../../../sdk-core/index.js";
|
|
2
|
+
import type { TransportItemType } from "@grafana/faro-core";
|
|
3
|
+
export declare class PpsnRedactorWithMetrics extends PpsnRedactor {
|
|
4
|
+
protected exportMetrics(context: {
|
|
5
|
+
redactedCounter: number;
|
|
6
|
+
}, source: TransportItemType, kind: StringKind): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ppsn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ppsn.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/ppsn.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,KAAK,UAAU,EAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,qBAAa,uBAAwB,SAAQ,YAAY;IACvD,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,EACpC,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,UAAU,GACf,IAAI;CAmBR"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { faro } from "@grafana/faro-web-sdk";
|
|
2
|
+
import { PpsnRedactor, } from "../../../../../sdk-core/index.js";
|
|
3
|
+
export class PpsnRedactorWithMetrics extends PpsnRedactor {
|
|
4
|
+
exportMetrics(context, source, kind) {
|
|
5
|
+
if (context.redactedCounter > 0) {
|
|
6
|
+
faro.api.pushMeasurement({
|
|
7
|
+
type: "faro_o11y_pii_redaction",
|
|
8
|
+
values: {
|
|
9
|
+
redacted: context.redactedCounter,
|
|
10
|
+
},
|
|
11
|
+
}, {
|
|
12
|
+
context: {
|
|
13
|
+
pii_type: "ppsn",
|
|
14
|
+
redaction_source: source,
|
|
15
|
+
pii_format: kind,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ppsn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ppsn.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/ppsn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EACL,YAAY,GAEb,MAAM,kCAAkC,CAAC;AAG1C,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IAC7C,aAAa,CACrB,OAAoC,EACpC,MAAyB,EACzB,IAAgB;QAEhB,IAAI,OAAO,CAAC,eAAe,GAAG,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,eAAe,CACtB;gBACE,IAAI,EAAE,yBAAyB;gBAC/B,MAAM,EAAE;oBACN,QAAQ,EAAE,OAAO,CAAC,eAAe;iBAClC;aACF,EACD;gBACE,OAAO,EAAE;oBACP,QAAQ,EAAE,MAAM;oBAChB,gBAAgB,EAAE,MAAM;oBACxB,UAAU,EAAE,IAAI;iBACjB;aACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../vitest.config.ts"],"names":[],"mappings":";AAEA,wBAuBG"}
|
|
@@ -3,8 +3,8 @@ export default defineConfig({
|
|
|
3
3
|
test: {
|
|
4
4
|
globals: true,
|
|
5
5
|
watch: false,
|
|
6
|
-
include: ["**/*.test.ts"],
|
|
7
|
-
exclude: ["**/fixtures/**", "**/dist/**"],
|
|
6
|
+
include: ["../sdk-core/test/**/*.test.ts", "**/*.test.ts"],
|
|
7
|
+
exclude: ["**/fixtures/**", "**/dist/**", "**/node_modules/**"],
|
|
8
8
|
poolOptions: {
|
|
9
9
|
threads: {
|
|
10
10
|
maxThreads: 8,
|
|
@@ -23,3 +23,4 @@ export default defineConfig({
|
|
|
23
23
|
environment: "node",
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
|
+
//# sourceMappingURL=vitest.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../../vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,CAAC,+BAA+B,EAAE,cAAc,CAAC;QAC1D,OAAO,EAAE,CAAC,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,CAAC;QAC/D,WAAW,EAAE;YACX,OAAO,EAAE;gBACP,UAAU,EAAE,CAAC;aACd;SACF;QACD,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE;YACR,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,gBAAgB,EAAE,UAAU;YAC5B,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;YAC/B,KAAK,EAAE,IAAI;SACZ;QACD,SAAS,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC;QACpE,WAAW,EAAE,MAAM;KACpB;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogcio/o11y-sdk-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Opentelemetry standard instrumentation SDK for React based project",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": "./dist/index.js",
|
|
8
|
+
".": "./dist/sdk-react/index.js",
|
|
9
9
|
"./*": "./dist/*.js"
|
|
10
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
11
14
|
"keywords": [
|
|
12
15
|
"observability",
|
|
13
16
|
"o11y",
|
|
@@ -23,16 +26,17 @@
|
|
|
23
26
|
"@grafana/faro-web-sdk": "^1.19.0",
|
|
24
27
|
"@grafana/faro-web-tracing": "^1.19.0",
|
|
25
28
|
"@opentelemetry/api": "^1.9.0",
|
|
26
|
-
"@opentelemetry/core": "2.0
|
|
27
|
-
"@opentelemetry/instrumentation-document-load": "^0.
|
|
28
|
-
"@opentelemetry/instrumentation-fetch": "^0.
|
|
29
|
-
"@opentelemetry/instrumentation-user-interaction": "^0.
|
|
29
|
+
"@opentelemetry/core": "2.1.0",
|
|
30
|
+
"@opentelemetry/instrumentation-document-load": "^0.51.2",
|
|
31
|
+
"@opentelemetry/instrumentation-fetch": "^0.205.0",
|
|
32
|
+
"@opentelemetry/instrumentation-user-interaction": "^0.50.2"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^24.
|
|
35
|
+
"@types/node": "^24.7.0",
|
|
36
|
+
"@grafana/faro-core": "^1.19.0",
|
|
33
37
|
"@vitest/coverage-v8": "^3.2.4",
|
|
34
|
-
"tsx": "^4.20.
|
|
35
|
-
"typescript": "^5.
|
|
38
|
+
"tsx": "^4.20.6",
|
|
39
|
+
"typescript": "^5.9.3",
|
|
36
40
|
"vitest": "^3.2.4"
|
|
37
41
|
},
|
|
38
42
|
"scripts": {
|
package/CHANGELOG.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [0.4.2](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.4.0...@ogcio/o11y-sdk-react@v0.4.2) (2025-09-09)
|
|
4
|
-
|
|
5
|
-
### Miscellaneous Chores
|
|
6
|
-
|
|
7
|
-
* **sdk-react:** propagate url encoding detection to react-sdk AB[#30758](https://github.com/ogcio/o11y/issues/30758) ([#202](https://github.com/ogcio/o11y/issues/202)) ([aaf0d5a](https://github.com/ogcio/o11y/commit/aaf0d5a9b30a186d804fc839a23180891d9ef883))
|
|
8
|
-
|
|
9
|
-
## [0.4.0](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.3.0...@ogcio/o11y-sdk-react@v0.4.0) (2025-09-02)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
* o11y react-sdk IP pii redaction AB[#30758](https://github.com/ogcio/o11y/issues/30758) ([#196](https://github.com/ogcio/o11y/issues/196)) ([d6bb83f](https://github.com/ogcio/o11y/commit/d6bb83fa425ffdf3fb023ec62caeef070995d07a))
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Miscellaneous Chores
|
|
18
|
-
|
|
19
|
-
* **deps:** bump the root-deps group across 1 directory with 16 updates ([#193](https://github.com/ogcio/o11y/issues/193)) ([c523565](https://github.com/ogcio/o11y/commit/c523565a6ba7f327473e8d93afc7d532ac220457))
|
|
20
|
-
* **deps:** bump the root-deps group across 3 directories with 34 updates ([#188](https://github.com/ogcio/o11y/issues/188)) ([c0059f3](https://github.com/ogcio/o11y/commit/c0059f33cbb5c39cf6df0f4640604796dbbd3f57))
|
|
21
|
-
|
|
22
|
-
## [0.3.0](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.2.0...@ogcio/o11y-sdk-react@v0.3.0) (2025-07-31)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
* **sdk-react:** pii detection ([#180](https://github.com/ogcio/o11y/issues/180)) ([57ddf2f](https://github.com/ogcio/o11y/commit/57ddf2f4792207e62ea6bf9ea797bc652942db06))
|
|
28
|
-
* update AWS secrets manager connection AB[#29565](https://github.com/ogcio/o11y/issues/29565) ([#166](https://github.com/ogcio/o11y/issues/166)) ([962c03d](https://github.com/ogcio/o11y/commit/962c03de2da4060a81aa603c355f3d60cafe3c30))
|
|
29
|
-
|
|
30
|
-
## [0.2.0](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.1.0-beta.7...@ogcio/o11y-sdk-react@v0.2.0) (2025-06-24)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Features
|
|
34
|
-
|
|
35
|
-
* late june deps update ([#154](https://github.com/ogcio/o11y/issues/154)) ([a772622](https://github.com/ogcio/o11y/commit/a7726225a59b2dbcd4326919323d935843b2f93f))
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### Miscellaneous Chores
|
|
39
|
-
|
|
40
|
-
* **deps-dev:** bump @types/node to `24` AB[#29294](https://github.com/ogcio/o11y/issues/29294) ([3c74c28](https://github.com/ogcio/o11y/commit/3c74c28af41af8403220368ac72a90e40c3e15ae))
|
|
41
|
-
* **deps-dev:** bump the root-deps group across 1 directory with 3 updates ([#150](https://github.com/ogcio/o11y/issues/150)) ([9d574d1](https://github.com/ogcio/o11y/commit/9d574d1af0964fc4af991d677b443015921d93f6))
|
|
42
|
-
|
|
43
|
-
## [0.1.0-beta.7](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.1.0-beta.6...@ogcio/o11y-sdk-react@v0.1.0-beta.7) (2025-06-04)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### Features
|
|
47
|
-
|
|
48
|
-
* june deps update ([#147](https://github.com/ogcio/o11y/issues/147)) ([b365a40](https://github.com/ogcio/o11y/commit/b365a4099cdfd8533ffa4948620d29f0044bbd70))
|
|
49
|
-
|
|
50
|
-
## [0.1.0-beta.6](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.1.0-beta.5...@ogcio/o11y-sdk-react@v0.1.0-beta.6) (2025-05-21)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### Features
|
|
54
|
-
|
|
55
|
-
* may deps update ([#136](https://github.com/ogcio/o11y/issues/136)) ([3edd8b1](https://github.com/ogcio/o11y/commit/3edd8b1d823740d555fc4d93be427e9dc1438a95))
|
|
56
|
-
|
|
57
|
-
## [0.1.0-beta.5](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.1.0-beta.4...@ogcio/o11y-sdk-react@v0.1.0-beta.5) (2025-04-09)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Features
|
|
61
|
-
|
|
62
|
-
* april depedency upgrade AB[#27200](https://github.com/ogcio/o11y/issues/27200) ([#116](https://github.com/ogcio/o11y/issues/116)) ([d792fe5](https://github.com/ogcio/o11y/commit/d792fe5a783b0b495912b5bef2babfe11ef5e01d))
|
|
63
|
-
|
|
64
|
-
## [0.1.0-beta.4](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.1.0-beta.3...@ogcio/o11y-sdk-react@v0.1.0-beta.4) (2025-02-18)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Features
|
|
68
|
-
|
|
69
|
-
* remove pnpm test on prepublishOnly script ([#68](https://github.com/ogcio/o11y/issues/68)) ([41f6f57](https://github.com/ogcio/o11y/commit/41f6f57fa415c4f7adc29f49f983539274ef7320))
|
|
70
|
-
|
|
71
|
-
## [0.1.0-beta.3](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.1.0-beta.2...@ogcio/o11y-sdk-react@v0.1.0-beta.3) (2025-01-28)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
### Bug Fixes
|
|
75
|
-
|
|
76
|
-
* prepublishOnly hook ([#60](https://github.com/ogcio/o11y/issues/60)) ([9fbd3ad](https://github.com/ogcio/o11y/commit/9fbd3ad0b45a1604cf2eccc26b2f8855640417a1))
|
|
77
|
-
|
|
78
|
-
## [0.1.0-beta.2](https://github.com/ogcio/o11y/compare/@ogcio/o11y-sdk-react@v0.1.0-beta.1...@ogcio/o11y-sdk-react@v0.1.0-beta.2) (2025-01-28)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
### Features
|
|
82
|
-
|
|
83
|
-
* o11y sdk repo setup ([#15](https://github.com/ogcio/o11y/issues/15)) ([c5816ba](https://github.com/ogcio/o11y/commit/c5816baff1454353f12539949959e84964ed6401))
|
package/dist/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Faro, withFaroErrorBoundary, withFaroProfiler } from "@grafana/faro-react";
|
|
2
|
-
import buildFaroInstrumentation from "./lib/instrumentation.faro.js";
|
|
3
|
-
export * from "./lib/index.js";
|
|
4
|
-
export { withFaroErrorBoundary, withFaroProfiler, Faro };
|
|
5
|
-
export { buildFaroInstrumentation as instrumentFaro };
|
package/dist/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { _cleanStringPII } from "./redaction/pii-detection.js";
|
|
2
|
-
function _cleanObjectPII(data, type, redactors) {
|
|
3
|
-
if (!data) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
if (Array.isArray(data)) {
|
|
7
|
-
data.forEach((item, index) => {
|
|
8
|
-
if (typeof item === "string") {
|
|
9
|
-
data[index] = _cleanStringPII(data[index], type, redactors);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
if (typeof item === "object") {
|
|
13
|
-
_cleanObjectPII(item, type, redactors);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
if (typeof data === "object") {
|
|
18
|
-
for (const key in data) {
|
|
19
|
-
if (typeof data[key] === "string") {
|
|
20
|
-
data[key] = _cleanStringPII(data[key], type, redactors);
|
|
21
|
-
}
|
|
22
|
-
if (typeof data[key] === "object") {
|
|
23
|
-
_cleanObjectPII(data[key], type, redactors);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export const _beforeSend = (redactors) => (item) => {
|
|
29
|
-
if (redactors.length === 0) {
|
|
30
|
-
return item;
|
|
31
|
-
}
|
|
32
|
-
_cleanObjectPII(item, item.type, redactors);
|
|
33
|
-
return item;
|
|
34
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { TransportItemType } from "@grafana/faro-web-sdk";
|
|
2
|
-
import { Redactor } from "./redactors/index.js";
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether a string contains URI-encoded components.
|
|
5
|
-
*
|
|
6
|
-
* @param {string} value - The string to inspect.
|
|
7
|
-
* @returns {boolean} `true` if the string is encoded, `false` otherwise.
|
|
8
|
-
*/
|
|
9
|
-
export declare function _containsEncodedComponents(value: string): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Cleans a string by redacting configured PIIs and emitting metrics for redacted values.
|
|
12
|
-
*
|
|
13
|
-
* If the string is URL-encoded, it will be decoded before redaction.
|
|
14
|
-
* Metrics are emitted for:
|
|
15
|
-
* - each domain found in redacted email addresses.
|
|
16
|
-
* - IPv4|IPv6 addresses redacted.
|
|
17
|
-
*
|
|
18
|
-
* @template T
|
|
19
|
-
*
|
|
20
|
-
* @param {string} value - The input value to sanitize.
|
|
21
|
-
* @param {"trace" | "log"} source - The source context of the input, used in metrics.
|
|
22
|
-
* @param {Redactor[]} redactors - The string processors containing the redaction logic.
|
|
23
|
-
*
|
|
24
|
-
* @returns {T} The cleaned string with any configured PII replaced by `[REDACTED PII_TYPE]`.
|
|
25
|
-
*/
|
|
26
|
-
export declare function _cleanStringPII(value: string, source: TransportItemType, redactors: Redactor[]): string;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks whether a string contains URI-encoded components.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} value - The string to inspect.
|
|
5
|
-
* @returns {boolean} `true` if the string is encoded, `false` otherwise.
|
|
6
|
-
*/
|
|
7
|
-
export function _containsEncodedComponents(value) {
|
|
8
|
-
try {
|
|
9
|
-
const decodedURIComponent = decodeURIComponent(value);
|
|
10
|
-
if (decodeURI(value) !== decodedURIComponent) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
if (value !== decodedURIComponent) {
|
|
14
|
-
return (encodeURIComponent(decodedURIComponent) === value ||
|
|
15
|
-
encodeURI(decodedURIComponent) === value);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Cleans a string by redacting configured PIIs and emitting metrics for redacted values.
|
|
25
|
-
*
|
|
26
|
-
* If the string is URL-encoded, it will be decoded before redaction.
|
|
27
|
-
* Metrics are emitted for:
|
|
28
|
-
* - each domain found in redacted email addresses.
|
|
29
|
-
* - IPv4|IPv6 addresses redacted.
|
|
30
|
-
*
|
|
31
|
-
* @template T
|
|
32
|
-
*
|
|
33
|
-
* @param {string} value - The input value to sanitize.
|
|
34
|
-
* @param {"trace" | "log"} source - The source context of the input, used in metrics.
|
|
35
|
-
* @param {Redactor[]} redactors - The string processors containing the redaction logic.
|
|
36
|
-
*
|
|
37
|
-
* @returns {T} The cleaned string with any configured PII replaced by `[REDACTED PII_TYPE]`.
|
|
38
|
-
*/
|
|
39
|
-
export function _cleanStringPII(value, source, redactors) {
|
|
40
|
-
let kind = "string";
|
|
41
|
-
let decodedValue = value;
|
|
42
|
-
if (_containsEncodedComponents(value)) {
|
|
43
|
-
decodedValue = decodeURIComponent(value);
|
|
44
|
-
kind = "url";
|
|
45
|
-
}
|
|
46
|
-
return redactors.reduce((redactedValue, currentRedactor) => currentRedactor(redactedValue, source, kind), decodedValue);
|
|
47
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redacts provided input and collects metadata metrics about redacted email domains,
|
|
3
|
-
* data source and kind.
|
|
4
|
-
*
|
|
5
|
-
* @param {string} value The input string potentially containing email addresses.
|
|
6
|
-
* @returns {string} the redacted value
|
|
7
|
-
*/
|
|
8
|
-
export declare const emailRedactor: (value: string, source: string, kind: string) => string;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { faro } from "@grafana/faro-web-sdk";
|
|
2
|
-
const EMAIL_REGEX = /[\p{L}\p{N}._%+-]+@((?:[\p{L}\p{N}-]+\.)+[\p{L}]{2,})/giu;
|
|
3
|
-
/**
|
|
4
|
-
* Redacts all email addresses in the input string and collects metadata.
|
|
5
|
-
*
|
|
6
|
-
* @param {string} value The input string potentially containing email addresses.
|
|
7
|
-
* @returns {{
|
|
8
|
-
* redacted: string,
|
|
9
|
-
* count: number,
|
|
10
|
-
* domains: Record<string, number>
|
|
11
|
-
* }}
|
|
12
|
-
*
|
|
13
|
-
* An object containing:
|
|
14
|
-
* - `redacted`: the string with email addresses replaced by `[REDACTED EMAIL]`
|
|
15
|
-
* - `count`: total number of email addresses redacted
|
|
16
|
-
* - `domains`: a map of domain names to the number of times they were redacted
|
|
17
|
-
*/
|
|
18
|
-
function _redactEmails(value) {
|
|
19
|
-
let count = 0;
|
|
20
|
-
const domains = {};
|
|
21
|
-
const redacted = value.replace(EMAIL_REGEX, (_, domain) => {
|
|
22
|
-
count++;
|
|
23
|
-
domains[domain] = (domains[domain] || 0) + 1;
|
|
24
|
-
return "[REDACTED EMAIL]";
|
|
25
|
-
});
|
|
26
|
-
return { redacted, count, domains };
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Redacts provided input and collects metadata metrics about redacted email domains,
|
|
30
|
-
* data source and kind.
|
|
31
|
-
*
|
|
32
|
-
* @param {string} value The input string potentially containing email addresses.
|
|
33
|
-
* @returns {string} the redacted value
|
|
34
|
-
*/
|
|
35
|
-
export const emailRedactor = (value, source, kind) => {
|
|
36
|
-
const { redacted, count, domains } = _redactEmails(value);
|
|
37
|
-
if (count > 0) {
|
|
38
|
-
for (const [domain, domainCount] of Object.entries(domains)) {
|
|
39
|
-
faro.api.pushMeasurement({
|
|
40
|
-
type: "faro_o11y_pii_redaction",
|
|
41
|
-
values: {
|
|
42
|
-
redacted: domainCount,
|
|
43
|
-
},
|
|
44
|
-
}, {
|
|
45
|
-
context: {
|
|
46
|
-
pii_type: "email",
|
|
47
|
-
redaction_source: source,
|
|
48
|
-
pii_email_domain: domain,
|
|
49
|
-
pii_format: kind,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return redacted;
|
|
55
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type FaroSDKConfig } from "../../../index.js";
|
|
2
|
-
export type Redactor = (value: string, source: string, kind: string) => string;
|
|
3
|
-
export type RedactorKeys = keyof NonNullable<FaroSDKConfig["detection"]>;
|
|
4
|
-
export declare const redactors: Record<RedactorKeys, Redactor>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redacts provided input and collects metadata metrics about redacted IPs,
|
|
3
|
-
* data source and kind.
|
|
4
|
-
*
|
|
5
|
-
* @param {string} value The input string potentially containing IP addresses.
|
|
6
|
-
* @param {string} source The source of the attribute being redacted (log, span, metric).
|
|
7
|
-
* @param {string} kind The type of the data structure containing the PII
|
|
8
|
-
* @returns {string} the redacted value
|
|
9
|
-
*/
|
|
10
|
-
export declare const ipRedactor: (value: string, source: string, kind: string) => string;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { faro } from "@grafana/faro-web-sdk";
|
|
2
|
-
// Generous IP address matchers (might match some invalid addresses like 192.168.01.1)
|
|
3
|
-
const IPV4_REGEX = /(?<!\d)(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}(?!\d)/gi;
|
|
4
|
-
const IPV6_REGEX = /(?<![0-9a-f:])((?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|:(?::[0-9A-Fa-f]{1,4}){1,7}|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,5}(?::[0-9A-Fa-f]{1,4}){1,2}|(?:[0-9A-Fa-f]{1,4}:){1,4}(?::[0-9A-Fa-f]{1,4}){1,3}|(?:[0-9A-Fa-f]{1,4}:){1,3}(?::[0-9A-Fa-f]{1,4}){1,4}|(?:[0-9A-Fa-f]{1,4}:){1,2}(?::[0-9A-Fa-f]{1,4}){1,5}|[0-9A-Fa-f]{1,4}:(?::[0-9A-Fa-f]{1,4}){1,6}|:(?::[0-9A-Fa-f]{1,4}){1,7}:?|(?:[0-9A-Fa-f]{1,4}:){1,4}:(?:25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3})(?![0-9a-f:])/gi;
|
|
5
|
-
/**
|
|
6
|
-
* Redacts all ip addresses in the input string and collects metadata.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} value The input string potentially containing ip addresses.
|
|
9
|
-
* @returns {{
|
|
10
|
-
* redacted: string,
|
|
11
|
-
* count: number,
|
|
12
|
-
* domains: Record<string, number>
|
|
13
|
-
* }}
|
|
14
|
-
*
|
|
15
|
-
* An object containing:
|
|
16
|
-
* - `redacted`: the string with IP addresses replaced by `[REDACTED IPV*]`
|
|
17
|
-
* - `counters`: total number of addresses redacted by IPv* type
|
|
18
|
-
* - `domains`: a map of domain names to the number of times they were redacted
|
|
19
|
-
*/
|
|
20
|
-
function _redactIps(value) {
|
|
21
|
-
const counters = {};
|
|
22
|
-
const redacted = value
|
|
23
|
-
.replace(IPV4_REGEX, () => {
|
|
24
|
-
counters["IPv4"] = (counters["IPv4"] || 0) + 1;
|
|
25
|
-
return "[REDACTED IPV4]";
|
|
26
|
-
})
|
|
27
|
-
.replace(IPV6_REGEX, () => {
|
|
28
|
-
counters["IPv4"] = (counters["IPv4"] || 0) + 1;
|
|
29
|
-
return "[REDACTED IPV6]";
|
|
30
|
-
});
|
|
31
|
-
return { redacted, counters };
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Redacts provided input and collects metadata metrics about redacted IPs,
|
|
35
|
-
* data source and kind.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} value The input string potentially containing IP addresses.
|
|
38
|
-
* @param {string} source The source of the attribute being redacted (log, span, metric).
|
|
39
|
-
* @param {string} kind The type of the data structure containing the PII
|
|
40
|
-
* @returns {string} the redacted value
|
|
41
|
-
*/
|
|
42
|
-
export const ipRedactor = (value, source, kind) => {
|
|
43
|
-
const { redacted, counters } = _redactIps(value);
|
|
44
|
-
Object.entries(counters).forEach(([type, counter]) => {
|
|
45
|
-
if (counter > 0) {
|
|
46
|
-
faro.api.pushMeasurement({
|
|
47
|
-
type: "faro_o11y_pii_redaction",
|
|
48
|
-
values: {
|
|
49
|
-
redacted: counter,
|
|
50
|
-
},
|
|
51
|
-
}, {
|
|
52
|
-
context: {
|
|
53
|
-
pii_type: type,
|
|
54
|
-
redaction_source: source,
|
|
55
|
-
pii_format: kind,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
return redacted;
|
|
61
|
-
};
|
package/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Faro,
|
|
3
|
-
withFaroErrorBoundary,
|
|
4
|
-
withFaroProfiler,
|
|
5
|
-
} from "@grafana/faro-react";
|
|
6
|
-
import buildFaroInstrumentation from "./lib/instrumentation.faro.js";
|
|
7
|
-
|
|
8
|
-
export * from "./lib/index.js";
|
|
9
|
-
export { withFaroErrorBoundary, withFaroProfiler, Faro };
|
|
10
|
-
export { buildFaroInstrumentation as instrumentFaro };
|
package/lib/index.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
interface SDKConfig {
|
|
2
|
-
/**
|
|
3
|
-
* The opentelemetry collector entrypoint GRPC url.
|
|
4
|
-
* If the collectoUrl is null or undefined, the instrumentation will not be activated.
|
|
5
|
-
* @example http://alloy:4317
|
|
6
|
-
*/
|
|
7
|
-
collectorUrl: string;
|
|
8
|
-
/**
|
|
9
|
-
* Name of your application used for the collector to group logs
|
|
10
|
-
*/
|
|
11
|
-
serviceName?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Diagnostic log level for the internal runtime instrumentation
|
|
14
|
-
*
|
|
15
|
-
* @type string
|
|
16
|
-
* @default INFO
|
|
17
|
-
*/
|
|
18
|
-
diagLogLevel?: SDKLogLevel;
|
|
19
|
-
/**
|
|
20
|
-
* Collector signals processing mode.
|
|
21
|
-
* signle: makes an http/grpc request for each signal and it is immediately processed inside grafana
|
|
22
|
-
* batch: sends multiple signals within a time window, optimized to reduce http/grpc calls in production
|
|
23
|
-
*
|
|
24
|
-
* @type string
|
|
25
|
-
* @default batch
|
|
26
|
-
*/
|
|
27
|
-
collectorMode?: SDKCollectorMode;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface FaroSDKConfig extends SDKConfig {
|
|
31
|
-
/**
|
|
32
|
-
* String with single or multiple URLs separated by comma used by the instrumentation to ignore CORS errors and send signals through it
|
|
33
|
-
* @example http://localhost:9000,http://localhost:8000
|
|
34
|
-
* @example http://localhost:9000
|
|
35
|
-
*/
|
|
36
|
-
corsTraceHeaders?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Enable/Disable PII detection for GDPR data
|
|
39
|
-
*/
|
|
40
|
-
detection?: {
|
|
41
|
-
/**
|
|
42
|
-
* Redact email addresses
|
|
43
|
-
* @default true
|
|
44
|
-
*/
|
|
45
|
-
email?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Redact ip addresses
|
|
48
|
-
* @default true
|
|
49
|
-
*/
|
|
50
|
-
ip?: boolean;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export type SDKCollectorMode = "single" | "batch";
|
|
55
|
-
|
|
56
|
-
export type SDKLogLevel =
|
|
57
|
-
| "NONE"
|
|
58
|
-
| "ERROR"
|
|
59
|
-
| "WARN"
|
|
60
|
-
| "INFO"
|
|
61
|
-
| "DEBUG"
|
|
62
|
-
| "VERBOSE"
|
|
63
|
-
| "ALL";
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ErrorsInstrumentation,
|
|
3
|
-
getWebInstrumentations,
|
|
4
|
-
initializeFaro,
|
|
5
|
-
WebVitalsInstrumentation,
|
|
6
|
-
type Faro,
|
|
7
|
-
} from "@grafana/faro-react";
|
|
8
|
-
import { TracingInstrumentation } from "@grafana/faro-web-tracing";
|
|
9
|
-
import { diag, DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
|
|
10
|
-
import { W3CTraceContextPropagator } from "@opentelemetry/core";
|
|
11
|
-
import { DocumentLoadInstrumentation } from "@opentelemetry/instrumentation-document-load";
|
|
12
|
-
import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
|
|
13
|
-
import { UserInteractionInstrumentation } from "@opentelemetry/instrumentation-user-interaction";
|
|
14
|
-
import type { FaroSDKConfig } from "./index.js";
|
|
15
|
-
import { _beforeSend } from "./internals/hooks.js";
|
|
16
|
-
import {
|
|
17
|
-
RedactorKeys,
|
|
18
|
-
redactors,
|
|
19
|
-
} from "./internals/redaction/redactors/index.js";
|
|
20
|
-
|
|
21
|
-
export default function buildFaroInstrumentation(
|
|
22
|
-
config?: FaroSDKConfig,
|
|
23
|
-
): Faro | undefined {
|
|
24
|
-
if (!config) {
|
|
25
|
-
console.warn(
|
|
26
|
-
"observability config not set. Skipping Faro OpenTelemetry instrumentation.",
|
|
27
|
-
);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (!config.collectorUrl) {
|
|
32
|
-
console.warn(
|
|
33
|
-
"collectorUrl not set. Skipping Faro OpenTelemetry instrumentation.",
|
|
34
|
-
);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (!isUrl(config.collectorUrl)) {
|
|
39
|
-
console.error(
|
|
40
|
-
"collectorUrl does not use a valid format. Skipping Faro OpenTelemetry instrumentation.",
|
|
41
|
-
);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const redactorsChain = Object.entries(redactors)
|
|
46
|
-
.filter(([key]) => {
|
|
47
|
-
return config.detection?.[key as RedactorKeys] !== false;
|
|
48
|
-
})
|
|
49
|
-
.map(([_, value]) => value);
|
|
50
|
-
try {
|
|
51
|
-
diag.setLogger(
|
|
52
|
-
new DiagConsoleLogger(),
|
|
53
|
-
config.diagLogLevel
|
|
54
|
-
? DiagLogLevel[config.diagLogLevel]
|
|
55
|
-
: DiagLogLevel.INFO,
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const faro = initializeFaro({
|
|
59
|
-
url: config.collectorUrl,
|
|
60
|
-
app: {
|
|
61
|
-
name: config.serviceName,
|
|
62
|
-
},
|
|
63
|
-
batching: {
|
|
64
|
-
enabled: !(config.collectorMode === "single"),
|
|
65
|
-
},
|
|
66
|
-
beforeSend: _beforeSend(redactorsChain),
|
|
67
|
-
instrumentations: [
|
|
68
|
-
...getWebInstrumentations({
|
|
69
|
-
captureConsole: true,
|
|
70
|
-
}),
|
|
71
|
-
new ErrorsInstrumentation(),
|
|
72
|
-
new WebVitalsInstrumentation(),
|
|
73
|
-
new TracingInstrumentation({
|
|
74
|
-
propagator: new W3CTraceContextPropagator(),
|
|
75
|
-
instrumentations: [
|
|
76
|
-
new DocumentLoadInstrumentation(),
|
|
77
|
-
new FetchInstrumentation({
|
|
78
|
-
ignoreUrls: [config.collectorUrl], // ignore collector to avoid fetch loop
|
|
79
|
-
propagateTraceHeaderCorsUrls: config.corsTraceHeaders
|
|
80
|
-
? config.corsTraceHeaders.split(",").map((s) => new RegExp(s))
|
|
81
|
-
: undefined,
|
|
82
|
-
}),
|
|
83
|
-
new UserInteractionInstrumentation(),
|
|
84
|
-
],
|
|
85
|
-
}),
|
|
86
|
-
],
|
|
87
|
-
});
|
|
88
|
-
console.log("Faro OpenTelemetry instrumentation started successfully.");
|
|
89
|
-
return faro;
|
|
90
|
-
} catch (error) {
|
|
91
|
-
console.error("Error starting Faro OpenTelemetry instrumentation:", error);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function isUrl(url: string): boolean {
|
|
96
|
-
try {
|
|
97
|
-
new URL(url);
|
|
98
|
-
return true;
|
|
99
|
-
} catch (_) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}
|