@grafana/faro-transport-otlp-http 2.8.2 → 2.10.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.
Files changed (91) hide show
  1. package/dist/bundle/faro-transport-otlp-http.iife.js +3 -1
  2. package/dist/bundle/faro-transport-otlp-http.iife.js.map +1 -0
  3. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/asyncToGenerator.js +28 -0
  4. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.js +13 -0
  5. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js +26 -0
  6. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectWithoutProperties.js +14 -0
  7. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectWithoutPropertiesLoose.js +13 -0
  8. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPrimitive.js +15 -0
  9. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPropertyKey.js +10 -0
  10. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/typeof.js +17 -0
  11. package/dist/cjs/index.js +2 -4
  12. package/dist/cjs/payload/OtelPayload.js +52 -61
  13. package/dist/cjs/payload/OtelPayload.js.map +1 -1
  14. package/dist/cjs/payload/attribute/attributeUtils.js +21 -40
  15. package/dist/cjs/payload/attribute/attributeUtils.js.map +1 -1
  16. package/dist/cjs/payload/attribute/index.js +4 -6
  17. package/dist/cjs/payload/index.js +2 -4
  18. package/dist/cjs/payload/transform/index.js +3 -5
  19. package/dist/cjs/payload/transform/transform.js +185 -169
  20. package/dist/cjs/payload/transform/transform.js.map +1 -1
  21. package/dist/cjs/payload/transform/types.js +0 -1
  22. package/dist/cjs/payload/types.js +0 -1
  23. package/dist/cjs/semconv.js +39 -23
  24. package/dist/cjs/semconv.js.map +1 -1
  25. package/dist/cjs/transport.js +117 -138
  26. package/dist/cjs/transport.js.map +1 -1
  27. package/dist/cjs/types.js +0 -1
  28. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/asyncToGenerator.js +27 -0
  29. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.js +12 -0
  30. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js +25 -0
  31. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectWithoutProperties.js +13 -0
  32. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  33. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPrimitive.js +14 -0
  34. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPropertyKey.js +9 -0
  35. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/typeof.js +11 -0
  36. package/dist/esm/index.js +2 -2
  37. package/dist/esm/payload/OtelPayload.js +53 -60
  38. package/dist/esm/payload/OtelPayload.js.map +1 -1
  39. package/dist/esm/payload/attribute/attributeUtils.js +22 -40
  40. package/dist/esm/payload/attribute/attributeUtils.js.map +1 -1
  41. package/dist/esm/payload/attribute/index.js +2 -2
  42. package/dist/esm/payload/index.js +2 -2
  43. package/dist/esm/payload/transform/index.js +2 -2
  44. package/dist/esm/payload/transform/transform.js +186 -169
  45. package/dist/esm/payload/transform/transform.js.map +1 -1
  46. package/dist/esm/payload/transform/types.js +0 -2
  47. package/dist/esm/payload/types.js +0 -2
  48. package/dist/esm/semconv.js +25 -21
  49. package/dist/esm/semconv.js.map +1 -1
  50. package/dist/esm/transport.js +118 -137
  51. package/dist/esm/transport.js.map +1 -1
  52. package/dist/esm/types.js +0 -2
  53. package/dist/types/index.d.ts +3 -2
  54. package/dist/types/payload/OtelPayload.d.ts +18 -16
  55. package/dist/types/payload/attribute/attributeUtils.d.ts +7 -4
  56. package/dist/types/payload/attribute/index.d.ts +2 -1
  57. package/dist/types/payload/index.d.ts +5 -3
  58. package/dist/types/payload/transform/index.d.ts +3 -2
  59. package/dist/types/payload/transform/transform.d.ts +8 -5
  60. package/dist/types/payload/transform/types.d.ts +45 -42
  61. package/dist/types/payload/types.d.ts +10 -6
  62. package/dist/types/semconv.d.ts +24 -21
  63. package/dist/types/transport.d.ts +19 -17
  64. package/dist/types/types.d.ts +25 -22
  65. package/package.json +8 -16
  66. package/dist/bundle/types/index.d.ts +0 -2
  67. package/dist/bundle/types/payload/OtelPayload.d.ts +0 -19
  68. package/dist/bundle/types/payload/attribute/attributeUtils.d.ts +0 -4
  69. package/dist/bundle/types/payload/attribute/index.d.ts +0 -1
  70. package/dist/bundle/types/payload/index.d.ts +0 -3
  71. package/dist/bundle/types/payload/transform/index.d.ts +0 -2
  72. package/dist/bundle/types/payload/transform/transform.d.ts +0 -5
  73. package/dist/bundle/types/payload/transform/types.d.ts +0 -52
  74. package/dist/bundle/types/payload/types.d.ts +0 -7
  75. package/dist/bundle/types/semconv.d.ts +0 -22
  76. package/dist/bundle/types/transport.d.ts +0 -18
  77. package/dist/bundle/types/types.d.ts +0 -24
  78. package/dist/cjs/index.js.map +0 -1
  79. package/dist/cjs/payload/attribute/index.js.map +0 -1
  80. package/dist/cjs/payload/index.js.map +0 -1
  81. package/dist/cjs/payload/transform/index.js.map +0 -1
  82. package/dist/cjs/payload/transform/types.js.map +0 -1
  83. package/dist/cjs/payload/types.js.map +0 -1
  84. package/dist/cjs/types.js.map +0 -1
  85. package/dist/esm/index.js.map +0 -1
  86. package/dist/esm/payload/attribute/index.js.map +0 -1
  87. package/dist/esm/payload/index.js.map +0 -1
  88. package/dist/esm/payload/transform/index.js.map +0 -1
  89. package/dist/esm/payload/transform/types.js.map +0 -1
  90. package/dist/esm/payload/types.js.map +0 -1
  91. package/dist/esm/types.js.map +0 -1
