@grafana/faro-transport-otlp-http 2.9.0 → 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,144 +1,123 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
2
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.OtlpHttpTransport = void 0;
24
- const faro_core_1 = require("@grafana/faro-core");
25
- const payload_1 = require("./payload");
3
+ const require_objectSpread2 = require("./_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js");
4
+ const require_payload_OtelPayload = require("./payload/OtelPayload.js");
5
+ require("./payload/index.js");
6
+ const require_asyncToGenerator = require("./_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/asyncToGenerator.js");
7
+ const require_objectWithoutProperties = require("./_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectWithoutProperties.js");
8
+ let _grafana_faro_core = require("@grafana/faro-core");
9
+ //#region src/transport.ts
10
+ const _excluded = ["headers"];
26
11
  const DEFAULT_BUFFER_SIZE = 30;
27
- const DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17
28
- const DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;
29
- const BEACON_BODY_SIZE_LIMIT = 60000;
12
+ const DEFAULT_CONCURRENCY = 5;
13
+ const DEFAULT_RATE_LIMIT_BACKOFF_MS = 5e3;
14
+ const BEACON_BODY_SIZE_LIMIT = 6e4;
30
15
  const TOO_MANY_REQUESTS = 429;
31
- class OtlpHttpTransport extends faro_core_1.BaseTransport {
32
- constructor(options) {
33
- var _a, _b, _c;
34
- super();
35
- this.options = options;
36
- this.name = '@grafana/faro-web-sdk:transport-otlp-http';
37
- this.version = faro_core_1.VERSION;
38
- this.sendingTracesDisabledUntil = new Date();
39
- this.sendingLogsDisabledUntil = new Date();
40
- this.rateLimitBackoffMs = (_a = options.defaultRateLimitBackoffMs) !== null && _a !== void 0 ? _a : DEFAULT_RATE_LIMIT_BACKOFF_MS;
41
- this.promiseBuffer = (0, faro_core_1.createPromiseBuffer)({
42
- size: (_b = options === null || options === void 0 ? void 0 : options.bufferSize) !== null && _b !== void 0 ? _b : DEFAULT_BUFFER_SIZE,
43
- concurrency: (_c = options === null || options === void 0 ? void 0 : options.concurrency) !== null && _c !== void 0 ? _c : DEFAULT_CONCURRENCY,
44
- });
45
- }
46
- getIgnoreUrls() {
47
- var _a;
48
- const { tracesURL = '', logsURL = '' } = this.options;
49
- return [tracesURL, logsURL].filter(Boolean).concat((_a = this.config.ignoreUrls) !== null && _a !== void 0 ? _a : []);
50
- }
51
- isBatched() {
52
- return true;
53
- }
54
- send(items) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- const otelPayload = new payload_1.OtelPayload({
57
- internalLogger: this.internalLogger,
58
- customOtlpTransform: this.options.otlpTransform,
59
- });
60
- items.forEach((item) => otelPayload.addResourceItem(item));
61
- yield this.sendPayload(otelPayload.getPayload());
62
- });
63
- }
64
- sendPayload(payload) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- try {
67
- const { tracesURL = '', logsURL = '' } = this.options;
68
- for (const [key, value] of Object.entries(payload)) {
69
- if (!((0, faro_core_1.isArray)(value) && value.length > 0)) {
70
- continue;
71
- }
72
- let disabledUntil;
73
- let updateDisabledUntil = (_) => { };
74
- let url = '';
75
- switch (key) {
76
- case 'resourceSpans':
77
- url = tracesURL;
78
- disabledUntil = this.sendingTracesDisabledUntil;
79
- updateDisabledUntil = (retryAfterDate) => {
80
- this.sendingTracesDisabledUntil = retryAfterDate;
81
- };
82
- break;
83
- case 'resourceLogs':
84
- url = logsURL;
85
- disabledUntil = this.sendingLogsDisabledUntil;
86
- updateDisabledUntil = (retryAfterDate) => {
87
- this.sendingLogsDisabledUntil = retryAfterDate;
88
- };
89
- break;
90
- }
91
- if (disabledUntil && disabledUntil > new Date(Date.now())) {
92
- this.logWarn(`Dropping transport item due to too many requests. Backoff until ${disabledUntil}`);
93
- return undefined;
94
- }
95
- const body = JSON.stringify({ [key]: value });
96
- const { requestOptions, apiKey } = this.options;
97
- const _a = requestOptions !== null && requestOptions !== void 0 ? requestOptions : {}, { headers = {} } = _a, restOfRequestOptions = __rest(_a, ["headers"]);
98
- if (!url) {
99
- continue;
100
- }
101
- yield this.promiseBuffer.add(() => __awaiter(this, void 0, void 0, function* () {
102
- const resolvedHeaders = {};
103
- for (const [key, value] of Object.entries(headers)) {
104
- resolvedHeaders[key] = typeof value === 'function' ? yield Promise.resolve(value()) : value;
105
- }
106
- return fetch(url, Object.assign({ method: 'POST', headers: Object.assign(Object.assign({ 'Content-Type': 'application/json' }, resolvedHeaders), (apiKey ? { 'x-api-key': apiKey } : {})), body, keepalive: body.length <= BEACON_BODY_SIZE_LIMIT }, (restOfRequestOptions !== null && restOfRequestOptions !== void 0 ? restOfRequestOptions : {})))
107
- .then((response) => {
108
- if (response.status === TOO_MANY_REQUESTS) {
109
- updateDisabledUntil(this.getRetryAfterDate(response));
110
- this.logWarn(`Too many requests, backing off until ${disabledUntil}`);
111
- }
112
- // read the body so the connection can be closed
113
- response.text().catch(faro_core_1.noop);
114
- return response;
115
- })
116
- .catch((error) => {
117
- this.logError('Failed sending payload to the receiver\n', JSON.parse(body), error);
118
- });
119
- }));
120
- }
121
- }
122
- catch (error) {
123
- this.logError(error);
124
- }
125
- });
126
- }
127
- getRetryAfterDate(response) {
128
- const now = Date.now();
129
- const retryAfterHeader = response.headers.get('Retry-After');
130
- if (retryAfterHeader) {
131
- const delay = Number(retryAfterHeader);
132
- if (!isNaN(delay)) {
133
- return new Date(delay * 1000 + now);
134
- }
135
- const date = Date.parse(retryAfterHeader);
136
- if (!isNaN(date)) {
137
- return new Date(date);
138
- }
139
- }
140
- return new Date(now + this.rateLimitBackoffMs);
141
- }
142
- }
16
+ var OtlpHttpTransport = class extends _grafana_faro_core.BaseTransport {
17
+ constructor(options) {
18
+ var _options$defaultRateL, _options$bufferSize, _options$concurrency;
19
+ super();
20
+ this.options = options;
21
+ this.name = "@grafana/faro-web-sdk:transport-otlp-http";
22
+ this.version = _grafana_faro_core.VERSION;
23
+ this.sendingTracesDisabledUntil = /* @__PURE__ */ new Date();
24
+ this.sendingLogsDisabledUntil = /* @__PURE__ */ new Date();
25
+ this.rateLimitBackoffMs = (_options$defaultRateL = options.defaultRateLimitBackoffMs) !== null && _options$defaultRateL !== void 0 ? _options$defaultRateL : DEFAULT_RATE_LIMIT_BACKOFF_MS;
26
+ this.promiseBuffer = (0, _grafana_faro_core.createPromiseBuffer)({
27
+ size: (_options$bufferSize = options === null || options === void 0 ? void 0 : options.bufferSize) !== null && _options$bufferSize !== void 0 ? _options$bufferSize : DEFAULT_BUFFER_SIZE,
28
+ concurrency: (_options$concurrency = options === null || options === void 0 ? void 0 : options.concurrency) !== null && _options$concurrency !== void 0 ? _options$concurrency : DEFAULT_CONCURRENCY
29
+ });
30
+ }
31
+ getIgnoreUrls() {
32
+ var _this$config$ignoreUr;
33
+ const { tracesURL = "", logsURL = "" } = this.options;
34
+ return [tracesURL, logsURL].filter(Boolean).concat((_this$config$ignoreUr = this.config.ignoreUrls) !== null && _this$config$ignoreUr !== void 0 ? _this$config$ignoreUr : []);
35
+ }
36
+ isBatched() {
37
+ return true;
38
+ }
39
+ send(items) {
40
+ var _this = this;
41
+ return require_asyncToGenerator.default(function* () {
42
+ const otelPayload = new require_payload_OtelPayload.OtelPayload({
43
+ internalLogger: _this.internalLogger,
44
+ customOtlpTransform: _this.options.otlpTransform
45
+ });
46
+ items.forEach((item) => otelPayload.addResourceItem(item));
47
+ yield _this.sendPayload(otelPayload.getPayload());
48
+ })();
49
+ }
50
+ sendPayload(payload) {
51
+ var _this2 = this;
52
+ return require_asyncToGenerator.default(function* () {
53
+ try {
54
+ const { tracesURL = "", logsURL = "" } = _this2.options;
55
+ for (const [key, value] of Object.entries(payload)) {
56
+ if (!((0, _grafana_faro_core.isArray)(value) && value.length > 0)) continue;
57
+ let disabledUntil;
58
+ let updateDisabledUntil = (_) => {};
59
+ let url = "";
60
+ switch (key) {
61
+ case "resourceSpans":
62
+ url = tracesURL;
63
+ disabledUntil = _this2.sendingTracesDisabledUntil;
64
+ updateDisabledUntil = (retryAfterDate) => {
65
+ _this2.sendingTracesDisabledUntil = retryAfterDate;
66
+ };
67
+ break;
68
+ case "resourceLogs":
69
+ url = logsURL;
70
+ disabledUntil = _this2.sendingLogsDisabledUntil;
71
+ updateDisabledUntil = (retryAfterDate) => {
72
+ _this2.sendingLogsDisabledUntil = retryAfterDate;
73
+ };
74
+ }
75
+ if (disabledUntil && disabledUntil > new Date(Date.now())) {
76
+ _this2.logWarn(`Dropping transport item due to too many requests. Backoff until ${disabledUntil}`);
77
+ return;
78
+ }
79
+ const body = JSON.stringify({ [key]: value });
80
+ const { requestOptions, apiKey } = _this2.options;
81
+ const _ref = requestOptions !== null && requestOptions !== void 0 ? requestOptions : {}, { headers = {} } = _ref, restOfRequestOptions = require_objectWithoutProperties.default(_ref, _excluded);
82
+ if (!url) continue;
83
+ yield _this2.promiseBuffer.add(require_asyncToGenerator.default(function* () {
84
+ const resolvedHeaders = {};
85
+ for (const [key, value] of Object.entries(headers)) resolvedHeaders[key] = typeof value === "function" ? yield Promise.resolve(value()) : value;
86
+ return fetch(url, require_objectSpread2.default({
87
+ method: "POST",
88
+ headers: require_objectSpread2.default(require_objectSpread2.default({ "Content-Type": "application/json" }, resolvedHeaders), apiKey ? { "x-api-key": apiKey } : {}),
89
+ body,
90
+ keepalive: body.length <= BEACON_BODY_SIZE_LIMIT
91
+ }, restOfRequestOptions !== null && restOfRequestOptions !== void 0 ? restOfRequestOptions : {})).then((response) => {
92
+ if (response.status === TOO_MANY_REQUESTS) {
93
+ updateDisabledUntil(_this2.getRetryAfterDate(response));
94
+ _this2.logWarn(`Too many requests, backing off until ${disabledUntil}`);
95
+ }
96
+ response.text().catch(_grafana_faro_core.noop);
97
+ return response;
98
+ }).catch((error) => {
99
+ _this2.logError("Failed sending payload to the receiver\n", JSON.parse(body), error);
100
+ });
101
+ }));
102
+ }
103
+ } catch (error) {
104
+ _this2.logError(error);
105
+ }
106
+ })();
107
+ }
108
+ getRetryAfterDate(response) {
109
+ const now = Date.now();
110
+ const retryAfterHeader = response.headers.get("Retry-After");
111
+ if (retryAfterHeader) {
112
+ const delay = Number(retryAfterHeader);
113
+ if (!isNaN(delay)) return new Date(delay * 1e3 + now);
114
+ const date = Date.parse(retryAfterHeader);
115
+ if (!isNaN(date)) return new Date(date);
116
+ }
117
+ return new Date(now + this.rateLimitBackoffMs);
118
+ }
119
+ };
120
+ //#endregion
143
121
  exports.OtlpHttpTransport = OtlpHttpTransport;
