@grafana/faro-core 1.0.0-beta3 → 1.0.0-beta4
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/README.md +9 -8
- package/dist/bundle/faro-core.iife.js +1 -0
- package/dist/cjs/utils/deepEqual.js +58 -5
- package/dist/cjs/utils/deepEqual.js.map +1 -1
- package/dist/cjs/version.js +2 -2
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/utils/deepEqual.js +55 -2
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/version.js +2 -2
- package/dist/esm/version.js.map +1 -1
- package/dist/{cjs → types}/api/events/index.d.ts +0 -0
- package/dist/{cjs → types}/api/events/initialize.d.ts +0 -0
- package/dist/{cjs → types}/api/events/types.d.ts +0 -0
- package/dist/{cjs → types}/api/exceptions/const.d.ts +0 -0
- package/dist/{cjs → types}/api/exceptions/index.d.ts +0 -0
- package/dist/{cjs → types}/api/exceptions/initialize.d.ts +0 -0
- package/dist/{cjs → types}/api/exceptions/types.d.ts +0 -0
- package/dist/{cjs → types}/api/index.d.ts +0 -0
- package/dist/{cjs → types}/api/initialize.d.ts +0 -0
- package/dist/{cjs → types}/api/logs/index.d.ts +0 -0
- package/dist/{cjs → types}/api/logs/initialize.d.ts +0 -0
- package/dist/{cjs → types}/api/logs/types.d.ts +0 -0
- package/dist/{cjs → types}/api/measurements/index.d.ts +0 -0
- package/dist/{cjs → types}/api/measurements/initialize.d.ts +0 -0
- package/dist/{cjs → types}/api/measurements/types.d.ts +0 -0
- package/dist/{cjs → types}/api/meta/index.d.ts +0 -0
- package/dist/{cjs → types}/api/meta/initialize.d.ts +0 -0
- package/dist/{cjs → types}/api/meta/types.d.ts +0 -0
- package/dist/{cjs → types}/api/traces/index.d.ts +0 -0
- package/dist/{cjs → types}/api/traces/initialize.d.ts +0 -0
- package/dist/{cjs → types}/api/traces/types.d.ts +0 -0
- package/dist/{cjs → types}/api/types.d.ts +0 -0
- package/dist/{cjs → types}/config/const.d.ts +0 -0
- package/dist/{cjs → types}/config/index.d.ts +0 -0
- package/dist/{cjs → types}/config/types.d.ts +0 -0
- package/dist/{cjs → types}/globalObject/globalObject.d.ts +0 -0
- package/dist/{cjs → types}/globalObject/index.d.ts +0 -0
- package/dist/{cjs → types}/index.d.ts +0 -0
- package/dist/{cjs → types}/initialize.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/base.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/index.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/initialize.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/types.d.ts +0 -0
- package/dist/{cjs → types}/internalLogger/const.d.ts +0 -0
- package/dist/{cjs → types}/internalLogger/createInternalLogger.d.ts +0 -0
- package/dist/{cjs → types}/internalLogger/index.d.ts +0 -0
- package/dist/{cjs → types}/internalLogger/initialize.d.ts +0 -0
- package/dist/{cjs → types}/internalLogger/types.d.ts +0 -0
- package/dist/{cjs → types}/metas/index.d.ts +0 -0
- package/dist/{cjs → types}/metas/initialize.d.ts +0 -0
- package/dist/{cjs → types}/metas/types.d.ts +0 -0
- package/dist/{cjs → types}/sdk/const.d.ts +0 -0
- package/dist/{cjs → types}/sdk/faroGlobalObject.d.ts +0 -0
- package/dist/{cjs → types}/sdk/index.d.ts +0 -0
- package/dist/{cjs → types}/sdk/internalFaroGlobalObject.d.ts +0 -0
- package/dist/{cjs → types}/sdk/register.d.ts +0 -0
- package/dist/{cjs → types}/sdk/types.d.ts +0 -0
- package/dist/{cjs → types}/semantic.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/index.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/mockConfig.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/mockInternalLogger.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/mockStacktraceParser.d.ts +0 -0
- package/dist/{cjs → types}/testUtils/mockTransport.d.ts +1 -1
- package/dist/{cjs → types}/testUtils/testPromise.d.ts +0 -0
- package/dist/{cjs → types}/transports/base.d.ts +0 -0
- package/dist/{cjs → types}/transports/const.d.ts +0 -0
- package/dist/{cjs → types}/transports/index.d.ts +0 -0
- package/dist/{cjs → types}/transports/initialize.d.ts +0 -0
- package/dist/{cjs → types}/transports/types.d.ts +0 -0
- package/dist/{cjs → types}/transports/utils.d.ts +0 -0
- package/dist/{cjs → types}/unpatchedConsole/const.d.ts +0 -0
- package/dist/{cjs → types}/unpatchedConsole/index.d.ts +0 -0
- package/dist/{cjs → types}/unpatchedConsole/initialize.d.ts +0 -0
- package/dist/{cjs → types}/unpatchedConsole/types.d.ts +0 -0
- package/dist/{cjs → types}/utils/baseObject.d.ts +0 -0
- package/dist/types/utils/deepEqual.d.ts +1 -0
- package/dist/{cjs → types}/utils/extensions.d.ts +0 -0
- package/dist/{cjs → types}/utils/getCurrentTimestamp.d.ts +0 -0
- package/dist/{cjs → types}/utils/index.d.ts +0 -0
- package/dist/{cjs → types}/utils/is.d.ts +0 -0
- package/dist/{cjs → types}/utils/logLevels.d.ts +0 -0
- package/dist/{cjs → types}/utils/noop.d.ts +0 -0
- package/dist/{cjs → types}/utils/promiseBuffer.d.ts +0 -0
- package/dist/{cjs → types}/utils/shortId.d.ts +0 -0
- package/dist/types/version.d.ts +1 -0
- package/package.json +20 -14
- package/dist/cjs/api/events/initialize.test.d.ts +0 -1
- package/dist/cjs/api/events/initialize.test.js +0 -92
- package/dist/cjs/api/events/initialize.test.js.map +0 -1
- package/dist/cjs/api/exceptions/initialize.test.d.ts +0 -1
- package/dist/cjs/api/exceptions/initialize.test.js +0 -138
- package/dist/cjs/api/exceptions/initialize.test.js.map +0 -1
- package/dist/cjs/api/logs/initialize.test.d.ts +0 -1
- package/dist/cjs/api/logs/initialize.test.js +0 -88
- package/dist/cjs/api/logs/initialize.test.js.map +0 -1
- package/dist/cjs/api/measurements/initialize.test.d.ts +0 -1
- package/dist/cjs/api/measurements/initialize.test.js +0 -123
- package/dist/cjs/api/measurements/initialize.test.js.map +0 -1
- package/dist/cjs/faro.test.d.ts +0 -1
- package/dist/cjs/faro.test.js +0 -42
- package/dist/cjs/faro.test.js.map +0 -1
- package/dist/cjs/metas/initialize.test.d.ts +0 -1
- package/dist/cjs/metas/initialize.test.js +0 -21
- package/dist/cjs/metas/initialize.test.js.map +0 -1
- package/dist/cjs/transports/transports.test.d.ts +0 -1
- package/dist/cjs/transports/transports.test.js +0 -141
- package/dist/cjs/transports/transports.test.js.map +0 -1
- package/dist/cjs/utils/deepEqual.d.ts +0 -2
- package/dist/cjs/utils/promiseBuffer.test.d.ts +0 -1
- package/dist/cjs/utils/promiseBuffer.test.js +0 -146
- package/dist/cjs/utils/promiseBuffer.test.js.map +0 -1
- package/dist/cjs/version.d.ts +0 -1
- package/dist/esm/api/events/index.d.ts +0 -2
- package/dist/esm/api/events/initialize.d.ts +0 -7
- package/dist/esm/api/events/initialize.test.d.ts +0 -1
- package/dist/esm/api/events/initialize.test.js +0 -87
- package/dist/esm/api/events/initialize.test.js.map +0 -1
- package/dist/esm/api/events/types.d.ts +0 -15
- package/dist/esm/api/exceptions/const.d.ts +0 -1
- package/dist/esm/api/exceptions/index.d.ts +0 -3
- package/dist/esm/api/exceptions/initialize.d.ts +0 -7
- package/dist/esm/api/exceptions/initialize.test.d.ts +0 -1
- package/dist/esm/api/exceptions/initialize.test.js +0 -133
- package/dist/esm/api/exceptions/initialize.test.js.map +0 -1
- package/dist/esm/api/exceptions/types.d.ts +0 -32
- package/dist/esm/api/index.d.ts +0 -9
- package/dist/esm/api/initialize.d.ts +0 -6
- package/dist/esm/api/logs/index.d.ts +0 -2
- package/dist/esm/api/logs/initialize.d.ts +0 -7
- package/dist/esm/api/logs/initialize.test.d.ts +0 -1
- package/dist/esm/api/logs/initialize.test.js +0 -83
- package/dist/esm/api/logs/initialize.test.js.map +0 -1
- package/dist/esm/api/logs/types.d.ts +0 -18
- package/dist/esm/api/measurements/index.d.ts +0 -2
- package/dist/esm/api/measurements/initialize.d.ts +0 -7
- package/dist/esm/api/measurements/initialize.test.d.ts +0 -1
- package/dist/esm/api/measurements/initialize.test.js +0 -107
- package/dist/esm/api/measurements/initialize.test.js.map +0 -1
- package/dist/esm/api/measurements/types.d.ts +0 -16
- package/dist/esm/api/meta/index.d.ts +0 -2
- package/dist/esm/api/meta/initialize.d.ts +0 -6
- package/dist/esm/api/meta/types.d.ts +0 -8
- package/dist/esm/api/traces/index.d.ts +0 -2
- package/dist/esm/api/traces/initialize.d.ts +0 -6
- package/dist/esm/api/traces/types.d.ts +0 -20
- package/dist/esm/api/types.d.ts +0 -8
- package/dist/esm/config/const.d.ts +0 -1
- package/dist/esm/config/index.d.ts +0 -2
- package/dist/esm/config/types.d.ts +0 -26
- package/dist/esm/faro.test.d.ts +0 -1
- package/dist/esm/faro.test.js +0 -40
- package/dist/esm/faro.test.js.map +0 -1
- package/dist/esm/globalObject/globalObject.d.ts +0 -7
- package/dist/esm/globalObject/index.d.ts +0 -2
- package/dist/esm/index.d.ts +0 -22
- package/dist/esm/initialize.d.ts +0 -3
- package/dist/esm/instrumentations/base.d.ts +0 -5
- package/dist/esm/instrumentations/index.d.ts +0 -3
- package/dist/esm/instrumentations/initialize.d.ts +0 -4
- package/dist/esm/instrumentations/types.d.ts +0 -10
- package/dist/esm/internalLogger/const.d.ts +0 -11
- package/dist/esm/internalLogger/createInternalLogger.d.ts +0 -4
- package/dist/esm/internalLogger/index.d.ts +0 -4
- package/dist/esm/internalLogger/initialize.d.ts +0 -5
- package/dist/esm/internalLogger/types.d.ts +0 -7
- package/dist/esm/metas/index.d.ts +0 -2
- package/dist/esm/metas/initialize.d.ts +0 -4
- package/dist/esm/metas/initialize.test.d.ts +0 -1
- package/dist/esm/metas/initialize.test.js +0 -19
- package/dist/esm/metas/initialize.test.js.map +0 -1
- package/dist/esm/metas/types.d.ts +0 -56
- package/dist/esm/sdk/const.d.ts +0 -1
- package/dist/esm/sdk/faroGlobalObject.d.ts +0 -2
- package/dist/esm/sdk/index.d.ts +0 -4
- package/dist/esm/sdk/internalFaroGlobalObject.d.ts +0 -4
- package/dist/esm/sdk/register.d.ts +0 -4
- package/dist/esm/sdk/types.d.ts +0 -18
- package/dist/esm/semantic.d.ts +0 -7
- package/dist/esm/testUtils/index.d.ts +0 -6
- package/dist/esm/testUtils/mockConfig.d.ts +0 -2
- package/dist/esm/testUtils/mockInternalLogger.d.ts +0 -2
- package/dist/esm/testUtils/mockStacktraceParser.d.ts +0 -2
- package/dist/esm/testUtils/mockTransport.d.ts +0 -12
- package/dist/esm/testUtils/testPromise.d.ts +0 -7
- package/dist/esm/transports/base.d.ts +0 -6
- package/dist/esm/transports/const.d.ts +0 -8
- package/dist/esm/transports/index.d.ts +0 -5
- package/dist/esm/transports/initialize.d.ts +0 -6
- package/dist/esm/transports/transports.test.d.ts +0 -1
- package/dist/esm/transports/transports.test.js +0 -110
- package/dist/esm/transports/transports.test.js.map +0 -1
- package/dist/esm/transports/types.d.ts +0 -37
- package/dist/esm/transports/utils.d.ts +0 -2
- package/dist/esm/unpatchedConsole/const.d.ts +0 -2
- package/dist/esm/unpatchedConsole/index.d.ts +0 -3
- package/dist/esm/unpatchedConsole/initialize.d.ts +0 -4
- package/dist/esm/unpatchedConsole/types.d.ts +0 -1
- package/dist/esm/utils/baseObject.d.ts +0 -6
- package/dist/esm/utils/deepEqual.d.ts +0 -2
- package/dist/esm/utils/extensions.d.ts +0 -19
- package/dist/esm/utils/getCurrentTimestamp.d.ts +0 -1
- package/dist/esm/utils/index.d.ts +0 -12
- package/dist/esm/utils/is.d.ts +0 -31
- package/dist/esm/utils/logLevels.d.ts +0 -10
- package/dist/esm/utils/noop.d.ts +0 -1
- package/dist/esm/utils/promiseBuffer.d.ts +0 -14
- package/dist/esm/utils/promiseBuffer.test.d.ts +0 -1
- package/dist/esm/utils/promiseBuffer.test.js +0 -87
- package/dist/esm/utils/promiseBuffer.test.js.map +0 -1
- package/dist/esm/utils/shortId.d.ts +0 -1
- package/dist/esm/version.d.ts +0 -1
|
@@ -1 +0,0 @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,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;gBAEhD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;gBAEhC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAExC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;gBAChD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;gBAEhC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAExC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE;oBACnB,UAAU,EAAE,IAAI;iBACjB,CAAC,CAAC;gBACH,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { initializeMetas } from '../../metas';\nimport { mockConfig, mockInternalLogger, MockTransport } from '../../testUtils';\nimport { initializeTransports, TransportItemType } from '../../transports';\nimport { initializeTracesAPI } from '../traces';\nimport { initializeExceptionsAPI } from './initialize';\nimport type { ExceptionEvent, ExceptionsAPI, ExceptionStackFrame } from './types';\n\ndescribe('api.exceptions', () => {\n function createAPI({ dedupe }: { dedupe: boolean } = { dedupe: true }): [ExceptionsAPI, MockTransport] {\n const transport = new MockTransport();\n const config = mockConfig({\n dedupe,\n transports: [transport],\n });\n const transports = initializeTransports(mockInternalLogger, config);\n const metas = initializeMetas(mockInternalLogger, config);\n const tracesAPI = initializeTracesAPI(mockInternalLogger, config, transports, metas);\n const api = initializeExceptionsAPI(mockInternalLogger, config, transports, metas, tracesAPI);\n\n return [api, transport];\n }\n\n describe('pushError', () => {\n let api: ExceptionsAPI;\n let transport: MockTransport;\n\n beforeEach(() => {\n [api, transport] = createAPI();\n });\n\n it('error with overrides', () => {\n const frames: ExceptionStackFrame[] = [\n {\n filename: 'foo.js',\n function: 'FooFn',\n colno: 4,\n lineno: 23,\n },\n {\n filename: 'bar.js',\n function: 'BarFn',\n colno: 6,\n lineno: 52,\n },\n ];\n\n api.pushError(new Error('test exception'), {\n stackFrames: frames,\n type: 'TestError',\n });\n\n expect(transport.items).toHaveLength(1);\n\n const payload = transport.items[0];\n expect(payload?.payload).toBeTruthy();\n expect(payload?.type).toEqual(TransportItemType.EXCEPTION);\n\n const evt = payload?.payload as ExceptionEvent;\n expect(evt.type).toEqual('TestError');\n expect(evt.value).toEqual('test exception');\n expect(evt.stacktrace).toEqual({ frames });\n });\n\n it('error without overrides', () => {\n const err = new Error('test');\n api.pushError(err);\n expect(transport.items).toHaveLength(1);\n\n const payload = transport.items[0];\n expect(payload?.meta.app?.name).toEqual('test');\n expect(payload?.payload).toBeTruthy();\n expect(payload?.type).toEqual(TransportItemType.EXCEPTION);\n\n const evt = payload?.payload as ExceptionEvent;\n expect(evt.type).toEqual('Error');\n expect(evt.value).toEqual('test');\n expect(evt.timestamp).toBeTruthy();\n\n const stacktrace = evt.stacktrace;\n expect(stacktrace).toBeTruthy();\n expect(stacktrace?.frames.length).toBeGreaterThan(3);\n expect(stacktrace?.frames[0]?.filename).toEqual('Error: test');\n });\n\n describe('Filtering', () => {\n it('filters the same event', () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n });\n\n it(\"doesn't filter events with same message and different stacktrace\", () => {\n const error1 = new Error('test');\n const error2 = new Error('test');\n\n api.pushError(error1);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error2);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with other message and same stacktrace\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.message = 'test2';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with same message and same stacktrace but different type\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.name = 'Another Type';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"filters an event and doesn't filter the next different one\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n error.name = 'Another Type';\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when dedupe is false\", () => {\n [api, transport] = createAPI({ dedupe: false });\n\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when skipDedupe is true\", () => {\n const error = new Error('test');\n\n api.pushError(error);\n expect(transport.items).toHaveLength(1);\n\n api.pushError(error, {\n skipDedupe: true,\n });\n expect(transport.items).toHaveLength(2);\n });\n });\n });\n});\n\nexport {};\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { TraceContext } from '../traces';
|
|
2
|
-
export type StacktraceParser = (err: ExtendedError) => Stacktrace;
|
|
3
|
-
export interface ExceptionStackFrame {
|
|
4
|
-
filename: string;
|
|
5
|
-
function: string;
|
|
6
|
-
colno?: number;
|
|
7
|
-
lineno?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface ExtendedError extends Error {
|
|
10
|
-
columnNumber?: number;
|
|
11
|
-
stacktrace?: Error['stack'];
|
|
12
|
-
}
|
|
13
|
-
export interface Stacktrace {
|
|
14
|
-
frames: ExceptionStackFrame[];
|
|
15
|
-
}
|
|
16
|
-
export interface ExceptionEvent {
|
|
17
|
-
timestamp: string;
|
|
18
|
-
type: string;
|
|
19
|
-
value: string;
|
|
20
|
-
stacktrace?: Stacktrace;
|
|
21
|
-
trace?: TraceContext;
|
|
22
|
-
}
|
|
23
|
-
export interface PushErrorOptions {
|
|
24
|
-
skipDedupe?: boolean;
|
|
25
|
-
stackFrames?: ExceptionStackFrame[];
|
|
26
|
-
type?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface ExceptionsAPI {
|
|
29
|
-
changeStacktraceParser: (stacktraceParser: StacktraceParser) => void;
|
|
30
|
-
getStacktraceParser: () => StacktraceParser | undefined;
|
|
31
|
-
pushError: (value: Error, options?: PushErrorOptions) => void;
|
|
32
|
-
}
|
package/dist/esm/api/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { initializeAPI } from './initialize';
|
|
2
|
-
export type { API, APIEvent } from './types';
|
|
3
|
-
export type { EventAttributes, EventEvent, EventsAPI } from './events';
|
|
4
|
-
export { defaultExceptionType } from './exceptions';
|
|
5
|
-
export type { ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, PushErrorOptions, Stacktrace, StacktraceParser, } from './exceptions';
|
|
6
|
-
export type { LogContext, LogEvent, LogsAPI, PushLogOptions } from './logs';
|
|
7
|
-
export type { MeasurementEvent, MeasurementsAPI, PushMeasurementOptions } from './measurements';
|
|
8
|
-
export type { MetaAPI } from './meta';
|
|
9
|
-
export type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../config';
|
|
2
|
-
import type { InternalLogger } from '../internalLogger';
|
|
3
|
-
import type { Metas } from '../metas';
|
|
4
|
-
import type { Transports } from '../transports';
|
|
5
|
-
import type { API } from './types';
|
|
6
|
-
export declare function initializeAPI(internalLogger: InternalLogger, config: Config, transports: Transports, metas: Metas): API;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../../config';
|
|
2
|
-
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
-
import type { Metas } from '../../metas';
|
|
4
|
-
import type { Transports } from '../../transports';
|
|
5
|
-
import type { TracesAPI } from '../traces';
|
|
6
|
-
import type { LogsAPI } from './types';
|
|
7
|
-
export declare function initializeLogsAPI(internalLogger: InternalLogger, config: Config, transports: Transports, metas: Metas, tracesApi: TracesAPI): LogsAPI;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { initializeMetas } from '../../metas';
|
|
2
|
-
import { mockConfig, mockInternalLogger, MockTransport } from '../../testUtils';
|
|
3
|
-
import { initializeTransports } from '../../transports';
|
|
4
|
-
import { LogLevel } from '../../utils';
|
|
5
|
-
import { initializeTracesAPI } from '../traces';
|
|
6
|
-
import { initializeLogsAPI } from './initialize';
|
|
7
|
-
describe('api.logs', () => {
|
|
8
|
-
function createAPI({ dedupe } = { dedupe: true }) {
|
|
9
|
-
const transport = new MockTransport();
|
|
10
|
-
const config = mockConfig({
|
|
11
|
-
dedupe,
|
|
12
|
-
transports: [transport],
|
|
13
|
-
});
|
|
14
|
-
const transports = initializeTransports(mockInternalLogger, config);
|
|
15
|
-
const metas = initializeMetas(mockInternalLogger, config);
|
|
16
|
-
const tracesAPI = initializeTracesAPI(mockInternalLogger, config, transports, metas);
|
|
17
|
-
const api = initializeLogsAPI(mockInternalLogger, config, transports, metas, tracesAPI);
|
|
18
|
-
return [api, transport];
|
|
19
|
-
}
|
|
20
|
-
describe('pushLog', () => {
|
|
21
|
-
let api;
|
|
22
|
-
let transport;
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
[api, transport] = createAPI();
|
|
25
|
-
});
|
|
26
|
-
describe('Filtering', () => {
|
|
27
|
-
it('filters the same event', () => {
|
|
28
|
-
api.pushLog(['test']);
|
|
29
|
-
expect(transport.items).toHaveLength(1);
|
|
30
|
-
api.pushLog(['test']);
|
|
31
|
-
expect(transport.items).toHaveLength(1);
|
|
32
|
-
});
|
|
33
|
-
it("doesn't filter events with partially same message", () => {
|
|
34
|
-
api.pushLog(['test', 'another test']);
|
|
35
|
-
expect(transport.items).toHaveLength(1);
|
|
36
|
-
api.pushLog(['test']);
|
|
37
|
-
expect(transport.items).toHaveLength(2);
|
|
38
|
-
});
|
|
39
|
-
it("doesn't filter events with same message and different level", () => {
|
|
40
|
-
api.pushLog(['test']);
|
|
41
|
-
expect(transport.items).toHaveLength(1);
|
|
42
|
-
api.pushLog(['test'], {
|
|
43
|
-
level: LogLevel.INFO,
|
|
44
|
-
});
|
|
45
|
-
expect(transport.items).toHaveLength(2);
|
|
46
|
-
});
|
|
47
|
-
it("doesn't filter events with same message and same level but different context", () => {
|
|
48
|
-
api.pushLog(['test']);
|
|
49
|
-
expect(transport.items).toHaveLength(1);
|
|
50
|
-
api.pushLog(['test'], {
|
|
51
|
-
context: {
|
|
52
|
-
a: 1,
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
expect(transport.items).toHaveLength(2);
|
|
56
|
-
});
|
|
57
|
-
it("filters an event and doesn't filter the next different one", () => {
|
|
58
|
-
api.pushLog(['test']);
|
|
59
|
-
expect(transport.items).toHaveLength(1);
|
|
60
|
-
api.pushLog(['test']);
|
|
61
|
-
expect(transport.items).toHaveLength(1);
|
|
62
|
-
api.pushLog(['test'], {
|
|
63
|
-
level: LogLevel.ERROR,
|
|
64
|
-
});
|
|
65
|
-
expect(transport.items).toHaveLength(2);
|
|
66
|
-
});
|
|
67
|
-
it("doesn't filter when dedupe is false", () => {
|
|
68
|
-
[api, transport] = createAPI({ dedupe: false });
|
|
69
|
-
api.pushLog(['test']);
|
|
70
|
-
expect(transport.items).toHaveLength(1);
|
|
71
|
-
api.pushLog(['test']);
|
|
72
|
-
expect(transport.items).toHaveLength(2);
|
|
73
|
-
});
|
|
74
|
-
it("doesn't filter when skipDedupe is true", () => {
|
|
75
|
-
api.pushLog(['test']);
|
|
76
|
-
expect(transport.items).toHaveLength(1);
|
|
77
|
-
api.pushLog(['test'], { skipDedupe: true });
|
|
78
|
-
expect(transport.items).toHaveLength(2);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
//# sourceMappingURL=initialize.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.test.js","sourceRoot":"","sources":["../../../../src/api/logs/initialize.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,SAAS,SAAS,CAAC,EAAE,MAAM,KAA0B,EAAE,MAAM,EAAE,IAAI,EAAE;QACnE,MAAM,SAAS,GAAG,IAAI,aAAa,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,UAAU,CAAC;YACxB,MAAM;YACN,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,KAAK,GAAG,eAAe,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QACrF,MAAM,GAAG,GAAG,iBAAi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,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;gBAC7C,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;gBAEhD,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBACtB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAExC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBACtB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;gBAChD,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBACtB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAExC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC5C,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { initializeMetas } from '../../metas';\nimport { mockConfig, mockInternalLogger, MockTransport } from '../../testUtils';\nimport { initializeTransports } from '../../transports';\nimport { LogLevel } from '../../utils';\nimport { initializeTracesAPI } from '../traces';\nimport { initializeLogsAPI } from './initialize';\nimport type { LogsAPI } from './types';\n\ndescribe('api.logs', () => {\n function createAPI({ dedupe }: { dedupe: boolean } = { dedupe: true }): [LogsAPI, MockTransport] {\n const transport = new MockTransport();\n const config = mockConfig({\n dedupe,\n transports: [transport],\n });\n const transports = initializeTransports(mockInternalLogger, config);\n const metas = initializeMetas(mockInternalLogger, config);\n const tracesAPI = initializeTracesAPI(mockInternalLogger, config, transports, metas);\n const api = initializeLogsAPI(mockInternalLogger, config, transports, metas, tracesAPI);\n\n return [api, transport];\n }\n\n describe('pushLog', () => {\n let api: LogsAPI;\n let transport: MockTransport;\n\n beforeEach(() => {\n [api, transport] = createAPI();\n });\n\n describe('Filtering', () => {\n it('filters the same event', () => {\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(1);\n\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(1);\n });\n\n it(\"doesn't filter events with partially same message\", () => {\n api.pushLog(['test', 'another test']);\n expect(transport.items).toHaveLength(1);\n\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with same message and different level\", () => {\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(1);\n\n api.pushLog(['test'], {\n level: LogLevel.INFO,\n });\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter events with same message and same level but different context\", () => {\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(1);\n\n api.pushLog(['test'], {\n context: {\n a: 1,\n },\n });\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"filters an event and doesn't filter the next different one\", () => {\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(1);\n\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(1);\n\n api.pushLog(['test'], {\n level: LogLevel.ERROR,\n });\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when dedupe is false\", () => {\n [api, transport] = createAPI({ dedupe: false });\n\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(1);\n\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when skipDedupe is true\", () => {\n api.pushLog(['test']);\n expect(transport.items).toHaveLength(1);\n\n api.pushLog(['test'], { skipDedupe: true });\n expect(transport.items).toHaveLength(2);\n });\n });\n });\n});\n\nexport {};\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { BaseObject, LogLevel } from '../../utils';
|
|
2
|
-
import type { TraceContext } from '../traces';
|
|
3
|
-
export type LogContext = BaseObject;
|
|
4
|
-
export interface LogEvent {
|
|
5
|
-
context: LogContext;
|
|
6
|
-
level: LogLevel;
|
|
7
|
-
message: string;
|
|
8
|
-
timestamp: string;
|
|
9
|
-
trace?: TraceContext;
|
|
10
|
-
}
|
|
11
|
-
export interface PushLogOptions {
|
|
12
|
-
context?: LogContext;
|
|
13
|
-
level?: LogLevel;
|
|
14
|
-
skipDedupe?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface LogsAPI {
|
|
17
|
-
pushLog: (args: unknown[], options?: PushLogOptions) => void;
|
|
18
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../../config';
|
|
2
|
-
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
-
import type { Metas } from '../../metas';
|
|
4
|
-
import type { Transports } from '../../transports';
|
|
5
|
-
import type { TracesAPI } from '../traces';
|
|
6
|
-
import type { MeasurementsAPI } from './types';
|
|
7
|
-
export declare function initializeMeasurementsAPI(internalLogger: InternalLogger, config: Config, transports: Transports, metas: Metas, tracesApi: TracesAPI): MeasurementsAPI;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { initializeMetas } from '../../metas';
|
|
2
|
-
import { mockConfig, mockInternalLogger, MockTransport } from '../../testUtils';
|
|
3
|
-
import { initializeTransports } from '../../transports';
|
|
4
|
-
import { initializeTracesAPI } from '../traces';
|
|
5
|
-
import { initializeMeasurementsAPI } from './initialize';
|
|
6
|
-
describe('api.measurements', () => {
|
|
7
|
-
function createAPI({ dedupe } = { dedupe: true }) {
|
|
8
|
-
const transport = new MockTransport();
|
|
9
|
-
const config = mockConfig({
|
|
10
|
-
dedupe,
|
|
11
|
-
transports: [transport],
|
|
12
|
-
});
|
|
13
|
-
const transports = initializeTransports(mockInternalLogger, config);
|
|
14
|
-
const metas = initializeMetas(mockInternalLogger, config);
|
|
15
|
-
const tracesAPI = initializeTracesAPI(mockInternalLogger, config, transports, metas);
|
|
16
|
-
const api = initializeMeasurementsAPI(mockInternalLogger, config, transports, metas, tracesAPI);
|
|
17
|
-
return [api, transport];
|
|
18
|
-
}
|
|
19
|
-
describe('pushMeasurement', () => {
|
|
20
|
-
let api;
|
|
21
|
-
let transport;
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
[api, transport] = createAPI();
|
|
24
|
-
});
|
|
25
|
-
describe('Filtering', () => {
|
|
26
|
-
it('filters the same measurement', () => {
|
|
27
|
-
const measurement = {
|
|
28
|
-
type: 'custom',
|
|
29
|
-
values: {
|
|
30
|
-
a: 1,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
api.pushMeasurement(measurement);
|
|
34
|
-
expect(transport.items).toHaveLength(1);
|
|
35
|
-
api.pushMeasurement(measurement);
|
|
36
|
-
expect(transport.items).toHaveLength(1);
|
|
37
|
-
});
|
|
38
|
-
it("doesn't filter measurements with same type and partially same values", () => {
|
|
39
|
-
const measurement1 = {
|
|
40
|
-
type: 'custom',
|
|
41
|
-
values: {
|
|
42
|
-
a: 1,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
const measurement2 = Object.assign(Object.assign({}, measurement1), { values: Object.assign(Object.assign({}, measurement1.values), { b: 2 }) });
|
|
46
|
-
api.pushMeasurement(measurement1);
|
|
47
|
-
expect(transport.items).toHaveLength(1);
|
|
48
|
-
api.pushMeasurement(measurement2);
|
|
49
|
-
expect(transport.items).toHaveLength(2);
|
|
50
|
-
});
|
|
51
|
-
it("doesn't filter measurements with different type and same values", () => {
|
|
52
|
-
const measurement1 = {
|
|
53
|
-
type: 'custom',
|
|
54
|
-
values: {
|
|
55
|
-
a: 1,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
const measurement2 = Object.assign(Object.assign({}, measurement1), { type: 'web-vitals' });
|
|
59
|
-
api.pushMeasurement(measurement1);
|
|
60
|
-
expect(transport.items).toHaveLength(1);
|
|
61
|
-
api.pushMeasurement(measurement2);
|
|
62
|
-
expect(transport.items).toHaveLength(2);
|
|
63
|
-
});
|
|
64
|
-
it("filters a measurement and doesn't filter the next different one", () => {
|
|
65
|
-
const measurement1 = {
|
|
66
|
-
type: 'custom',
|
|
67
|
-
values: {
|
|
68
|
-
a: 1,
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
const measurement2 = Object.assign(Object.assign({}, measurement1), { type: 'web-vitals' });
|
|
72
|
-
api.pushMeasurement(measurement1);
|
|
73
|
-
expect(transport.items).toHaveLength(1);
|
|
74
|
-
api.pushMeasurement(measurement1);
|
|
75
|
-
expect(transport.items).toHaveLength(1);
|
|
76
|
-
api.pushMeasurement(measurement2);
|
|
77
|
-
expect(transport.items).toHaveLength(2);
|
|
78
|
-
});
|
|
79
|
-
it("doesn't filter when dedupe is false", () => {
|
|
80
|
-
[api, transport] = createAPI({ dedupe: false });
|
|
81
|
-
const measurement = {
|
|
82
|
-
type: 'custom',
|
|
83
|
-
values: {
|
|
84
|
-
a: 1,
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
api.pushMeasurement(measurement);
|
|
88
|
-
expect(transport.items).toHaveLength(1);
|
|
89
|
-
api.pushMeasurement(measurement);
|
|
90
|
-
expect(transport.items).toHaveLength(2);
|
|
91
|
-
});
|
|
92
|
-
it("doesn't filter when skipDedupe is true", () => {
|
|
93
|
-
const measurement = {
|
|
94
|
-
type: 'custom',
|
|
95
|
-
values: {
|
|
96
|
-
a: 1,
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
api.pushMeasurement(measurement);
|
|
100
|
-
expect(transport.items).toHaveLength(1);
|
|
101
|
-
api.pushMeasurement(measurement, { skipDedupe: true });
|
|
102
|
-
expect(transport.items).toHaveLength(2);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
//# sourceMappingURL=initialize.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.test.js","sourceRoot":"","sources":["../../../../src/api/measurements/initialize.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAGzD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,SAAS,SAAS,CAAC,EAAE,MAAM,KAA0B,EAAE,MAAM,EAAE,IAAI,EAAE;QACnE,MAAM,SAAS,GAAG,IAAI,aAAa,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,UAAU,CAAC;YACxB,MAAM;YACN,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,KAAK,GAAG,eAAe,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QACrF,MAAM,GAAG,GAAG,yBAAyB,CAAC,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAEhG,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,IAAI,GAAoB,CAAC;QACzB,IAAI,SAAwB,CAAC;QAE7B,UAAU,CAAC,G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M,EAAE;wBACN,CAAC,EAAE,CAAC;qBACL;iBACF,CAAC;gBAEF,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;gBACjC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAExC,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;gBACjC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;gBAChD,MAAM,WAAW,GAAG;oBAClB,IAAI,EAAE,QAAQ;oBACd,MAAM,EAAE;wBACN,CAAC,EAAE,CAAC;qBACL;iBACF,CAAC;gBAEF,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;gBACjC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAExC,GAAG,CAAC,eAAe,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBACvD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { initializeMetas } from '../../metas';\nimport { mockConfig, mockInternalLogger, MockTransport } from '../../testUtils';\nimport { initializeTransports } from '../../transports';\nimport { initializeTracesAPI } from '../traces';\nimport { initializeMeasurementsAPI } from './initialize';\nimport type { MeasurementsAPI } from './types';\n\ndescribe('api.measurements', () => {\n function createAPI({ dedupe }: { dedupe: boolean } = { dedupe: true }): [MeasurementsAPI, MockTransport] {\n const transport = new MockTransport();\n const config = mockConfig({\n dedupe,\n transports: [transport],\n });\n const transports = initializeTransports(mockInternalLogger, config);\n const metas = initializeMetas(mockInternalLogger, config);\n const tracesAPI = initializeTracesAPI(mockInternalLogger, config, transports, metas);\n const api = initializeMeasurementsAPI(mockInternalLogger, config, transports, metas, tracesAPI);\n\n return [api, transport];\n }\n\n describe('pushMeasurement', () => {\n let api: MeasurementsAPI;\n let transport: MockTransport;\n\n beforeEach(() => {\n [api, transport] = createAPI();\n });\n\n describe('Filtering', () => {\n it('filters the same measurement', () => {\n const measurement = {\n type: 'custom',\n values: {\n a: 1,\n },\n };\n\n api.pushMeasurement(measurement);\n expect(transport.items).toHaveLength(1);\n\n api.pushMeasurement(measurement);\n expect(transport.items).toHaveLength(1);\n });\n\n it(\"doesn't filter measurements with same type and partially same values\", () => {\n const measurement1 = {\n type: 'custom',\n values: {\n a: 1,\n },\n };\n\n const measurement2 = {\n ...measurement1,\n values: {\n ...measurement1.values,\n b: 2,\n },\n };\n\n api.pushMeasurement(measurement1);\n expect(transport.items).toHaveLength(1);\n\n api.pushMeasurement(measurement2);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter measurements with different type and same values\", () => {\n const measurement1 = {\n type: 'custom',\n values: {\n a: 1,\n },\n };\n\n const measurement2 = {\n ...measurement1,\n type: 'web-vitals',\n };\n\n api.pushMeasurement(measurement1);\n expect(transport.items).toHaveLength(1);\n\n api.pushMeasurement(measurement2);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"filters a measurement and doesn't filter the next different one\", () => {\n const measurement1 = {\n type: 'custom',\n values: {\n a: 1,\n },\n };\n\n const measurement2 = {\n ...measurement1,\n type: 'web-vitals',\n };\n\n api.pushMeasurement(measurement1);\n expect(transport.items).toHaveLength(1);\n\n api.pushMeasurement(measurement1);\n expect(transport.items).toHaveLength(1);\n\n api.pushMeasurement(measurement2);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when dedupe is false\", () => {\n [api, transport] = createAPI({ dedupe: false });\n\n const measurement = {\n type: 'custom',\n values: {\n a: 1,\n },\n };\n\n api.pushMeasurement(measurement);\n expect(transport.items).toHaveLength(1);\n\n api.pushMeasurement(measurement);\n expect(transport.items).toHaveLength(2);\n });\n\n it(\"doesn't filter when skipDedupe is true\", () => {\n const measurement = {\n type: 'custom',\n values: {\n a: 1,\n },\n };\n\n api.pushMeasurement(measurement);\n expect(transport.items).toHaveLength(1);\n\n api.pushMeasurement(measurement, { skipDedupe: true });\n expect(transport.items).toHaveLength(2);\n });\n });\n });\n});\n\nexport {};\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { TraceContext } from '../traces';
|
|
2
|
-
export interface MeasurementEvent<V extends {
|
|
3
|
-
[label: string]: number;
|
|
4
|
-
} = {
|
|
5
|
-
[label: string]: number;
|
|
6
|
-
}> {
|
|
7
|
-
type: string;
|
|
8
|
-
values: V;
|
|
9
|
-
trace?: TraceContext;
|
|
10
|
-
}
|
|
11
|
-
export interface PushMeasurementOptions {
|
|
12
|
-
skipDedupe?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface MeasurementsAPI {
|
|
15
|
-
pushMeasurement: (payload: MeasurementEvent, options?: PushMeasurementOptions) => void;
|
|
16
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../../config';
|
|
2
|
-
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
-
import type { Metas } from '../../metas';
|
|
4
|
-
import type { Transports } from '../../transports';
|
|
5
|
-
import type { MetaAPI } from './types';
|
|
6
|
-
export declare function initializeMetaAPI(internalLogger: InternalLogger, _config: Config, _transports: Transports, metas: Metas): MetaAPI;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { MetaSession, MetaUser } from '../../metas';
|
|
2
|
-
export interface MetaAPI {
|
|
3
|
-
setUser: (user: MetaUser) => void;
|
|
4
|
-
resetUser: () => void;
|
|
5
|
-
setSession: (session: MetaSession) => void;
|
|
6
|
-
resetSession: () => void;
|
|
7
|
-
getSession: () => MetaSession | undefined;
|
|
8
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../../config';
|
|
2
|
-
import type { InternalLogger } from '../../internalLogger';
|
|
3
|
-
import type { Metas } from '../../metas';
|
|
4
|
-
import { Transports } from '../../transports';
|
|
5
|
-
import type { TracesAPI } from './types';
|
|
6
|
-
export declare function initializeTracesAPI(internalLogger: InternalLogger, _config: Config, transports: Transports, metas: Metas): TracesAPI;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ContextAPI as OTELContextAPI, TraceAPI as OTELTraceAPI } from '@opentelemetry/api';
|
|
2
|
-
import type { IResourceSpans } from '@opentelemetry/otlp-transformer';
|
|
3
|
-
export interface TraceEvent {
|
|
4
|
-
resourceSpans?: IResourceSpans[];
|
|
5
|
-
}
|
|
6
|
-
export interface OTELApi {
|
|
7
|
-
trace: OTELTraceAPI;
|
|
8
|
-
context: OTELContextAPI;
|
|
9
|
-
}
|
|
10
|
-
export interface TracesAPI {
|
|
11
|
-
getOTEL: () => OTELApi | undefined;
|
|
12
|
-
getTraceContext: () => TraceContext | undefined;
|
|
13
|
-
initOTEL: (trace: OTELTraceAPI, context: OTELContextAPI) => void;
|
|
14
|
-
isOTELInitialized: () => boolean;
|
|
15
|
-
pushTraces: (traces: TraceEvent) => void;
|
|
16
|
-
}
|
|
17
|
-
export interface TraceContext {
|
|
18
|
-
trace_id: string;
|
|
19
|
-
span_id: string;
|
|
20
|
-
}
|
package/dist/esm/api/types.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { EventEvent, EventsAPI } from './events';
|
|
2
|
-
import type { ExceptionEvent, ExceptionsAPI } from './exceptions';
|
|
3
|
-
import type { LogEvent, LogsAPI } from './logs';
|
|
4
|
-
import type { MeasurementEvent, MeasurementsAPI } from './measurements';
|
|
5
|
-
import type { MetaAPI } from './meta';
|
|
6
|
-
import type { TraceEvent, TracesAPI } from './traces';
|
|
7
|
-
export type APIEvent = LogEvent | ExceptionEvent | MeasurementEvent | TraceEvent | EventEvent;
|
|
8
|
-
export type API = LogsAPI & ExceptionsAPI & MeasurementsAPI & TracesAPI & MetaAPI & EventsAPI;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const defaultGlobalObjectKey = "faro";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { APIEvent, StacktraceParser } from '../api';
|
|
2
|
-
import type { Instrumentation } from '../instrumentations';
|
|
3
|
-
import type { InternalLoggerLevel } from '../internalLogger';
|
|
4
|
-
import type { MetaApp, MetaItem, MetaSession, MetaUser } from '../metas';
|
|
5
|
-
import type { BeforeSendHook, Transport } from '../transports';
|
|
6
|
-
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
7
|
-
export interface Config<P = APIEvent> {
|
|
8
|
-
app: MetaApp;
|
|
9
|
-
dedupe: boolean;
|
|
10
|
-
globalObjectKey: string;
|
|
11
|
-
isolate: boolean;
|
|
12
|
-
instrumentations: Instrumentation[];
|
|
13
|
-
internalLoggerLevel: InternalLoggerLevel;
|
|
14
|
-
metas: MetaItem[];
|
|
15
|
-
parseStacktrace: StacktraceParser;
|
|
16
|
-
paused: boolean;
|
|
17
|
-
preventGlobalExposure: boolean;
|
|
18
|
-
transports: Transport[];
|
|
19
|
-
unpatchedConsole: UnpatchedConsole;
|
|
20
|
-
beforeSend?: BeforeSendHook<P>;
|
|
21
|
-
ignoreErrors?: Patterns;
|
|
22
|
-
session?: MetaSession;
|
|
23
|
-
user?: MetaUser;
|
|
24
|
-
eventDomain?: string;
|
|
25
|
-
}
|
|
26
|
-
export type Patterns = Array<string | RegExp>;
|
package/dist/esm/faro.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/esm/faro.test.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { initializeFaro } from './initialize';
|
|
2
|
-
import { mockConfig, MockTransport } from './testUtils';
|
|
3
|
-
describe('faro', () => {
|
|
4
|
-
it(`can be started paused and doesn't ingest events until unpaused`, () => {
|
|
5
|
-
const transport = new MockTransport();
|
|
6
|
-
const config = mockConfig({
|
|
7
|
-
isolate: true,
|
|
8
|
-
paused: true,
|
|
9
|
-
transports: [transport],
|
|
10
|
-
});
|
|
11
|
-
const faro = initializeFaro(config);
|
|
12
|
-
faro.api.pushLog(['test']);
|
|
13
|
-
expect(transport.items).toHaveLength(0);
|
|
14
|
-
faro.unpause();
|
|
15
|
-
faro.api.pushLog(['test2']);
|
|
16
|
-
expect(transport.items).toHaveLength(1);
|
|
17
|
-
const item = transport.items[0];
|
|
18
|
-
expect(item.payload.message).toEqual('test2');
|
|
19
|
-
});
|
|
20
|
-
it('can be started unpaused, then paused and unpaused again', () => {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
const transport = new MockTransport();
|
|
23
|
-
const config = mockConfig({
|
|
24
|
-
isolate: true,
|
|
25
|
-
transports: [transport],
|
|
26
|
-
});
|
|
27
|
-
const faro = initializeFaro(config);
|
|
28
|
-
faro.api.pushLog(['test1']);
|
|
29
|
-
expect(transport.items).toHaveLength(1);
|
|
30
|
-
faro.pause();
|
|
31
|
-
faro.api.pushLog(['test2']);
|
|
32
|
-
expect(transport.items).toHaveLength(1);
|
|
33
|
-
faro.unpause();
|
|
34
|
-
faro.api.pushLog(['test3']);
|
|
35
|
-
const items = transport.items;
|
|
36
|
-
expect((_a = items[0]) === null || _a === void 0 ? void 0 : _a.payload.message).toEqual('test1');
|
|
37
|
-
expect((_b = items[1]) === null || _b === void 0 ? void 0 : _b.payload.message).toEqual('test3');
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=faro.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"faro.test.js","sourceRoot":"","sources":["../../src/faro.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGxD,QAAQ,CAAC,MAAM,EAAE,GAA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IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5B,MAAM,KAAK,GAAG,SAAS,CAAC,KAAuC,CAAC;QAChE,MAAM,CAAC,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,CAAC,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import type { LogEvent } from './api';\nimport { initializeFaro } from './initialize';\nimport { mockConfig, MockTransport } from './testUtils';\nimport type { TransportItem } from './transports';\n\ndescribe('faro', () => {\n it(`can be started paused and doesn't ingest events until unpaused`, () => {\n const transport = new MockTransport();\n const config = mockConfig({\n isolate: true,\n paused: true,\n transports: [transport],\n });\n\n const faro = initializeFaro(config);\n faro.api.pushLog(['test']);\n expect(transport.items).toHaveLength(0);\n\n faro.unpause();\n faro.api.pushLog(['test2']);\n expect(transport.items).toHaveLength(1);\n\n const item = transport.items[0]! as TransportItem<LogEvent>;\n expect(item.payload.message).toEqual('test2');\n });\n\n it('can be started unpaused, then paused and unpaused again', () => {\n const transport = new MockTransport();\n const config = mockConfig({\n isolate: true,\n transports: [transport],\n });\n const faro = initializeFaro(config);\n\n faro.api.pushLog(['test1']);\n expect(transport.items).toHaveLength(1);\n\n faro.pause();\n faro.api.pushLog(['test2']);\n expect(transport.items).toHaveLength(1);\n\n faro.unpause();\n faro.api.pushLog(['test3']);\n const items = transport.items as Array<TransportItem<LogEvent>>;\n expect(items[0]?.payload.message).toEqual('test1');\n expect(items[1]?.payload.message).toEqual('test3');\n });\n});\n\nexport {};\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Faro, internalGlobalObjectKey } from '../sdk';
|
|
3
|
-
export type GlobalObject<T = typeof window | typeof global> = T & {
|
|
4
|
-
[label: string]: Faro;
|
|
5
|
-
[internalGlobalObjectKey]: Faro;
|
|
6
|
-
};
|
|
7
|
-
export declare const globalObject: GlobalObject<typeof globalThis | (Window & typeof globalThis)>;
|
package/dist/esm/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export { faro, getInternalFaroFromGlobalObject, internalGlobalObjectKey, isInternalFaroOnGlobalObject, setInternalFaroOnGlobalObject, } from './sdk';
|
|
2
|
-
export type { Faro } from './sdk';
|
|
3
|
-
export { defaultExceptionType } from './api';
|
|
4
|
-
export type { API, APIEvent, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, MetaAPI, OTELApi, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, } from './api';
|
|
5
|
-
export { globalObject } from './globalObject';
|
|
6
|
-
export type { GlobalObject } from './globalObject';
|
|
7
|
-
export { initializeFaro } from './initialize';
|
|
8
|
-
export { defaultGlobalObjectKey } from './config';
|
|
9
|
-
export type { Config, Patterns } from './config';
|
|
10
|
-
export { BaseInstrumentation } from './instrumentations';
|
|
11
|
-
export type { Instrumentation, Instrumentations } from './instrumentations';
|
|
12
|
-
export { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';
|
|
13
|
-
export type { InternalLogger } from './internalLogger';
|
|
14
|
-
export type { Meta, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, } from './metas';
|
|
15
|
-
export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';
|
|
16
|
-
export type { BeforeSendHook, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './transports';
|
|
17
|
-
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
18
|
-
export type { UnpatchedConsole } from './unpatchedConsole';
|
|
19
|
-
export { allLogLevels, BaseExtension, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, } from './utils';
|
|
20
|
-
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, } from './utils';
|
|
21
|
-
export { VERSION } from './version';
|
|
22
|
-
export { Conventions } from './semantic';
|
package/dist/esm/initialize.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Extension } from '../utils';
|
|
2
|
-
export interface Instrumentation extends Extension {
|
|
3
|
-
initialize: VoidFunction;
|
|
4
|
-
destroy?: VoidFunction;
|
|
5
|
-
}
|
|
6
|
-
export interface Instrumentations {
|
|
7
|
-
add: (...instrumentations: Instrumentation[]) => void;
|
|
8
|
-
instrumentations: Instrumentation[];
|
|
9
|
-
remove: (...instrumentations: Instrumentation[]) => void;
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { InternalLogger } from './types';
|
|
2
|
-
export declare enum InternalLoggerLevel {
|
|
3
|
-
OFF = 0,
|
|
4
|
-
ERROR = 1,
|
|
5
|
-
WARN = 2,
|
|
6
|
-
INFO = 3,
|
|
7
|
-
VERBOSE = 4
|
|
8
|
-
}
|
|
9
|
-
export declare const defaultInternalLoggerPrefix = "Faro";
|
|
10
|
-
export declare const defaultInternalLogger: InternalLogger;
|
|
11
|
-
export declare const defaultInternalLoggerLevel = InternalLoggerLevel.ERROR;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
2
|
-
import { InternalLoggerLevel } from './const';
|
|
3
|
-
import type { InternalLogger } from './types';
|
|
4
|
-
export declare function createInternalLogger(unpatchedConsole?: UnpatchedConsole, internalLoggerLevel?: InternalLoggerLevel): InternalLogger;
|