UNPKG

ss-js-agent

Version:
243 lines (221 loc) 6.87 kB
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import IgnoreUrl from './services/ignoreUrl'; export interface CustomOptionsType extends CustomReportOptions { jsErrors?: boolean; apiErrors?: boolean; resourceErrors?: boolean; autoTracePerf?: boolean; useFmp?: boolean; enableSPA?: boolean; vue?: any; traceSDKInternal?: boolean; detailMode?: boolean; noTraceOrigins?: (string | RegExp)[]; ignoreUrls: IgnoreUrl[]; token: string } export interface UserContext { userId?: string; countryCode?: string; } export interface CustomReportOptions { collector?: string; service?: string; pagePath?: string; serviceVersion?: string; countryCodes?: string[]; } /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export interface ICalScore { dpss: ICalScore[]; st: number; els: ElementList; root?: Element; } export type ElementList = Array<{ ele: Element; st: number; weight: number; }>; export type IPerfDetail = { redirectTime: number | undefined; // Time of redirection dnsTime: number | undefined; // DNS query time ttfbTime: number | undefined; // Time to First Byte tcpTime: number | undefined; // Tcp connection time transTime: number | undefined; // Content transfer time domAnalysisTime: number | undefined; // Dom parsing time fptTime: number | undefined; // First Paint Time or Blank Screen Time domReadyTime: number | undefined; // Dom ready time loadPageTime: number | undefined; // Page full load time resTime: number | undefined; // Synchronous load resources in the page sslTime: number | undefined; // Only valid for HTTPS ttlTime: number | undefined; // Time to interact firstPackTime: number | undefined; // first pack time fmpTime: number | undefined; // First Meaningful Paint }; /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export interface ErrorInfoFields { uniqueId: string; category: string; grade: string; message: any; errorUrl: string; line?: number; col?: number; stack?: string; firstReportedError?: boolean; // new fields timestamp: number; environment: string; level: string; errorName: string; } export interface ReportFields { service: string; serviceVersion: string; pagePath: string; } export interface StackFrame { colno?: number; filename?: string; function?: string; in_app?: boolean; lineno?: number; } export interface StackTrace { frames?: StackFrame[]; } export interface ExtFields { exception?: Exception; sdk?: SDK; userId: string; countryCode: string; breadcrumbs?: Breadcrumb[]; os: string; device: string; browser: string; } export interface Breadcrumb { type: string; category: string; message?: string; data?: KeyValue[]; level: string; timestamp: number; } interface KeyValue { key: string; value: any; } export interface Exception { type: string; value?: string; module?: string; thread_id?: number; stacktrace: StackTrace; } export interface Context { [key: string]: any; } export interface SDK { name?: string; version?: string; } export interface BrowserUA { os?: string; device?: string; browser?: string; } export enum BreadcrumbType { DEBUG = 'Debug', NAVIGATION = 'Navigation', USER_ACTION = 'User Action', ERROR = 'Error', HTTP = 'HTTP', } export enum BreadcrumbLevel { WARNING = 'Warning', INFO = 'Info', ERROR = 'Error', } /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export interface SegmentFields { traceId: string; service: string; spans: SpanFields[]; serviceInstance: string; traceSegmentId: string; } export interface SpanFields { operationName: string; startTime: number; endTime: number; spanId: number; spanLayer: string; spanType: string; isError: boolean; parentSpanId: number; componentId: number; peer: string; tags?: any; }