122
+
144
123
  //# sourceMappingURL=transport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAgG;AAGhG,uCAAwC;AAIxC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,mBAAmB,GAAG,CAAC,CAAC,CAAC,uCAAuC;AACtE,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAE3C,MAAM,sBAAsB,GAAG,KAAK,CAAC;AACrC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAa,iB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GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACjD,CAAC;CACF;AA5ID,8CA4IC","sourcesContent":["import { BaseTransport, createPromiseBuffer, isArray, noop, VERSION } from '@grafana/faro-core';\nimport type { Patterns, PromiseBuffer, TransportItem } from '@grafana/faro-core';\n\nimport { OtelPayload } from './payload';\nimport type { OtelTransportPayload } from './payload';\nimport type { OtlpHttpTransportOptions } from './types';\n\nconst DEFAULT_BUFFER_SIZE = 30;\nconst DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17\nconst DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;\n\nconst BEACON_BODY_SIZE_LIMIT = 60000;\nconst TOO_MANY_REQUESTS = 429;\n\nexport class OtlpHttpTransport extends BaseTransport {\n readonly name = '@grafana/faro-web-sdk:transport-otlp-http';\n readonly version = VERSION;\n\n private readonly promiseBuffer: PromiseBuffer<Response | void>;\n private readonly rateLimitBackoffMs: number;\n\n private sendingTracesDisabledUntil: Date = new Date();\n private sendingLogsDisabledUntil: Date = new Date();\n\n constructor(private options: OtlpHttpTransportOptions) {\n super();\n this.rateLimitBackoffMs = options.defaultRateLimitBackoffMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS;\n\n this.promiseBuffer = createPromiseBuffer({\n size: options?.bufferSize ?? DEFAULT_BUFFER_SIZE,\n concurrency: options?.concurrency ?? DEFAULT_CONCURRENCY,\n });\n }\n\n override getIgnoreUrls(): Patterns {\n const { tracesURL = '', logsURL = '' } = this.options;\n return ([tracesURL, logsURL].filter(Boolean) as Patterns).concat(this.config.ignoreUrls ?? []);\n }\n\n override isBatched(): boolean {\n return true;\n }\n\n async send(items: TransportItem[]): Promise<void> {\n const otelPayload = new OtelPayload({\n internalLogger: this.internalLogger,\n customOtlpTransform: this.options.otlpTransform,\n });\n\n items.forEach((item) => otelPayload.addResourceItem(item));\n await this.sendPayload(otelPayload.getPayload());\n }\n\n private async sendPayload(payload: OtelTransportPayload): Promise<void> {\n try {\n const { tracesURL = '', logsURL = '' } = this.options;\n\n for (const [key, value] of Object.entries(payload)) {\n if (!(isArray(value) && value.length > 0)) {\n continue;\n }\n\n let disabledUntil: Date | undefined;\n let updateDisabledUntil = (_: Date) => {};\n let url = '';\n\n switch (key) {\n case 'resourceSpans':\n url = tracesURL;\n disabledUntil = this.sendingTracesDisabledUntil;\n updateDisabledUntil = (retryAfterDate: Date) => {\n this.sendingTracesDisabledUntil = retryAfterDate;\n };\n break;\n case 'resourceLogs':\n url = logsURL;\n disabledUntil = this.sendingLogsDisabledUntil;\n updateDisabledUntil = (retryAfterDate: Date) => {\n this.sendingLogsDisabledUntil = retryAfterDate;\n };\n break;\n }\n\n if (disabledUntil && disabledUntil > new Date(Date.now())) {\n this.logWarn(`Dropping transport item due to too many requests. Backoff until ${disabledUntil}`);\n return undefined;\n }\n\n const body = JSON.stringify({ [key]: value });\n\n const { requestOptions, apiKey } = this.options;\n const { headers = {}, ...restOfRequestOptions } = requestOptions ?? {};\n\n if (!url) {\n continue;\n }\n\n await this.promiseBuffer.add(async () => {\n const resolvedHeaders: Record<string, string> = {};\n for (const [key, value] of Object.entries(headers)) {\n resolvedHeaders[key] = typeof value === 'function' ? await Promise.resolve(value()) : value;\n }\n\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...resolvedHeaders,\n ...(apiKey ? { 'x-api-key': apiKey } : {}),\n },\n body,\n keepalive: body.length <= BEACON_BODY_SIZE_LIMIT,\n ...(restOfRequestOptions ?? {}),\n })\n .then((response) => {\n if (response.status === TOO_MANY_REQUESTS) {\n updateDisabledUntil(this.getRetryAfterDate(response));\n this.logWarn(`Too many requests, backing off until ${disabledUntil}`);\n }\n\n // read the body so the connection can be closed\n response.text().catch(noop);\n return response;\n })\n .catch((error) => {\n this.logError('Failed sending payload to the receiver\\n', JSON.parse(body), error);\n });\n });\n }\n } catch (error) {\n this.logError(error);\n }\n }\n\n private getRetryAfterDate(response: Response): Date {\n const now = Date.now();\n const retryAfterHeader = response.headers.get('Retry-After');\n\n if (retryAfterHeader) {\n const delay = Number(retryAfterHeader);\n\n if (!isNaN(delay)) {\n return new Date(delay * 1000 + now);\n }\n\n const date = Date.parse(retryAfterHeader);\n\n if (!isNaN(date)) {\n return new Date(date);\n }\n }\n\n return new Date(now + this.rateLimitBackoffMs);\n }\n}\n"]}
