@opentelemetry/plugin-react-load
Version:
OpenTelemetry instrumentation for React class component lifecycle methods
106 lines • 3.31 kB
TypeScript
import * as api from '@opentelemetry/api';
import * as React from 'react';
/**
* This class is the base component for a React component with lifecycle instrumentation
*/
export declare class BaseOpenTelemetryComponent extends React.Component {
readonly component: string;
moduleName: string;
private _parentSpanMap;
private static _tracer;
private static _logger;
/**
* @param props Props of the React component
*/
constructor(props: Readonly<any>);
/**
* Sets the tracer for all components being instrumented
* @param name Name of tracer
* @param version Version of tracer, this is optional. When not provided it will use the latest.
*/
static setTracer(name: string, version?: string): void;
/**
* Sets the logger for all components being instrumented
* @param logger
*/
static setLogger(logger: api.DiagLogger): void;
/**
* Creates a new span as a child of the current parent span.
* If parent span is undefined, just the child is created.
* @param react React component currently being instrumented
* @param name Name of span
* @param parentSpan parent span
*/
private _createSpanWithParent;
/**
* Creates a new span
* @param react React component currently being instrumented
* @param name Name of span
*/
private _createSpan;
/**
* Provides instrumentation for a function
* @param react React component currently instrumenting.
* @param spanName Name to set the span of the instrumented function to.
* @param original Original function currently being wrapped.
* @parentName Name to set parent span to on error.
*/
private _instrumentFunction;
/**
* Ends the current parent span.
* @param react React component parent span belongs to.
*/
private _endParentSpan;
/**
* Returns attributes object for spans
* @param react React component currently being instrumented
**/
private _getAttributes;
/**
* This function returns a parent span. If the parent doesn't
* exist, the function creates one
* @param react React component parent span belongs to.
*/
private _getParentSpan;
/**
* Patches the render lifecycle method
*/
private _patchRender;
/**
* Patches the componentDidMount lifecycle method
*/
private _patchComponentDidMount;
/**
* Patches the setState function
*/
private _patchSetState;
/**
* Patches the forceUpdate function
*/
private _patchForceUpdate;
/**
* Patches the shouldComponentUpdate lifecycle method
*/
private _patchShouldComponentUpdate;
/**
* Patches the shouldComponentUpdate lifecycle method
*/
private _patchGetSnapshotBeforeUpdate;
/**
* Patches the componentDidUpdate lifecycle method
*/
private _patchComponentDidUpdate;
/**
* Patches the componentWillUnmount lifecycle method
*/
private _patchComponentWillUnmount;
/**
* patch function which wraps all the lifecycle methods
*/
patch(): void;
/**
* unpatch function to unwrap all the lifecycle methods
*/
unpatch(): void;
}
//# sourceMappingURL=BaseOpenTelemetryComponent.d.ts.map