@@ -1,22 +1,25 @@
1
+ //#region src/semconv.d.ts
1
2
  /**
2
- Unstable SemConv
3
- Because the "incubating" entry-point may include breaking changes in minor versions,
4
- it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating in runtime code,
5
- but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)
6
-
7
- See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating
8
- */
9
- export declare const ATTR_BROWSER_BRANDS = "browser.brands";
10
- export declare const ATTR_BROWSER_LANGUAGE = "browser.language";
11
- export declare const ATTR_BROWSER_MOBILE = "browser.mobile";
12
- export declare const ATTR_BROWSER_PLATFORM = "browser.platform";
13
- export declare const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name";
14
- export declare const ATTR_SERVICE_NAMESPACE = "service.namespace";
15
- export declare const ATTR_SESSION_ID = "session.id";
16
- export declare const ATTR_USER_ATTRIBUTES = "user.attributes";
17
- export declare const ATTR_USER_EMAIL = "user.email";
18
- export declare const ATTR_USER_FULL_NAME = "user.full_name";
19
- export declare const ATTR_USER_HASH = "user.hash";
20
- export declare const ATTR_USER_ID = "user.id";
21
- export declare const ATTR_USER_NAME = "user.name";
22
- export declare const ATTR_USER_ROLES = "user.roles";
3
+ Unstable SemConv
4
+ Because the "incubating" entry-point may include breaking changes in minor versions,
5
+ it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating in runtime code,
6
+ but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)
7
+
8
+ See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating
9
+ */
10
+ declare const ATTR_BROWSER_BRANDS = "browser.brands";
11
+ declare const ATTR_BROWSER_LANGUAGE = "browser.language";
12
+ declare const ATTR_BROWSER_MOBILE = "browser.mobile";
13
+ declare const ATTR_BROWSER_PLATFORM = "browser.platform";
14
+ declare const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name";
15
+ declare const ATTR_SERVICE_NAMESPACE = "service.namespace";
16
+ declare const ATTR_SESSION_ID = "session.id";
17
+ declare const ATTR_USER_ATTRIBUTES = "user.attributes";
18
+ declare const ATTR_USER_EMAIL = "user.email";
19
+ declare const ATTR_USER_FULL_NAME = "user.full_name";
20
+ declare const ATTR_USER_HASH = "user.hash";
21
+ declare const ATTR_USER_ID = "user.id";
22
+ declare const ATTR_USER_NAME = "user.name";
23
+ declare const ATTR_USER_ROLES = "user.roles";
24
+ //#endregion
25
+ export { ATTR_BROWSER_BRANDS, ATTR_BROWSER_LANGUAGE, ATTR_BROWSER_MOBILE, ATTR_BROWSER_PLATFORM, ATTR_DEPLOYMENT_ENVIRONMENT_NAME, ATTR_SERVICE_NAMESPACE, ATTR_SESSION_ID, ATTR_USER_ATTRIBUTES, ATTR_USER_EMAIL, ATTR_USER_FULL_NAME, ATTR_USER_HASH, ATTR_USER_ID, ATTR_USER_NAME, ATTR_USER_ROLES };
@@ -1,18 +1,20 @@
1
- import { BaseTransport } from '@grafana/faro-core';
2
- import type { Patterns, TransportItem } from '@grafana/faro-core';
3
- import type { OtlpHttpTransportOptions } from './types';
4
- export declare class OtlpHttpTransport extends BaseTransport {
5
- private options;
6
- readonly name = "@grafana/faro-web-sdk:transport-otlp-http";
7
- readonly version = "2.8.2";
8
- private readonly promiseBuffer;
9
- private readonly rateLimitBackoffMs;
10
- private sendingTracesDisabledUntil;
11
- private sendingLogsDisabledUntil;
12
- constructor(options: OtlpHttpTransportOptions);
13
- getIgnoreUrls(): Patterns;
14
- isBatched(): boolean;
15
- send(items: TransportItem[]): Promise<void>;
16
- private sendPayload;
17
- private getRetryAfterDate;
1
+ import { OtlpHttpTransportOptions } from "./types.js";
2
+ import { BaseTransport, Patterns, TransportItem } from "@grafana/faro-core";
3
+ //#region src/transport.d.ts
4
+ declare class OtlpHttpTransport extends BaseTransport {
5
+ private options;
6
+ readonly name = "@grafana/faro-web-sdk:transport-otlp-http";
7
+ readonly version: string;
8
+ private readonly promiseBuffer;
9
+ private readonly rateLimitBackoffMs;
10
+ private sendingTracesDisabledUntil;
11
+ private sendingLogsDisabledUntil;
12
+ constructor(options: OtlpHttpTransportOptions);
13
+ override getIgnoreUrls(): Patterns;
14
+ override isBatched(): boolean;
15
+ send(items: TransportItem[]): Promise<void>;
16
+ private sendPayload;
17
+ private getRetryAfterDate;
18
18
  }
19
+ //#endregion
20
+ export { OtlpHttpTransport };
@@ -1,24 +1,27 @@
1
- import type { ExceptionEvent, MeasurementEvent, TransportItem } from '@grafana/faro-core';
2
- export interface OtlpTransportRequestOptions extends Omit<RequestInit, 'body' | 'headers'> {
3
- /**
4
- * Headers to include in every request.
5
- * Each value can be:
6
- * - a string (static value)
7
- * - a function returning a string (dynamic value)
8
- * - a function returning a Promise of string (dynamic value, async)
9
- */
10
- headers?: Record<string, string | (() => string | Promise<string>)>;
1
+ import { ExceptionEvent, MeasurementEvent, TransportItem } from "@grafana/faro-core";
2
+ //#region src/types.d.ts
3
+ interface OtlpTransportRequestOptions extends Omit<RequestInit, "body" | "headers"> {
4
+ /**
5
+ * Headers to include in every request.
6
+ * Each value can be:
7
+ * - a string (static value)
8
+ * - a function returning a string (dynamic value)
9
+ * - a function returning a Promise of string (dynamic value, async)
10
+ */
11
+ headers?: Record<string, string | (() => string | Promise<string>)>;
11
12
  }
12
- export interface OtlpHttpTransportOptions {
13
- apiKey?: string;
14
- bufferSize?: number;
15
- concurrency?: number;
16
- defaultRateLimitBackoffMs?: number;
17
- requestOptions?: OtlpTransportRequestOptions;
18
- readonly tracesURL?: string;
19
- readonly logsURL?: string;
20
- otlpTransform?: {
21
- createErrorLogBody?: (item: TransportItem<ExceptionEvent>) => string;
22
- createMeasurementLogBody?: (item: TransportItem<MeasurementEvent>) => string;
23
- };
13
+ interface OtlpHttpTransportOptions {
14
+ apiKey?: string;
15
+ bufferSize?: number;
16
+ concurrency?: number;
17
+ defaultRateLimitBackoffMs?: number;
18
+ requestOptions?: OtlpTransportRequestOptions;
19
+ readonly tracesURL?: string;
20
+ readonly logsURL?: string;
21
+ otlpTransform?: {
22
+ createErrorLogBody?: (item: TransportItem<ExceptionEvent>) => string;
23
+ createMeasurementLogBody?: (item: TransportItem<MeasurementEvent>) => string;
24
+ };
24
25
  }
26
+ //#endregion
27
+ export { OtlpHttpTransportOptions, OtlpTransportRequestOptions };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grafana/faro-transport-otlp-http",
3
- "packageManager": "yarn@4.17.0",
4
- "version": "2.8.2",
3
+ "packageManager": "yarn@4.18.0",
4
+ "version": "2.10.0",
5
5
  "description": "Faro transport which converts the Faro data model to the Otlp data model.",
6
6
  "keywords": [
7
7
  "observability",
@@ -31,17 +31,11 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "start": "yarn watch",
34
- "build": "run-s 'build:*'",
35
- "build:compile": "run-p 'build:compile:*'",
36
- "build:compile:cjs": "tsc --build tsconfig.cjs.json",
37
- "build:compile:esm": "tsc --build tsconfig.esm.json",
38
- "build:compile:bundle": "run-s 'build:compile:bundle:*'",
39
- "build:compile:bundle:create": "rollup -c ./rollup.config.js",
40
- "build:compile:bundle:remove-extras": "rimraf dist/bundle/dist",
41
- "watch": "run-s watch:compile",
42
- "watch:compile": "yarn build:compile:cjs -w",
34
+ "build": "tsdown",
35
+ "watch": "tsdown --watch",
43
36
  "clean": "rimraf dist/ yarn-error.log",
44
37
  "quality": "run-s 'quality:*'",
38
+ "quality:typecheck": "tsc -p tsconfig.typecheck.json",
45
39
  "quality:test": "jest",
46
40
  "quality:format": "prettier --cache --cache-location=../../.cache/prettier/transportOtlpHttp --ignore-path ../../.prettierignore -w \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
47
41
  "quality:lint": "run-s quality:lint:eslint quality:lint:prettier quality:lint:md",
@@ -53,15 +47,13 @@
53
47
  "quality:lint:fix:prettier": "prettier --cache --cache-location=../../.cache/prettier/transportOtlpHttp --ignore-path ../../.prettierignore -w \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
54
48
  "quality:circular-deps": "madge --circular ."
55
49
  },
56
- "devDependencies": {
57
- "@grafana/faro-core": "^2.8.2"
58
- },
59
50
  "publishConfig": {
60
51
  "access": "public"
61
52
  },
62
53
  "dependencies": {
63
- "@opentelemetry/otlp-transformer": "^0.219.0",
54
+ "@grafana/faro-core": "^2.10.0",
55
+ "@opentelemetry/otlp-transformer": "^0.221.0",
64
56
  "@opentelemetry/semantic-conventions": "^1.28.0"
65
57
  },
66
- "gitHead": "1d0a6641cd83733551ae2b1c7eb017dc655641db"
58
+ "gitHead": "6c45417e61c1b8d8158c468e38b6751297061f20"
67
59
  }
@@ -1,2 +0,0 @@
1
- export { OtlpHttpTransport } from './transport';
2
- export type { OtlpHttpTransportOptions, OtlpTransportRequestOptions } from './types';
@@ -1,19 +0,0 @@
1
- import type { InternalLogger, TransportItem } from '@grafana/faro-core';
2
- import type { OtlpHttpTransportOptions } from '../types';
3
- import type { OtelTransportPayload } from './types';
4
- type OtelPayloadParams = {
5
- internalLogger: InternalLogger;
6
- transportItem?: TransportItem;
7
- customOtlpTransform?: OtlpHttpTransportOptions['otlpTransform'];
8
- };
9
- export declare class OtelPayload {
10
- private resourceLogs;
11
- private resourceSpans;
12
- private getLogTransforms;
13
- private getTraceTransforms;
14
- private internalLogger;
15
- constructor({ internalLogger, customOtlpTransform, transportItem }: OtelPayloadParams);
16
- getPayload(): OtelTransportPayload;
17
- addResourceItem(transportItem: TransportItem): void;
18
- }
19
- export {};
@@ -1,4 +0,0 @@
1
- import type { IAnyValue, IKeyValue } from '@opentelemetry/otlp-transformer/build/src/common/internal-types';
2
- export declare function toAttributeValue(value: unknown): IAnyValue;
3
- export declare function toAttribute(attributeName: string, attributeValue: any): IKeyValue | undefined;
4
- export declare function isAttribute(item: any): item is IKeyValue;
@@ -1 +0,0 @@
1
- export { toAttribute, toAttributeValue, isAttribute } from './attributeUtils';
@@ -1,3 +0,0 @@
1
- export { OtelPayload } from './OtelPayload';
2
- export type { LogRecord, LogTransportItem, Resource, ResourceLog, ResourceLogs, Scope, ScopeLog, } from './transform/index';
3
- export type { Logs, OtelTransportPayload, Traces } from './types';
@@ -1,2 +0,0 @@
1
- export { getLogTransforms, getTraceTransforms } from './transform';
2
- export type { LogRecord, LogTransportItem, ResourceLogs, LogsTransform, Resource, ResourceLog, ResourceSpan, ResourceSpans, Scope, ScopeLog, TraceTransform, StringValueNonNullable, } from './types';
@@ -1,5 +0,0 @@
1
- import type { InternalLogger } from '@grafana/faro-core';
2
- import type { OtlpHttpTransportOptions } from '../../types';
3
- import type { LogsTransform, TraceTransform } from './types';
4
- export declare function getLogTransforms(internalLogger: InternalLogger, customOtlpTransform?: OtlpHttpTransportOptions['otlpTransform']): LogsTransform;
5
- export declare function getTraceTransforms(_internalLogger?: InternalLogger): TraceTransform;
@@ -1,52 +0,0 @@
1
- import type { IKeyValue, Resource as OtelResource } from '@opentelemetry/otlp-transformer/build/src/common/internal-types';
2
- import type { IResourceSpans } from '@opentelemetry/otlp-transformer/build/src/trace/internal-types';
3
- import type { APIEvent, Meta, TraceEvent, TransportItem } from '@grafana/faro-core';
4
- export interface Resource extends Partial<Pick<OtelResource, 'droppedAttributesCount'>> {
5
- attributes: IKeyValue[];
6
- }
7
- export interface LogRecord {
8
- timeUnixNano?: number;
9
- severityNumber?: number;
10
- severityText?: string;
11
- body?: {
12
- stringValue: string;
13
- };
14
- attributes?: IKeyValue[];
15
- traceId?: string;
16
- spanId?: string;
17
- }
18
- export type Scope = {
19
- name: string;
20
- version: string;
21
- };
22
- export interface ScopeLog {
23
- scope: Scope;
24
- logRecords: LogRecord[];
25
- }
26
- export interface ScopeSpan {
27
- scope: Scope;
28
- logRecords: LogRecord[];
29
- }
30
- export interface ResourceLog {
31
- resource: Resource;
32
- scopeLogs: ScopeLog[];
33
- }
34
- export type ResourceLogs = ResourceLog[];
35
- export interface ResourceSpan extends Omit<IResourceSpans, 'resource'> {
36
- resource: Resource;
37
- }
38
- export type ResourceSpans = ResourceSpan[];
39
- export type LogTransportItem = TransportItem<Exclude<APIEvent, 'TraceEvent'>>;
40
- export type TraceTransportItem = TransportItem<TraceEvent>;
41
- export type LogsTransform = {
42
- toResourceLog: (transportItem: LogTransportItem) => ResourceLog;
43
- toScopeLog: (transportItem: LogTransportItem) => ScopeLog;
44
- toLogRecord: (transportItem: LogTransportItem) => LogRecord;
45
- };
46
- export type TraceTransform = {
47
- toResourceSpan: (transportItem: TransportItem<TraceEvent>) => ResourceSpan;
48
- };
49
- export type ResourceMeta = Pick<Meta, 'app' | 'browser' | 'sdk'>;
50
- export type StringValueNonNullable = {
51
- stringValue: string;
52
- };
@@ -1,7 +0,0 @@
1
- import type { ResourceLogs, ResourceSpans } from './transform';
2
- export interface OtelTransportPayload {
3
- readonly resourceLogs: Readonly<ResourceLogs>;
4
- readonly resourceSpans: Readonly<ResourceSpans>;
5
- }
6
- export type Logs = Pick<OtelTransportPayload, 'resourceLogs'>;
7
- export type Traces = Pick<OtelTransportPayload, 'resourceSpans'>;
@@ -1,22 +0,0 @@
1
- /**
2
- Unstable SemConv
3
- Because the "incubating" entry-point may include breaking changes in minor versions,
4
- it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating in runtime code,
5
- but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)
6
-
7
- See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating
8
- */
9
- export declare const ATTR_BROWSER_BRANDS = "browser.brands";
10
- export declare const ATTR_BROWSER_LANGUAGE = "browser.language";
11
- export declare const ATTR_BROWSER_MOBILE = "browser.mobile";
12
- export declare const ATTR_BROWSER_PLATFORM = "browser.platform";
13
- export declare const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name";
14
- export declare const ATTR_SERVICE_NAMESPACE = "service.namespace";
15
- export declare const ATTR_SESSION_ID = "session.id";
16
- export declare const ATTR_USER_ATTRIBUTES = "user.attributes";
17
- export declare const ATTR_USER_EMAIL = "user.email";
18
- export declare const ATTR_USER_FULL_NAME = "user.full_name";
19
- export declare const ATTR_USER_HASH = "user.hash";
20
- export declare const ATTR_USER_ID = "user.id";
21
- export declare const ATTR_USER_NAME = "user.name";
22
- export declare const ATTR_USER_ROLES = "user.roles";
@@ -1,18 +0,0 @@
1
- import { BaseTransport } from '@grafana/faro-core';
2
- import type { Patterns, TransportItem } from '@grafana/faro-core';
3
- import type { OtlpHttpTransportOptions } from './types';
4
- export declare class OtlpHttpTransport extends BaseTransport {
5
- private options;
6
- readonly name = "@grafana/faro-web-sdk:transport-otlp-http";
7
- readonly version = "2.8.2";
8
- private readonly promiseBuffer;
9
- private readonly rateLimitBackoffMs;
10
- private sendingTracesDisabledUntil;
11
- private sendingLogsDisabledUntil;
12
- constructor(options: OtlpHttpTransportOptions);
13
- getIgnoreUrls(): Patterns;
14
- isBatched(): boolean;
15
- send(items: TransportItem[]): Promise<void>;
16
- private sendPayload;
17
- private getRetryAfterDate;
18
- }
@@ -1,24 +0,0 @@
1
- import type { ExceptionEvent, MeasurementEvent, TransportItem } from '@grafana/faro-core';
2
- export interface OtlpTransportRequestOptions extends Omit<RequestInit, 'body' | 'headers'> {
3
- /**
4
- * Headers to include in every request.
5
- * Each value can be:
6
- * - a string (static value)
7
- * - a function returning a string (dynamic value)
8
- * - a function returning a Promise of string (dynamic value, async)
9
- */
10
- headers?: Record<string, string | (() => string | Promise<string>)>;
11
- }
12
- export interface OtlpHttpTransportOptions {
13
- apiKey?: string;
14
- bufferSize?: number;
15
- concurrency?: number;
16
- defaultRateLimitBackoffMs?: number;
17
- requestOptions?: OtlpTransportRequestOptions;
18
- readonly tracesURL?: string;
19
- readonly logsURL?: string;
20
- otlpTransform?: {
21
- createErrorLogBody?: (item: TransportItem<ExceptionEvent>) => string;
22
- createMeasurementLogBody?: (item: TransportItem<MeasurementEvent>) => string;
23
- };
24
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA","sourcesContent":["export { OtlpHttpTransport } from './transport';\nexport type { OtlpHttpTransportOptions, OtlpTransportRequestOptions } from './types';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/payload/attribute/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8E;AAArE,6GAAA,WAAW,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAAE,6GAAA,WAAW,OAAA","sourcesContent":["export { toAttribute, toAttributeValue, isAttribute } from './attributeUtils';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/payload/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA","sourcesContent":["export { OtelPayload } from './OtelPayload';\nexport type {\n LogRecord,\n LogTransportItem,\n Resource,\n ResourceLog,\n ResourceLogs,\n Scope,\n ScopeLog,\n} from './transform/index';\nexport type { Logs, OtelTransportPayload, Traces } from './types';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/payload/transform/index.ts"],"names":[],"mappings":";;;AAAA,yCAAmE;AAA1D,6GAAA,gBAAgB,OAAA;AAAE,+GAAA,kBAAkB,OAAA","sourcesContent":["export { getLogTransforms, getTraceTransforms } from './transform';\nexport type {\n LogRecord,\n LogTransportItem,\n ResourceLogs,\n LogsTransform,\n Resource,\n ResourceLog,\n ResourceSpan,\n ResourceSpans,\n Scope,\n ScopeLog,\n TraceTransform,\n StringValueNonNullable,\n} from './types';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/payload/transform/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n IKeyValue,\n Resource as OtelResource,\n} from '@opentelemetry/otlp-transformer/build/src/common/internal-types';\nimport type { IResourceSpans } from '@opentelemetry/otlp-transformer/build/src/trace/internal-types';\n\nimport type { APIEvent, Meta, TraceEvent, TransportItem } from '@grafana/faro-core';\n\nexport interface Resource extends Partial<Pick<OtelResource, 'droppedAttributesCount'>> {\n attributes: IKeyValue[];\n}\n\nexport interface LogRecord {\n timeUnixNano?: number;\n severityNumber?: number;\n severityText?: string;\n body?: { stringValue: string };\n attributes?: IKeyValue[];\n traceId?: string;\n spanId?: string;\n}\n\nexport type Scope = {\n name: string;\n version: string;\n};\n\nexport interface ScopeLog {\n scope: Scope;\n logRecords: LogRecord[];\n}\n\nexport interface ScopeSpan {\n scope: Scope;\n logRecords: LogRecord[];\n}\n\nexport interface ResourceLog {\n resource: Resource;\n scopeLogs: ScopeLog[];\n}\n\nexport type ResourceLogs = ResourceLog[];\n\nexport interface ResourceSpan extends Omit<IResourceSpans, 'resource'> {\n resource: Resource;\n}\n\nexport type ResourceSpans = ResourceSpan[];\n\nexport type LogTransportItem = TransportItem<Exclude<APIEvent, 'TraceEvent'>>;\nexport type TraceTransportItem = TransportItem<TraceEvent>;\n\nexport type LogsTransform = {\n toResourceLog: (transportItem: LogTransportItem) => ResourceLog;\n toScopeLog: (transportItem: LogTransportItem) => ScopeLog;\n toLogRecord: (transportItem: LogTransportItem) => LogRecord;\n};\n\nexport type TraceTransform = {\n toResourceSpan: (transportItem: TransportItem<TraceEvent>) => ResourceSpan;\n};\n\nexport type ResourceMeta = Pick<Meta, 'app' | 'browser' | 'sdk'>;\n\nexport type StringValueNonNullable = { stringValue: string };\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/payload/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ResourceLogs, ResourceSpans } from './transform';\n\nexport interface OtelTransportPayload {\n readonly resourceLogs: Readonly<ResourceLogs>;\n readonly resourceSpans: Readonly<ResourceSpans>;\n}\n\nexport type Logs = Pick<OtelTransportPayload, 'resourceLogs'>;\nexport type Traces = Pick<OtelTransportPayload, 'resourceSpans'>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ExceptionEvent, MeasurementEvent, TransportItem } from '@grafana/faro-core';\n\nexport interface OtlpTransportRequestOptions extends Omit<RequestInit, 'body' | 'headers'> {\n /**\n * Headers to include in every request.\n * Each value can be:\n * - a string (static value)\n * - a function returning a string (dynamic value)\n * - a function returning a Promise of string (dynamic value, async)\n */\n headers?: Record<string, string | (() => string | Promise<string>)>;\n}\n\nexport interface OtlpHttpTransportOptions {\n // will be added as `x-api-key` header\n apiKey?: string;\n\n // how many requests to buffer in total\n bufferSize?: number;\n\n // how many requests to execute concurrently\n concurrency?: number;\n\n // if rate limit response does not include a Retry-After header,\n // how many milliseconds to back off before attempting a request.\n // intermediate events will be dropped, not buffered\n defaultRateLimitBackoffMs?: number;\n\n // addition options for global.Fetch\n requestOptions?: OtlpTransportRequestOptions;\n\n // The Otel spec defines separate endpoints per signal\n readonly tracesURL?: string;\n readonly logsURL?: string;\n\n // customize aspects about logs transformation\n otlpTransform?: {\n // Body field is optional in Otel Log spec, but can cause issues with Otel Collector components.\n // By default Faro does not send a body for logs of type error and measurement.\n // Users can define a body string by using the following functions.\n createErrorLogBody?: (item: TransportItem<ExceptionEvent>) => string;\n createMeasurementLogBody?: (item: TransportItem<MeasurementEvent>) => string;\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { OtlpHttpTransport } from './transport';\nexport type { OtlpHttpTransportOptions, OtlpTransportRequestOptions } from './types';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/payload/attribute/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { toAttribute, toAttributeValue, isAttribute } from './attributeUtils';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/payload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { OtelPayload } from './OtelPayload';\nexport type {\n LogRecord,\n LogTransportItem,\n Resource,\n ResourceLog,\n ResourceLogs,\n Scope,\n ScopeLog,\n} from './transform/index';\nexport type { Logs, OtelTransportPayload, Traces } from './types';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/payload/transform/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { getLogTransforms, getTraceTransforms } from './transform';\nexport type {\n LogRecord,\n LogTransportItem,\n ResourceLogs,\n LogsTransform,\n Resource,\n ResourceLog,\n ResourceSpan,\n ResourceSpans,\n Scope,\n ScopeLog,\n TraceTransform,\n StringValueNonNullable,\n} from './types';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/payload/transform/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n IKeyValue,\n Resource as OtelResource,\n} from '@opentelemetry/otlp-transformer/build/src/common/internal-types';\nimport type { IResourceSpans } from '@opentelemetry/otlp-transformer/build/src/trace/internal-types';\n\nimport type { APIEvent, Meta, TraceEvent, TransportItem } from '@grafana/faro-core';\n\nexport interface Resource extends Partial<Pick<OtelResource, 'droppedAttributesCount'>> {\n attributes: IKeyValue[];\n}\n\nexport interface LogRecord {\n timeUnixNano?: number;\n severityNumber?: number;\n severityText?: string;\n body?: { stringValue: string };\n attributes?: IKeyValue[];\n traceId?: string;\n spanId?: string;\n}\n\nexport type Scope = {\n name: string;\n version: string;\n};\n\nexport interface ScopeLog {\n scope: Scope;\n logRecords: LogRecord[];\n}\n\nexport interface ScopeSpan {\n scope: Scope;\n logRecords: LogRecord[];\n}\n\nexport interface ResourceLog {\n resource: Resource;\n scopeLogs: ScopeLog[];\n}\n\nexport type ResourceLogs = ResourceLog[];\n\nexport interface ResourceSpan extends Omit<IResourceSpans, 'resource'> {\n resource: Resource;\n}\n\nexport type ResourceSpans = ResourceSpan[];\n\nexport type LogTransportItem = TransportItem<Exclude<APIEvent, 'TraceEvent'>>;\nexport type TraceTransportItem = TransportItem<TraceEvent>;\n\nexport type LogsTransform = {\n toResourceLog: (transportItem: LogTransportItem) => ResourceLog;\n toScopeLog: (transportItem: LogTransportItem) => ScopeLog;\n toLogRecord: (transportItem: LogTransportItem) => LogRecord;\n};\n\nexport type TraceTransform = {\n toResourceSpan: (transportItem: TransportItem<TraceEvent>) => ResourceSpan;\n};\n\nexport type ResourceMeta = Pick<Meta, 'app' | 'browser' | 'sdk'>;\n\nexport type StringValueNonNullable = { stringValue: string };\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/payload/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ResourceLogs, ResourceSpans } from './transform';\n\nexport interface OtelTransportPayload {\n readonly resourceLogs: Readonly<ResourceLogs>;\n readonly resourceSpans: Readonly<ResourceSpans>;\n}\n\nexport type Logs = Pick<OtelTransportPayload, 'resourceLogs'>;\nexport type Traces = Pick<OtelTransportPayload, 'resourceSpans'>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ExceptionEvent, MeasurementEvent, TransportItem } from '@grafana/faro-core';\n\nexport interface OtlpTransportRequestOptions extends Omit<RequestInit, 'body' | 'headers'> {\n /**\n * Headers to include in every request.\n * Each value can be:\n * - a string (static value)\n * - a function returning a string (dynamic value)\n * - a function returning a Promise of string (dynamic value, async)\n */\n headers?: Record<string, string | (() => string | Promise<string>)>;\n}\n\nexport interface OtlpHttpTransportOptions {\n // will be added as `x-api-key` header\n apiKey?: string;\n\n // how many requests to buffer in total\n bufferSize?: number;\n\n // how many requests to execute concurrently\n concurrency?: number;\n\n // if rate limit response does not include a Retry-After header,\n // how many milliseconds to back off before attempting a request.\n // intermediate events will be dropped, not buffered\n defaultRateLimitBackoffMs?: number;\n\n // addition options for global.Fetch\n requestOptions?: OtlpTransportRequestOptions;\n\n // The Otel spec defines separate endpoints per signal\n readonly tracesURL?: string;\n readonly logsURL?: string;\n\n // customize aspects about logs transformation\n otlpTransform?: {\n // Body field is optional in Otel Log spec, but can cause issues with Otel Collector components.\n // By default Faro does not send a body for logs of type error and measurement.\n // Users can define a body string by using the following functions.\n createErrorLogBody?: (item: TransportItem<ExceptionEvent>) => string;\n createMeasurementLogBody?: (item: TransportItem<MeasurementEvent>) => string;\n };\n}\n"]}