1
+ {"version":3,"file":"transport.js","names":["BaseTransport","VERSION","createPromiseBuffer","OtelPayload","this","isArray","noop"],"sources":["../../src/transport.ts"],"sourcesContent":["import { BaseTransport, createPromiseBuffer, isArray, noop, VERSION } from '@grafana/faro-core';\nimport type { Patterns, PromiseBuffer, TransportItem } from '@grafana/faro-core';\n\nimport { OtelPayload } from './payload';\nimport type { OtelTransportPayload } from './payload';\nimport type { OtlpHttpTransportOptions } from './types';\n\nconst DEFAULT_BUFFER_SIZE = 30;\nconst DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17\nconst DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;\n\nconst BEACON_BODY_SIZE_LIMIT = 60000;\nconst TOO_MANY_REQUESTS = 429;\n\nexport class OtlpHttpTransport extends BaseTransport {\n readonly name = '@grafana/faro-web-sdk:transport-otlp-http';\n readonly version: string = VERSION;\n\n private readonly promiseBuffer: PromiseBuffer<Response | void>;\n private readonly rateLimitBackoffMs: number;\n\n private sendingTracesDisabledUntil: Date = new Date();\n private sendingLogsDisabledUntil: Date = new Date();\n\n constructor(private options: OtlpHttpTransportOptions) {\n super();\n this.rateLimitBackoffMs = options.defaultRateLimitBackoffMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS;\n\n this.promiseBuffer = createPromiseBuffer({\n size: options?.bufferSize ?? DEFAULT_BUFFER_SIZE,\n concurrency: options?.concurrency ?? DEFAULT_CONCURRENCY,\n });\n }\n\n override getIgnoreUrls(): Patterns {\n const { tracesURL = '', logsURL = '' } = this.options;\n return ([tracesURL, logsURL].filter(Boolean) as Patterns).concat(this.config.ignoreUrls ?? []);\n }\n\n override isBatched(): boolean {\n return true;\n }\n\n async send(items: TransportItem[]): Promise<void> {\n const otelPayload = new OtelPayload({\n internalLogger: this.internalLogger,\n customOtlpTransform: this.options.otlpTransform,\n });\n\n items.forEach((item) => otelPayload.addResourceItem(item));\n await this.sendPayload(otelPayload.getPayload());\n }\n\n private async sendPayload(payload: OtelTransportPayload): Promise<void> {\n try {\n const { tracesURL = '', logsURL = '' } = this.options;\n\n for (const [key, value] of Object.entries(payload)) {\n if (!(isArray(value) && value.length > 0)) {\n continue;\n }\n\n let disabledUntil: Date | undefined;\n let updateDisabledUntil = (_: Date) => {};\n let url = '';\n\n switch (key) {\n case 'resourceSpans':\n url = tracesURL;\n disabledUntil = this.sendingTracesDisabledUntil;\n updateDisabledUntil = (retryAfterDate: Date) => {\n this.sendingTracesDisabledUntil = retryAfterDate;\n };\n break;\n case 'resourceLogs':\n url = logsURL;\n disabledUntil = this.sendingLogsDisabledUntil;\n updateDisabledUntil = (retryAfterDate: Date) => {\n this.sendingLogsDisabledUntil = retryAfterDate;\n };\n break;\n }\n\n if (disabledUntil && disabledUntil > new Date(Date.now())) {\n this.logWarn(`Dropping transport item due to too many requests. Backoff until ${disabledUntil}`);\n return undefined;\n }\n\n const body = JSON.stringify({ [key]: value });\n\n const { requestOptions, apiKey } = this.options;\n const { headers = {}, ...restOfRequestOptions } = requestOptions ?? {};\n\n if (!url) {\n continue;\n }\n\n await this.promiseBuffer.add(async () => {\n const resolvedHeaders: Record<string, string> = {};\n for (const [key, value] of Object.entries(headers)) {\n resolvedHeaders[key] = typeof value === 'function' ? await Promise.resolve(value()) : value;\n }\n\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...resolvedHeaders,\n ...(apiKey ? { 'x-api-key': apiKey } : {}),\n },\n body,\n keepalive: body.length <= BEACON_BODY_SIZE_LIMIT,\n ...(restOfRequestOptions ?? {}),\n })\n .then((response) => {\n if (response.status === TOO_MANY_REQUESTS) {\n updateDisabledUntil(this.getRetryAfterDate(response));\n this.logWarn(`Too many requests, backing off until ${disabledUntil}`);\n }\n\n // read the body so the connection can be closed\n response.text().catch(noop);\n return response;\n })\n .catch((error) => {\n this.logError('Failed sending payload to the receiver\\n', JSON.parse(body), error);\n });\n });\n }\n } catch (error) {\n this.logError(error);\n }\n }\n\n private getRetryAfterDate(response: Response): Date {\n const now = Date.now();\n const retryAfterHeader = response.headers.get('Retry-After');\n\n if (retryAfterHeader) {\n const delay = Number(retryAfterHeader);\n\n if (!isNaN(delay)) {\n return new Date(delay * 1000 + now);\n }\n\n const date = Date.parse(retryAfterHeader);\n\n if (!isNaN(date)) {\n return new Date(date);\n }\n }\n\n return new Date(now + this.rateLimitBackoffMs);\n }\n}\n"],"mappings":";;;;;;;;;AA2FgB,MAAA,YAAA,CAAA,SAAA;AApFhB,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B,MAAM,gCAAgC;AAEtC,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB;AAE1B,IAAa,oBAAb,cAAuCA,mBAAAA,cAAc;CAUnD,YAAY,SAA2C;;EACrD,MAAM;EADY,KAAA,UAAA;EATpB,KAAS,OAAO;EAChB,KAAS,UAAkBC,mBAAAA;EAK3B,KAAQ,6CAAmC,IAAI,KAAK;EACpD,KAAQ,2CAAiC,IAAI,KAAK;EAIhD,KAAK,sBAAA,wBAAqB,QAAQ,+BAAA,QAAA,0BAAA,KAAA,IAAA,wBAA6B;EAE/D,KAAK,iBAAA,GAAgBC,mBAAAA,oBAAAA,CAAoB;GACvC,OAAA,sBAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAM,QAAS,gBAAA,QAAA,wBAAA,KAAA,IAAA,sBAAc;GAC7B,cAAA,uBAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAa,QAAS,iBAAA,QAAA,yBAAA,KAAA,IAAA,uBAAe;EACvC,CAAC;CACH;CAEA,gBAAmC;;EACjC,MAAM,EAAE,YAAY,IAAI,UAAU,OAAO,KAA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MAAM,OAAO,KAAK,MAAM,gBAAgB;GAExC,IAAI,CAAC,MAAM,IAAI,GACb,OAAO,IAAI,KAAK,IAAI;EAExB;EAEA,OAAO,IAAI,KAAK,MAAM,KAAK,kBAAkB;CAC/C;AACF"}
package/dist/cjs/types.js CHANGED
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,27 @@
1
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/asyncToGenerator.js
2
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
3
+ try {
4
+ var i = n[a](c), u = i.value;
5
+ } catch (n) {
6
+ e(n);
7
+ return;
8
+ }
9
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
10
+ }
11
+ function _asyncToGenerator(n) {
12
+ return function() {
13
+ var t = this, e = arguments;
14
+ return new Promise(function(r, o) {
15
+ var a = n.apply(t, e);
16
+ function _next(n) {
17
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
18
+ }
19
+ function _throw(n) {
20
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
21
+ }
22
+ _next(void 0);
23
+ });
24
+ };
25
+ }
26
+ //#endregion
27
+ export { _asyncToGenerator as default };
@@ -0,0 +1,12 @@
1
+ import toPropertyKey from "./toPropertyKey.js";
2
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/defineProperty.js
3
+ function _defineProperty(e, r, t) {
4
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
5
+ value: t,
6
+ enumerable: !0,
7
+ configurable: !0,
8
+ writable: !0
9
+ }) : e[r] = t, e;
10
+ }
11
+ //#endregion
12
+ export { _defineProperty as default };
@@ -0,0 +1,25 @@
1
+ import _defineProperty from "./defineProperty.js";
2
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/objectSpread2.js
3
+ function ownKeys(e, r) {
4
+ var t = Object.keys(e);
5
+ if (Object.getOwnPropertySymbols) {
6
+ var o = Object.getOwnPropertySymbols(e);
7
+ r && (o = o.filter(function(r) {
8
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
9
+ })), t.push.apply(t, o);
10
+ }
11
+ return t;
12
+ }
13
+ function _objectSpread2(e) {
14
+ for (var r = 1; r < arguments.length; r++) {
15
+ var t = null != arguments[r] ? arguments[r] : {};
16
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
17
+ _defineProperty(e, r, t[r]);
18
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
19
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
20
+ });
21
+ }
22
+ return e;
23
+ }
24
+ //#endregion
25
+ export { _objectSpread2 as default };
@@ -0,0 +1,13 @@
1
+ import _objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js";
2
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/objectWithoutProperties.js
3
+ function _objectWithoutProperties(e, t) {
4
+ if (null == e) return {};
5
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
6
+ if (Object.getOwnPropertySymbols) {
7
+ var s = Object.getOwnPropertySymbols(e);
8
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
9
+ }
10
+ return i;
11
+ }
12
+ //#endregion
13
+ export { _objectWithoutProperties as default };
@@ -0,0 +1,12 @@
1
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/objectWithoutPropertiesLoose.js
2
+ function _objectWithoutPropertiesLoose(r, e) {
3
+ if (null == r) return {};
4
+ var t = {};
5
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
6
+ if (e.includes(n)) continue;
7
+ t[n] = r[n];
8
+ }
9
+ return t;
10
+ }
11
+ //#endregion
12
+ export { _objectWithoutPropertiesLoose as default };
@@ -0,0 +1,14 @@
1
+ import _typeof from "./typeof.js";
2
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/toPrimitive.js
3
+ function toPrimitive(t, r) {
4
+ if ("object" != _typeof(t) || !t) return t;
5
+ var e = t[Symbol.toPrimitive];
6
+ if (void 0 !== e) {
7
+ var i = e.call(t, r || "default");
8
+ if ("object" != _typeof(i)) return i;
9
+ throw new TypeError("@@toPrimitive must return a primitive value.");
10
+ }
11
+ return ("string" === r ? String : Number)(t);
12
+ }
13
+ //#endregion
14
+ export { toPrimitive as default };
@@ -0,0 +1,9 @@
1
+ import _typeof from "./typeof.js";
2
+ import toPrimitive from "./toPrimitive.js";
3
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/toPropertyKey.js
4
+ function toPropertyKey(t) {
5
+ var i = toPrimitive(t, "string");
6
+ return "symbol" == _typeof(i) ? i : i + "";
7
+ }
8
+ //#endregion
9
+ export { toPropertyKey as default };
@@ -0,0 +1,11 @@
1
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/typeof.js
2
+ function _typeof(o) {
3
+ "@babel/helpers - typeof";
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
5
+ return typeof o;
6
+ } : function(o) {
7
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
8
+ }, _typeof(o);
9
+ }
10
+ //#endregion
11
+ export { _typeof as default };
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { OtlpHttpTransport } from './transport';
2
- //# sourceMappingURL=index.js.map
1
+ import { OtlpHttpTransport } from "./transport.js";
2
+ export { OtlpHttpTransport };
@@ -1,61 +1,54 @@
1
- import { TransportItemType } from '@grafana/faro-core';
2
- import { getLogTransforms, getTraceTransforms } from './transform';
3
- export class OtelPayload {
4
- constructor({ internalLogger, customOtlpTransform, transportItem }) {
5
- this.resourceSpans = [];
6
- this.internalLogger = internalLogger;
7
- this.resourceLogs = [];
8
- this.getLogTransforms = getLogTransforms(this.internalLogger, customOtlpTransform);
9
- this.getTraceTransforms = getTraceTransforms(this.internalLogger);
10
- if (transportItem) {
11
- this.addResourceItem(transportItem);
12
- }
13
- }
14
- getPayload() {
15
- return {
16
- resourceLogs: this.resourceLogs,
17
- resourceSpans: this.resourceSpans,
18
- };
19
- }
20
- addResourceItem(transportItem) {
21
- var _a, _b, _c, _d;
22
- const { type } = transportItem;
23
- try {
24
- switch (type) {
25
- case TransportItemType.LOG:
26
- case TransportItemType.EXCEPTION:
27
- case TransportItemType.EVENT:
28
- case TransportItemType.MEASUREMENT: {
29
- const { toLogRecord, toResourceLog } = this.getLogTransforms;
30
- // Currently the scope is fixed to '@grafana/faro-web-sdk'.
31
- // Once we are able to drive the scope by instrumentation this will change and we need to align this function
32
- if (this.resourceLogs.length === 0) {
33
- this.resourceLogs = [toResourceLog(transportItem)];
34
- }
35
- else {
36
- // Faro takes care of the grouping with different metadata (or OTel attributes), so we can safely
37
- // use the just the first element of the resource.
38
- (_b = (_a = this.resourceLogs[0]) === null || _a === void 0 ? void 0 : _a.scopeLogs[0]) === null || _b === void 0 ? void 0 : _b.logRecords.push(toLogRecord(transportItem));
39
- }
40
- break;
41
- }
42
- case TransportItemType.TRACE: {
43
- const { toResourceSpan } = this.getTraceTransforms;
44
- // We use the Otel Model as it is to avoid unnecessary resource consumption.
45
- // This is because we don't need the same logic to add items as it is for logs.
46
- // Also the Otel library already applies the respective protocol transforms so there is no need for additional transforms.
47
- // We only transform the resource object to ensure that we are compliant with the respective Faro Metas which add a few more items to the resource object.
48
- this.resourceSpans.push(toResourceSpan(transportItem));
49
- break;
50
- }
51
- default:
52
- (_c = this.internalLogger) === null || _c === void 0 ? void 0 : _c.error(`Unknown TransportItemType: ${type}`);
53
- break;
54
- }
55
- }
56
- catch (error) {
57
- (_d = this.internalLogger) === null || _d === void 0 ? void 0 : _d.error(error);
58
- }
59
- }
60
- }
1
+ import { getLogTransforms, getTraceTransforms } from "./transform/transform.js";
2
+ import "./transform/index.js";
3
+ import { TransportItemType } from "@grafana/faro-core";
4
+ //#region src/payload/OtelPayload.ts
5
+ var OtelPayload = class {
6
+ constructor({ internalLogger, customOtlpTransform, transportItem }) {
7
+ this.resourceSpans = [];
8
+ this.internalLogger = internalLogger;
9
+ this.resourceLogs = [];
10
+ this.getLogTransforms = getLogTransforms(this.internalLogger, customOtlpTransform);
11
+ this.getTraceTransforms = getTraceTransforms(this.internalLogger);
12
+ if (transportItem) this.addResourceItem(transportItem);
13
+ }
14
+ getPayload() {
15
+ return {
16
+ resourceLogs: this.resourceLogs,
17
+ resourceSpans: this.resourceSpans
18
+ };
19
+ }
20
+ addResourceItem(transportItem) {
21
+ const { type } = transportItem;
22
+ try {
23
+ switch (type) {
24
+ case TransportItemType.LOG:
25
+ case TransportItemType.EXCEPTION:
26
+ case TransportItemType.EVENT:
27
+ case TransportItemType.MEASUREMENT: {
28
+ const { toLogRecord, toResourceLog } = this.getLogTransforms;
29
+ if (this.resourceLogs.length === 0) this.resourceLogs = [toResourceLog(transportItem)];
30
+ else {
31
+ var _this$resourceLogs$;
32
+ (_this$resourceLogs$ = this.resourceLogs[0]) === null || _this$resourceLogs$ === void 0 || (_this$resourceLogs$ = _this$resourceLogs$.scopeLogs[0]) === null || _this$resourceLogs$ === void 0 || _this$resourceLogs$.logRecords.push(toLogRecord(transportItem));
33
+ }
34
+ break;
35
+ }
36
+ case TransportItemType.TRACE: {
37
+ const { toResourceSpan } = this.getTraceTransforms;
38
+ this.resourceSpans.push(toResourceSpan(transportItem));
39
+ break;
40
+ }
41
+ default:
42
+ var _this$internalLogger;
43
+ (_this$internalLogger = this.internalLogger) === null || _this$internalLogger === void 0 || _this$internalLogger.error(`Unknown TransportItemType: ${type}`);
44
+ }
45
+ } catch (error) {
46
+ var _this$internalLogger2;
47
+ (_this$internalLogger2 = this.internalLogger) === null || _this$internalLogger2 === void 0 || _this$internalLogger2.error(error);
48
+ }
49
+ }
50
+ };
51
+ //#endregion
52
+ export { OtelPayload };
53
+
61
54
  //# sourceMappingURL=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AI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBACnC,IAAI,CAAC,YAAY,GAAG,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;oBACrD,CAAC;yBAAM,CAAC;wBACN,iGAAiG;wBACjG,kDAAkD;wBAClD,MAAA,MAAA,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,0CAAE,SAAS,CAAC,CAAC,CAAC,0CAAE,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;oBAClF,CAAC;oBACD,MAAM;gBACR,CAAC;gBACD,KAAK,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;oBAC7B,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC;oBAEnD,4EAA4E;oBAC5E,+EAA+E;oBAC/E,0HAA0H;oBAC1H,0JAA0J;oBAC1J,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,aAA0C,CAAC,CAAC,CAAC;oBAEpF,MAAM;gBACR,CAAC;gBACD;oBACE,MAAA,IAAI,CAAC,cAAc,0CAAE,KAAK,CAAC,8BAA8B,IAAI,EAAE,CAAC,CAAC;oBACjE,MAAM;YACV,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAA,IAAI,CAAC,cAAc,0CAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;CACF","sourcesContent":["import { TransportItemType } from '@grafana/faro-core';\nimport type { InternalLogger, TraceEvent, TransportItem } from '@grafana/faro-core';\n\nimport type { OtlpHttpTransportOptions } from '../types';\n\nimport { getLogTransforms, getTraceTransforms } from './transform';\nimport type { LogsTransform, TraceTransform } from './transform';\nimport type { ResourceLogs, ResourceSpans } from './transform/types';\nimport type { OtelTransportPayload } from './types';\n\ntype OtelPayloadParams = {\n internalLogger: InternalLogger;\n transportItem?: TransportItem;\n customOtlpTransform?: OtlpHttpTransportOptions['otlpTransform'];\n};\n\nexport class OtelPayload {\n private resourceLogs: ResourceLogs;\n private resourceSpans = [] as ResourceSpans;\n\n private getLogTransforms: LogsTransform;\n private getTraceTransforms: TraceTransform;\n\n private internalLogger: InternalLogger;\n\n constructor({ internalLogger, customOtlpTransform, transportItem }: OtelPayloadParams) {\n this.internalLogger = internalLogger;\n this.resourceLogs = [];\n\n this.getLogTransforms = getLogTransforms(this.internalLogger, customOtlpTransform);\n this.getTraceTransforms = getTraceTransforms(this.internalLogger);\n\n if (transportItem) {\n this.addResourceItem(transportItem);\n }\n }\n\n getPayload(): OtelTransportPayload {\n return {\n resourceLogs: this.resourceLogs,\n resourceSpans: this.resourceSpans,\n } as const;\n }\n\n addResourceItem(transportItem: TransportItem): void {\n const { type } = transportItem;\n\n try {\n switch (type) {\n case TransportItemType.LOG:\n case TransportItemType.EXCEPTION:\n case TransportItemType.EVENT:\n case TransportItemType.MEASUREMENT: {\n const { toLogRecord, toResourceLog } = this.getLogTransforms;\n\n // Currently the scope is fixed to '@grafana/faro-web-sdk'.\n // Once we are able to drive the scope by instrumentation this will change and we need to align this function\n if (this.resourceLogs.length === 0) {\n this.resourceLogs = [toResourceLog(transportItem)];\n } else {\n // Faro takes care of the grouping with different metadata (or OTel attributes), so we can safely\n // use the just the first element of the resource.\n this.resourceLogs[0]?.scopeLogs[0]?.logRecords.push(toLogRecord(transportItem));\n }\n break;\n }\n case TransportItemType.TRACE: {\n const { toResourceSpan } = this.getTraceTransforms;\n\n // We use the Otel Model as it is to avoid unnecessary resource consumption.\n // This is because we don't need the same logic to add items as it is for logs.\n // Also the Otel library already applies the respective protocol transforms so there is no need for additional transforms.\n // We only transform the resource object to ensure that we are compliant with the respective Faro Metas which add a few more items to the resource object.\n this.resourceSpans.push(toResourceSpan(transportItem as TransportItem<TraceEvent>));\n\n break;\n }\n default:\n this.internalLogger?.error(`Unknown TransportItemType: ${type}`);\n break;\n }\n } catch (error) {\n this.internalLogger?.error(error);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"OtelPayload.js","names":[],"sources":["../../../src/payload/OtelPayload.ts"],"sourcesContent":["import { TransportItemType } from '@grafana/faro-core';\nimport type { InternalLogger, TraceEvent, TransportItem } from '@grafana/faro-core';\n\nimport type { OtlpHttpTransportOptions } from '../types';\n\nimport { getLogTransforms, getTraceTransforms } from './transform';\nimport type { LogsTransform, TraceTransform } from './transform';\nimport type { ResourceLogs, ResourceSpans } from './transform/types';\nimport type { OtelTransportPayload } from './types';\n\ntype OtelPayloadParams = {\n internalLogger: InternalLogger;\n transportItem?: TransportItem;\n customOtlpTransform?: OtlpHttpTransportOptions['otlpTransform'];\n};\n\nexport class OtelPayload {\n private resourceLogs: ResourceLogs;\n private resourceSpans = [] as ResourceSpans;\n\n private getLogTransforms: LogsTransform;\n private getTraceTransforms: TraceTransform;\n\n private internalLogger: InternalLogger;\n\n constructor({ internalLogger, customOtlpTransform, transportItem }: OtelPayloadParams) {\n this.internalLogger = internalLogger;\n this.resourceLogs = [];\n\n this.getLogTransforms = getLogTransforms(this.internalLogger, customOtlpTransform);\n this.getTraceTransforms = getTraceTransforms(this.internalLogger);\n\n if (transportItem) {\n this.addResourceItem(transportItem);\n }\n }\n\n getPayload(): OtelTransportPayload {\n return {\n resourceLogs: this.resourceLogs,\n resourceSpans: this.resourceSpans,\n } as const;\n }\n\n addResourceItem(transportItem: TransportItem): void {\n const { type } = transportItem;\n\n try {\n switch (type) {\n case TransportItemType.LOG:\n case TransportItemType.EXCEPTION:\n case TransportItemType.EVENT:\n case TransportItemType.MEASUREMENT: {\n const { toLogRecord, toResourceLog } = this.getLogTransforms;\n\n // Currently the scope is fixed to '@grafana/faro-web-sdk'.\n // Once we are able to drive the scope by instrumentation this will change and we need to align this function\n if (this.resourceLogs.length === 0) {\n this.resourceLogs = [toResourceLog(transportItem)];\n } else {\n // Faro takes care of the grouping with different metadata (or OTel attributes), so we can safely\n // use the just the first element of the resource.\n this.resourceLogs[0]?.scopeLogs[0]?.logRecords.push(toLogRecord(transportItem));\n }\n break;\n }\n case TransportItemType.TRACE: {\n const { toResourceSpan } = this.getTraceTransforms;\n\n // We use the Otel Model as it is to avoid unnecessary resource consumption.\n // This is because we don't need the same logic to add items as it is for logs.\n // Also the Otel library already applies the respective protocol transforms so there is no need for additional transforms.\n // We only transform the resource object to ensure that we are compliant with the respective Faro Metas which add a few more items to the resource object.\n this.resourceSpans.push(toResourceSpan(transportItem as TransportItem<TraceEvent>));\n\n break;\n }\n default:\n this.internalLogger?.error(`Unknown TransportItemType: ${type}`);\n break;\n }\n } catch (error) {\n this.internalLogger?.error(error);\n }\n }\n}\n"],"mappings":";;;;AAgBA,IAAa,cAAb,MAAyB;CASvB,YAAY,EAAE,gBAAgB,qBAAqB,iBAAoC;EAPvF,KAAQ,gBAAgB,CAAC;EAQvB,KAAK,iBAAiB;EACtB,KAAK,eAAe,CAAC;EAErB,KAAK,mBAAmB,iBAAiB,KAAK,gBAAgB,mBAAmB;EACjF,KAAK,qBAAqB,mBAAmB,KAAK,cAAc;EAEhE,IAAI,eACF,KAAK,gBAAgB,aAAa;CAEtC;CAEA,aAAmC;EACjC,OAAO;GACL,cAAc,KAAK;GACnB,eAAe,KAAK;EACtB;CACF;CAEA,gBAAgB,eAAoC;EAClD,MAAM,EAAE,SAAS;EAEjB,IAAI;GACF,QAAQ,MAAR;IACE,KAAK,kBAAkB;IACvB,KAAK,kBAAkB;IACvB,KAAK,kBAAkB;IACvB,KAAK,kBAAkB,aAAa;KAClC,MAAM,EAAE,aAAa,kBAAkB,KAAK;KAI5C,IAAI,KAAK,aAAa,WAAW,GAC/B,KAAK,eAAe,CAAC,cAAc,aAAa,CAAC;UAC5C;;MAGL,CAAA,sBAAA,KAAK,aAAa,QAAA,QAAA,wBAAA,KAAA,MAAA,sBAAA,oBAAI,UAAU,QAAA,QAAA,wBAAA,KAAA,KAAA,oBAAI,WAAW,KAAK,YAAY,aAAa,CAAC;KAChF;KACA;IACF;IACA,KAAK,kBAAkB,OAAO;KAC5B,MAAM,EAAE,mBAAmB,KAAK;KAMhC,KAAK,cAAc,KAAK,eAAe,aAA0C,CAAC;KAElF;IACF;IACA;;KACE,CAAA,uBAAA,KAAK,oBAAA,QAAA,yBAAA,KAAA,KAAA,qBAAgB,MAAM,8BAA8B,MAAM;GAEnE;EACF,SAAS,OAAO;;GACd,CAAA,wBAAA,KAAK,oBAAA,QAAA,0BAAA,KAAA,KAAA,sBAAgB,MAAM,KAAK;EAClC;CACF;AACF"}