@embrace-io/web-sdk
Version:
44 lines • 2.01 kB
text/typescript
import { PageManager } from "../../../api-page/manager/types.cjs";
import { URLDocument } from "../../../common/types.cjs";
import { PerformanceManager } from "../../../utils/PerformanceManager/types.cjs";
import "../../../utils/index.cjs";
import { DiagLogger } from "@opentelemetry/api";
import { InstrumentationConfig } from "@opentelemetry/instrumentation";
import { LogRecord } from "@opentelemetry/api-logs";
import { Metric, MetricWithAttribution, ReportOpts } from "web-vitals/attribution";
//#region src/instrumentations/web-vitals/WebVitalsInstrumentation/types.d.ts
/** @deprecated All vitals metrics are tracked */
type TrackingLevel = 'core' | 'all';
type WebVitalOnReport = (metric: MetricWithAttribution) => void;
type WebVitalListeners = Record<Metric['name'], ((onReport: WebVitalOnReport, opts?: ReportOpts) => void) | undefined>;
interface WebVitalsInstrumentationConfig extends InstrumentationConfig {
/**
* @experimental
* When true, sets the log record body to the JSON-stringified
* `web-vitals` attribution object for the metric.
*
* Note: `applyCustomLogRecordData` runs after the body is set.
* If the hook assigns a new `body`, it will overwrite the attribution data.
*/
includeRawAttribution?: boolean;
applyCustomLogRecordData?: (logRecord: LogRecord) => void;
/**
* When true, reports web vitals for each soft navigation in single-page apps
* (SPAs), in addition to the initial hard navigation. Does not have any effect
* in browsers that do not support the Soft Navigations API.
*
* Defaults to `true`.
*/
reportSoftNavs?: boolean;
listeners?: WebVitalListeners;
urlDocument?: URLDocument;
urlAttribution?: boolean;
pageManager?: PageManager;
diag?: DiagLogger;
perf?: PerformanceManager;
/** @deprecated All vitals metrics are tracked */
trackingLevel?: TrackingLevel;
}
//#endregion
export { TrackingLevel, WebVitalListeners, WebVitalOnReport, WebVitalsInstrumentationConfig };
//# sourceMappingURL=types.d.cts.map