@opentelemetry/plugin-react-load 0.25.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/LICENSE +201 -0
- package/README.md +55 -0
- package/build/esm/BaseOpenTelemetryComponent.d.ts +106 -0
- package/build/esm/BaseOpenTelemetryComponent.d.ts.map +1 -0
- package/build/esm/BaseOpenTelemetryComponent.js +438 -0
- package/build/esm/BaseOpenTelemetryComponent.js.map +1 -0
- package/build/esm/enums/AttributeNames.d.ts +10 -0
- package/build/esm/enums/AttributeNames.d.ts.map +1 -0
- package/build/esm/enums/AttributeNames.js +26 -0
- package/build/esm/enums/AttributeNames.js.map +1 -0
- package/build/esm/index.d.ts +2 -0
- package/build/esm/index.d.ts.map +1 -0
- package/build/esm/index.js +17 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/types.d.ts +10 -0
- package/build/esm/types.d.ts.map +1 -0
- package/build/esm/types.js +17 -0
- package/build/esm/types.js.map +1 -0
- package/build/esm/version.d.ts +2 -0
- package/build/esm/version.d.ts.map +1 -0
- package/build/esm/version.js +18 -0
- package/build/esm/version.js.map +1 -0
- package/build/src/BaseOpenTelemetryComponent.d.ts +106 -0
- package/build/src/BaseOpenTelemetryComponent.d.ts.map +1 -0
- package/build/src/BaseOpenTelemetryComponent.js +374 -0
- package/build/src/BaseOpenTelemetryComponent.js.map +1 -0
- package/build/src/enums/AttributeNames.d.ts +10 -0
- package/build/src/enums/AttributeNames.d.ts.map +1 -0
- package/build/src/enums/AttributeNames.js +29 -0
- package/build/src/enums/AttributeNames.js.map +1 -0
- package/build/src/index.d.ts +2 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +29 -0
- package/build/src/index.js.map +1 -0
- package/build/src/types.d.ts +10 -0
- package/build/src/types.d.ts.map +1 -0
- package/build/src/types.js +18 -0
- package/build/src/types.js.map +1 -0
- package/build/src/version.d.ts +2 -0
- package/build/src/version.d.ts.map +1 -0
- package/build/src/version.js +21 -0
- package/build/src/version.js.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseOpenTelemetryComponent.js","sourceRoot":"","sources":["../../src/BaseOpenTelemetryComponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC;;GAEG;AACH;IAAgD,8CAAe;IAO7D;;OAEG;IACH,oCAAY,KAAoB;QAAhC,YACE,kBAAM,KAAK,CAAC,SAGb;QAbQ,eAAS,GAAW,YAAY,CAAC;QAC1C,gBAAU,GAAG,KAAI,CAAC,SAAS,CAAC;QAU1B,KAAI,CAAC,cAAc,GAAG,IAAI,OAAO,EAA6B,CAAC;QAC/D,KAAI,CAAC,KAAK,EAAE,CAAC;;IACf,CAAC;IAED;;;;OAIG;IACI,oCAAS,GAAhB,UAAiB,IAAY,EAAE,OAAgB;QAC7C,0BAA0B,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CACtD,IAAI,EACJ,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAC5B,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,oCAAS,GAAhB,UAAiB,MAAsB;QACrC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC3B,0BAA0B,CAAC,OAAO,GAAG,MAAM,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACK,0DAAqB,GAA7B,UACE,KAAsB,EACtB,IAAY,EACZ,UA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A0B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum AttributeNames {
|
|
2
|
+
MOUNTING_SPAN = "reactLoad: mounting",
|
|
3
|
+
UPDATING_SPAN = "reactLoad: updating",
|
|
4
|
+
UNMOUNTING_SPAN = "reactLoad: unmounting",
|
|
5
|
+
LOCATION_URL = "location",
|
|
6
|
+
REACT_NAME = "react_component_name",
|
|
7
|
+
REACT_STATE = "react_component_state",
|
|
8
|
+
REACT_ERROR = "react_error"
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AttributeNames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttributeNames.d.ts","sourceRoot":"","sources":["../../../src/enums/AttributeNames.ts"],"names":[],"mappings":"AAgBA,oBAAY,cAAc;IACxB,aAAa,wBAAwB;IACrC,aAAa,wBAAwB;IACrC,eAAe,0BAA0B;IACzC,YAAY,aAAa;IACzB,UAAU,yBAAyB;IACnC,WAAW,0BAA0B;IACrC,WAAW,gBAAgB;CAC5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export var AttributeNames;
|
|
17
|
+
(function (AttributeNames) {
|
|
18
|
+
AttributeNames["MOUNTING_SPAN"] = "reactLoad: mounting";
|
|
19
|
+
AttributeNames["UPDATING_SPAN"] = "reactLoad: updating";
|
|
20
|
+
AttributeNames["UNMOUNTING_SPAN"] = "reactLoad: unmounting";
|
|
21
|
+
AttributeNames["LOCATION_URL"] = "location";
|
|
22
|
+
AttributeNames["REACT_NAME"] = "react_component_name";
|
|
23
|
+
AttributeNames["REACT_STATE"] = "react_component_state";
|
|
24
|
+
AttributeNames["REACT_ERROR"] = "react_error";
|
|
25
|
+
})(AttributeNames || (AttributeNames = {}));
|
|
26
|
+
//# sourceMappingURL=AttributeNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttributeNames.js","sourceRoot":"","sources":["../../../src/enums/AttributeNames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,uDAAqC,CAAA;IACrC,uDAAqC,CAAA;IACrC,2DAAyC,CAAA;IACzC,2CAAyB,CAAA;IACzB,qDAAmC,CAAA;IACnC,uDAAqC,CAAA;IACrC,6CAA2B,CAAA;AAC7B,CAAC,EARW,cAAc,KAAd,cAAc,QAQzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export * from './BaseOpenTelemetryComponent';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare type RenderFunction = () => React.ReactNode;
|
|
3
|
+
export declare type ComponentDidMountFunction = (() => void) | undefined;
|
|
4
|
+
export declare type ComponentDidUpdateFunction = ((prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any) => void) | undefined;
|
|
5
|
+
export declare type ShouldComponentUpdateFunction = ((nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any) => boolean) | undefined;
|
|
6
|
+
export declare type SetStateFunction = <K extends never>(state: any | ((prevState: Readonly<any>, props: Readonly<any>) => any | Pick<any, K> | null) | Pick<any, K> | null, callback?: (() => void) | undefined) => void;
|
|
7
|
+
export declare type ForceUpdateFunction = (callback?: (() => void) | undefined) => void;
|
|
8
|
+
export declare type GetSnapshotBeforeUpdateFunction = ((prevProps: Readonly<any>, prevState: Readonly<any>) => any) | undefined;
|
|
9
|
+
export declare type ComponentWillUnmountFunction = (() => void) | undefined;
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,oBAAY,cAAc,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC;AAKnD,oBAAY,yBAAyB,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;AAKjE,oBAAY,0BAA0B,GAClC,CAAC,CACC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,EACxB,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,EACxB,QAAQ,CAAC,EAAE,GAAG,KACX,IAAI,CAAC,GACV,SAAS,CAAC;AAKd,oBAAY,6BAA6B,GACrC,CAAC,CACC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,EACxB,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,EACxB,WAAW,EAAE,GAAG,KACb,OAAO,CAAC,GACb,SAAS,CAAC;AAKd,oBAAY,gBAAgB,GAAG,CAAC,CAAC,SAAS,KAAK,EAC7C,KAAK,EACD,GAAG,GACH,CAAC,CACC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,EACxB,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,KACjB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAC/B,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GACZ,IAAI,EACR,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,KAChC,IAAI,CAAC;AAKV,oBAAY,mBAAmB,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC;AAKhF,oBAAY,+BAA+B,GACvC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,GAC7D,SAAS,CAAC;AAKd,oBAAY,4BAA4B,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
// this is autogenerated file, see scripts/version-update.js
|
|
17
|
+
export var VERSION = '0.25.0';
|
|
18
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as api from '@opentelemetry/api';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* This class is the base component for a React component with lifecycle instrumentation
|
|
5
|
+
*/
|
|
6
|
+
export declare class BaseOpenTelemetryComponent extends React.Component {
|
|
7
|
+
readonly component: string;
|
|
8
|
+
moduleName: string;
|
|
9
|
+
private _parentSpanMap;
|
|
10
|
+
private static _tracer;
|
|
11
|
+
private static _logger;
|
|
12
|
+
/**
|
|
13
|
+
* @param props Props of the React component
|
|
14
|
+
*/
|
|
15
|
+
constructor(props: Readonly<any>);
|
|
16
|
+
/**
|
|
17
|
+
* Sets the tracer for all components being instrumented
|
|
18
|
+
* @param name Name of tracer
|
|
19
|
+
* @param version Version of tracer, this is optional. When not provided it will use the latest.
|
|
20
|
+
*/
|
|
21
|
+
static setTracer(name: string, version?: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the logger for all components being instrumented
|
|
24
|
+
* @param logger
|
|
25
|
+
*/
|
|
26
|
+
static setLogger(logger: api.DiagLogger): void;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new span as a child of the current parent span.
|
|
29
|
+
* If parent span is undefined, just the child is created.
|
|
30
|
+
* @param react React component currently being instrumented
|
|
31
|
+
* @param name Name of span
|
|
32
|
+
* @param parentSpan parent span
|
|
33
|
+
*/
|
|
34
|
+
private _createSpanWithParent;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new span
|
|
37
|
+
* @param react React component currently being instrumented
|
|
38
|
+
* @param name Name of span
|
|
39
|
+
*/
|
|
40
|
+
private _createSpan;
|
|
41
|
+
/**
|
|
42
|
+
* Provides instrumentation for a function
|
|
43
|
+
* @param react React component currently instrumenting.
|
|
44
|
+
* @param spanName Name to set the span of the instrumented function to.
|
|
45
|
+
* @param original Original function currently being wrapped.
|
|
46
|
+
* @parentName Name to set parent span to on error.
|
|
47
|
+
*/
|
|
48
|
+
private _instrumentFunction;
|
|
49
|
+
/**
|
|
50
|
+
* Ends the current parent span.
|
|
51
|
+
* @param react React component parent span belongs to.
|
|
52
|
+
*/
|
|
53
|
+
private _endParentSpan;
|
|
54
|
+
/**
|
|
55
|
+
* Returns attributes object for spans
|
|
56
|
+
* @param react React component currently being instrumented
|
|
57
|
+
**/
|
|
58
|
+
private _getAttributes;
|
|
59
|
+
/**
|
|
60
|
+
* This function returns a parent span. If the parent doesn't
|
|
61
|
+
* exist, the function creates one
|
|
62
|
+
* @param react React component parent span belongs to.
|
|
63
|
+
*/
|
|
64
|
+
private _getParentSpan;
|
|
65
|
+
/**
|
|
66
|
+
* Patches the render lifecycle method
|
|
67
|
+
*/
|
|
68
|
+
private _patchRender;
|
|
69
|
+
/**
|
|
70
|
+
* Patches the componentDidMount lifecycle method
|
|
71
|
+
*/
|
|
72
|
+
private _patchComponentDidMount;
|
|
73
|
+
/**
|
|
74
|
+
* Patches the setState function
|
|
75
|
+
*/
|
|
76
|
+
private _patchSetState;
|
|
77
|
+
/**
|
|
78
|
+
* Patches the forceUpdate function
|
|
79
|
+
*/
|
|
80
|
+
private _patchForceUpdate;
|
|
81
|
+
/**
|
|
82
|
+
* Patches the shouldComponentUpdate lifecycle method
|
|
83
|
+
*/
|
|
84
|
+
private _patchShouldComponentUpdate;
|
|
85
|
+
/**
|
|
86
|
+
* Patches the shouldComponentUpdate lifecycle method
|
|
87
|
+
*/
|
|
88
|
+
private _patchGetSnapshotBeforeUpdate;
|
|
89
|
+
/**
|
|
90
|
+
* Patches the componentDidUpdate lifecycle method
|
|
91
|
+
*/
|
|
92
|
+
private _patchComponentDidUpdate;
|
|
93
|
+
/**
|
|
94
|
+
* Patches the componentWillUnmount lifecycle method
|
|
95
|
+
*/
|
|
96
|
+
private _patchComponentWillUnmount;
|
|
97
|
+
/**
|
|
98
|
+
* patch function which wraps all the lifecycle methods
|
|
99
|
+
*/
|
|
100
|
+
patch(): void;
|
|
101
|
+
/**
|
|
102
|
+
* unpatch function to unwrap all the lifecycle methods
|
|
103
|
+
*/
|
|
104
|
+
unpatch(): void;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=BaseOpenTelemetryComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseOpenTelemetryComponent.d.ts","sourceRoot":"","sources":["../../src/BaseOpenTelemetryComponent.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAI1C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK,CAAC,SAAS;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAgB;IAC1C,UAAU,SAAkB;IAC5B,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,MAAM,CAAC,OAAO,CAAa;IACnC,OAAO,CAAC,MAAM,CAAC,OAAO,CAA4B;IAElD;;OAEG;gBACS,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;IAMhC;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAOtD;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,GAAG,IAAI;IAK9C;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAgB7B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAMnB;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IA2B3B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAQtB;;;QAGI;IACJ,OAAO,CAAC,cAAc;IActB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,YAAY;IA4BpB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA0B/B;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAiCnC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IA0BrC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA4BhC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA4BlC;;OAEG;IACI,KAAK,IAAI,IAAI;IA8GpB;;OAEG;IACI,OAAO,IAAI,IAAI;CAqBvB"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.BaseOpenTelemetryComponent = void 0;
|
|
19
|
+
const api = require("@opentelemetry/api");
|
|
20
|
+
const core_1 = require("@opentelemetry/core");
|
|
21
|
+
const shimmer = require("shimmer");
|
|
22
|
+
const AttributeNames_1 = require("./enums/AttributeNames");
|
|
23
|
+
const React = require("react");
|
|
24
|
+
const version_1 = require("./version");
|
|
25
|
+
/**
|
|
26
|
+
* This class is the base component for a React component with lifecycle instrumentation
|
|
27
|
+
*/
|
|
28
|
+
class BaseOpenTelemetryComponent extends React.Component {
|
|
29
|
+
/**
|
|
30
|
+
* @param props Props of the React component
|
|
31
|
+
*/
|
|
32
|
+
constructor(props) {
|
|
33
|
+
super(props);
|
|
34
|
+
this.component = 'react-load';
|
|
35
|
+
this.moduleName = this.component;
|
|
36
|
+
this._parentSpanMap = new WeakMap();
|
|
37
|
+
this.patch();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Sets the tracer for all components being instrumented
|
|
41
|
+
* @param name Name of tracer
|
|
42
|
+
* @param version Version of tracer, this is optional. When not provided it will use the latest.
|
|
43
|
+
*/
|
|
44
|
+
static setTracer(name, version) {
|
|
45
|
+
BaseOpenTelemetryComponent._tracer = api.trace.getTracer(name, version ? version : version_1.VERSION);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Sets the logger for all components being instrumented
|
|
49
|
+
* @param logger
|
|
50
|
+
*/
|
|
51
|
+
static setLogger(logger) {
|
|
52
|
+
api.diag.setLogger(logger);
|
|
53
|
+
BaseOpenTelemetryComponent._logger = logger;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new span as a child of the current parent span.
|
|
57
|
+
* If parent span is undefined, just the child is created.
|
|
58
|
+
* @param react React component currently being instrumented
|
|
59
|
+
* @param name Name of span
|
|
60
|
+
* @param parentSpan parent span
|
|
61
|
+
*/
|
|
62
|
+
_createSpanWithParent(react, name, parentSpan) {
|
|
63
|
+
return BaseOpenTelemetryComponent._tracer.startSpan(name, {
|
|
64
|
+
attributes: this._getAttributes(react),
|
|
65
|
+
}, parentSpan
|
|
66
|
+
? api.trace.setSpan(api.context.active(), parentSpan)
|
|
67
|
+
: undefined);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new span
|
|
71
|
+
* @param react React component currently being instrumented
|
|
72
|
+
* @param name Name of span
|
|
73
|
+
*/
|
|
74
|
+
_createSpan(react, name) {
|
|
75
|
+
return BaseOpenTelemetryComponent._tracer.startSpan(name, {
|
|
76
|
+
attributes: this._getAttributes(react),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Provides instrumentation for a function
|
|
81
|
+
* @param react React component currently instrumenting.
|
|
82
|
+
* @param spanName Name to set the span of the instrumented function to.
|
|
83
|
+
* @param original Original function currently being wrapped.
|
|
84
|
+
* @parentName Name to set parent span to on error.
|
|
85
|
+
*/
|
|
86
|
+
_instrumentFunction(react, spanName, parent, original) {
|
|
87
|
+
const span = this._createSpanWithParent(react, spanName, parent);
|
|
88
|
+
let wasError = false;
|
|
89
|
+
try {
|
|
90
|
+
return api.context.with(api.trace.setSpan(api.context.active(), span), () => {
|
|
91
|
+
return original();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
span.setAttribute(AttributeNames_1.AttributeNames.REACT_ERROR, err.stack);
|
|
96
|
+
wasError = true;
|
|
97
|
+
throw err;
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
span.end();
|
|
101
|
+
if (wasError) {
|
|
102
|
+
this._endParentSpan(react);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Ends the current parent span.
|
|
108
|
+
* @param react React component parent span belongs to.
|
|
109
|
+
*/
|
|
110
|
+
_endParentSpan(react) {
|
|
111
|
+
const parentSpan = this._parentSpanMap.get(react);
|
|
112
|
+
if (parentSpan) {
|
|
113
|
+
parentSpan.end();
|
|
114
|
+
this._parentSpanMap.delete(react);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns attributes object for spans
|
|
119
|
+
* @param react React component currently being instrumented
|
|
120
|
+
**/
|
|
121
|
+
_getAttributes(react) {
|
|
122
|
+
let state;
|
|
123
|
+
try {
|
|
124
|
+
state = JSON.stringify(react.state);
|
|
125
|
+
}
|
|
126
|
+
catch (_a) {
|
|
127
|
+
state = '{"message": "state could not be turned into string"}';
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
[AttributeNames_1.AttributeNames.LOCATION_URL]: window.location.href,
|
|
131
|
+
[AttributeNames_1.AttributeNames.REACT_NAME]: react.constructor.name,
|
|
132
|
+
[AttributeNames_1.AttributeNames.REACT_STATE]: state,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* This function returns a parent span. If the parent doesn't
|
|
137
|
+
* exist, the function creates one
|
|
138
|
+
* @param react React component parent span belongs to.
|
|
139
|
+
*/
|
|
140
|
+
_getParentSpan(react, parentName) {
|
|
141
|
+
const parentSpan = this._parentSpanMap.get(react);
|
|
142
|
+
if (!parentSpan) {
|
|
143
|
+
const span = this._createSpan(react, parentName);
|
|
144
|
+
this._parentSpanMap.set(react, span);
|
|
145
|
+
}
|
|
146
|
+
return this._parentSpanMap.get(react);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Patches the render lifecycle method
|
|
150
|
+
*/
|
|
151
|
+
_patchRender() {
|
|
152
|
+
return (original) => {
|
|
153
|
+
const plugin = this;
|
|
154
|
+
return function patchRender(...args) {
|
|
155
|
+
// Render is the first method in the mounting flow, if a parent span wasn't created already then we're in the mounting flow
|
|
156
|
+
let parentSpan;
|
|
157
|
+
if (!plugin._parentSpanMap.get(this)) {
|
|
158
|
+
parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.MOUNTING_SPAN);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.UPDATING_SPAN);
|
|
162
|
+
}
|
|
163
|
+
return plugin._instrumentFunction(this, 'render', parentSpan, () => {
|
|
164
|
+
return original.apply(this, args);
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Patches the componentDidMount lifecycle method
|
|
171
|
+
*/
|
|
172
|
+
_patchComponentDidMount() {
|
|
173
|
+
return (original) => {
|
|
174
|
+
const plugin = this;
|
|
175
|
+
return function patchComponentDidMount(...args) {
|
|
176
|
+
const parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.MOUNTING_SPAN);
|
|
177
|
+
const apply = plugin._instrumentFunction(this, 'componentDidMount', parentSpan, () => {
|
|
178
|
+
return original.apply(this, args);
|
|
179
|
+
});
|
|
180
|
+
plugin._endParentSpan(this);
|
|
181
|
+
return apply;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Patches the setState function
|
|
187
|
+
*/
|
|
188
|
+
_patchSetState() {
|
|
189
|
+
return (original) => {
|
|
190
|
+
const plugin = this;
|
|
191
|
+
return function patchSetState(...args) {
|
|
192
|
+
const parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.UPDATING_SPAN);
|
|
193
|
+
return plugin._instrumentFunction(this, 'setState()', parentSpan, () => {
|
|
194
|
+
return original.apply(this, args);
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Patches the forceUpdate function
|
|
201
|
+
*/
|
|
202
|
+
_patchForceUpdate() {
|
|
203
|
+
return (original) => {
|
|
204
|
+
const plugin = this;
|
|
205
|
+
return function patchForceUpdate(...args) {
|
|
206
|
+
const parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.UPDATING_SPAN);
|
|
207
|
+
return plugin._instrumentFunction(this, 'forceUpdate()', parentSpan, () => {
|
|
208
|
+
return original.apply(this, args);
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Patches the shouldComponentUpdate lifecycle method
|
|
215
|
+
*/
|
|
216
|
+
_patchShouldComponentUpdate() {
|
|
217
|
+
return (original) => {
|
|
218
|
+
const plugin = this;
|
|
219
|
+
return function patchShouldComponentUpdate(...args) {
|
|
220
|
+
const parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.UPDATING_SPAN);
|
|
221
|
+
const apply = plugin._instrumentFunction(this, 'shouldComponentUpdate', parentSpan, () => {
|
|
222
|
+
return original.apply(this, args);
|
|
223
|
+
});
|
|
224
|
+
// if shouldComponentUpdate returns false, the component does not get
|
|
225
|
+
// updated and no other lifecycle methods get called
|
|
226
|
+
if (!apply) {
|
|
227
|
+
plugin._endParentSpan(this);
|
|
228
|
+
}
|
|
229
|
+
return apply;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Patches the shouldComponentUpdate lifecycle method
|
|
235
|
+
*/
|
|
236
|
+
_patchGetSnapshotBeforeUpdate() {
|
|
237
|
+
return (original) => {
|
|
238
|
+
const plugin = this;
|
|
239
|
+
return function patchGetSnapshotBeforeUpdate(...args) {
|
|
240
|
+
const parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.UPDATING_SPAN);
|
|
241
|
+
return plugin._instrumentFunction(this, 'getSnapshotBeforeUpdate', parentSpan, () => {
|
|
242
|
+
return original.apply(this, args);
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Patches the componentDidUpdate lifecycle method
|
|
249
|
+
*/
|
|
250
|
+
_patchComponentDidUpdate() {
|
|
251
|
+
return (original) => {
|
|
252
|
+
const plugin = this;
|
|
253
|
+
return function patchComponentDidUpdate(...args) {
|
|
254
|
+
const parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.UPDATING_SPAN);
|
|
255
|
+
const apply = plugin._instrumentFunction(this, 'componentDidUpdate', parentSpan, () => {
|
|
256
|
+
return original.apply(this, args);
|
|
257
|
+
});
|
|
258
|
+
plugin._endParentSpan(this);
|
|
259
|
+
return apply;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Patches the componentWillUnmount lifecycle method
|
|
265
|
+
*/
|
|
266
|
+
_patchComponentWillUnmount() {
|
|
267
|
+
return (original) => {
|
|
268
|
+
const plugin = this;
|
|
269
|
+
return function patchComponentWillUnmount(...args) {
|
|
270
|
+
const parentSpan = plugin._getParentSpan(this, AttributeNames_1.AttributeNames.UNMOUNTING_SPAN);
|
|
271
|
+
const apply = plugin._instrumentFunction(this, 'componentWillUnmount', parentSpan, () => {
|
|
272
|
+
return original.apply(this, args);
|
|
273
|
+
});
|
|
274
|
+
plugin._endParentSpan(this);
|
|
275
|
+
return apply;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* patch function which wraps all the lifecycle methods
|
|
281
|
+
*/
|
|
282
|
+
patch() {
|
|
283
|
+
BaseOpenTelemetryComponent._logger.debug('applying patch to', this.moduleName, version_1.VERSION);
|
|
284
|
+
if (core_1.isWrapped(this.render)) {
|
|
285
|
+
shimmer.unwrap(this, 'render');
|
|
286
|
+
BaseOpenTelemetryComponent._logger.warn('removing previous patch from method render');
|
|
287
|
+
}
|
|
288
|
+
if (core_1.isWrapped(this.componentDidMount)) {
|
|
289
|
+
shimmer.unwrap(this, 'componentDidMount');
|
|
290
|
+
BaseOpenTelemetryComponent._logger.warn('removing previous patch from method componentDidMount');
|
|
291
|
+
}
|
|
292
|
+
if (core_1.isWrapped(this.shouldComponentUpdate)) {
|
|
293
|
+
shimmer.unwrap(this, 'shouldComponentUpdate');
|
|
294
|
+
BaseOpenTelemetryComponent._logger.warn('removing previous patch from method shouldComponentUpdate');
|
|
295
|
+
}
|
|
296
|
+
if (core_1.isWrapped(this.getSnapshotBeforeUpdate)) {
|
|
297
|
+
shimmer.unwrap(this, 'getSnapshotBeforeUpdate');
|
|
298
|
+
BaseOpenTelemetryComponent._logger.warn('removing previous patch from method getSnapshotBeforeUpdate');
|
|
299
|
+
}
|
|
300
|
+
if (core_1.isWrapped(this.setState)) {
|
|
301
|
+
shimmer.unwrap(this, 'setState');
|
|
302
|
+
BaseOpenTelemetryComponent._logger.warn('removing previous patch from method setState');
|
|
303
|
+
}
|
|
304
|
+
if (core_1.isWrapped(this.forceUpdate)) {
|
|
305
|
+
shimmer.unwrap(this, 'forceUpdate');
|
|
306
|
+
BaseOpenTelemetryComponent._logger.warn('removing previous patch from method forceUpdate');
|
|
307
|
+
}
|
|
308
|
+
if (core_1.isWrapped(this.componentDidUpdate)) {
|
|
309
|
+
shimmer.unwrap(this, 'componentDidUpdate');
|
|
310
|
+
BaseOpenTelemetryComponent._logger.warn('removing previous patch from method componentDidUpdate');
|
|
311
|
+
}
|
|
312
|
+
if (core_1.isWrapped(this.componentWillUnmount)) {
|
|
313
|
+
shimmer.unwrap(this, 'componentWillUnmount');
|
|
314
|
+
BaseOpenTelemetryComponent._logger.warn('removing previous patch from method componentWillUnmount');
|
|
315
|
+
}
|
|
316
|
+
// Lifecycle methods must exist when patching, even if not defined in component
|
|
317
|
+
if (!this.render) {
|
|
318
|
+
this.render = () => {
|
|
319
|
+
return null;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
if (!this.componentDidMount) {
|
|
323
|
+
this.componentDidMount = () => {
|
|
324
|
+
return;
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
if (!this.shouldComponentUpdate) {
|
|
328
|
+
this.shouldComponentUpdate = () => {
|
|
329
|
+
return true;
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
if (!this.getSnapshotBeforeUpdate) {
|
|
333
|
+
this.getSnapshotBeforeUpdate = () => {
|
|
334
|
+
return null;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
if (!this.componentDidUpdate) {
|
|
338
|
+
this.componentDidUpdate = () => {
|
|
339
|
+
return;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
if (!this.componentWillUnmount) {
|
|
343
|
+
this.componentWillUnmount = () => {
|
|
344
|
+
return;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
shimmer.wrap(this, 'render', this._patchRender());
|
|
348
|
+
shimmer.wrap(this, 'componentDidMount', this._patchComponentDidMount());
|
|
349
|
+
shimmer.wrap(this, 'setState', this._patchSetState());
|
|
350
|
+
shimmer.wrap(this, 'forceUpdate', this._patchForceUpdate());
|
|
351
|
+
shimmer.wrap(this, 'shouldComponentUpdate', this._patchShouldComponentUpdate());
|
|
352
|
+
shimmer.wrap(this, 'getSnapshotBeforeUpdate', this._patchGetSnapshotBeforeUpdate());
|
|
353
|
+
shimmer.wrap(this, 'componentDidUpdate', this._patchComponentDidUpdate());
|
|
354
|
+
shimmer.wrap(this, 'componentWillUnmount', this._patchComponentWillUnmount());
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* unpatch function to unwrap all the lifecycle methods
|
|
358
|
+
*/
|
|
359
|
+
unpatch() {
|
|
360
|
+
BaseOpenTelemetryComponent._logger.debug('removing patch from', this.moduleName, version_1.VERSION);
|
|
361
|
+
shimmer.unwrap(this, 'render');
|
|
362
|
+
shimmer.unwrap(this, 'componentDidMount');
|
|
363
|
+
shimmer.unwrap(this, 'setState');
|
|
364
|
+
shimmer.unwrap(this, 'forceUpdate');
|
|
365
|
+
shimmer.unwrap(this, 'shouldComponentUpdate');
|
|
366
|
+
shimmer.unwrap(this, 'getSnapshotBeforeUpdate');
|
|
367
|
+
shimmer.unwrap(this, 'componentDidUpdate');
|
|
368
|
+
shimmer.unwrap(this, 'componentWillUnmount');
|
|
369
|
+
this._parentSpanMap = new WeakMap();
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
exports.BaseOpenTelemetryComponent = BaseOpenTelemetryComponent;
|
|
373
|
+
BaseOpenTelemetryComponent._logger = api.diag;
|
|
374
|
+
//# sourceMappingURL=BaseOpenTelemetryComponent.js.map
|