@veryfront/ext-observability-opentelemetry 0.1.1032 → 0.1.1035
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/esm/_dnt.polyfills.d.ts +7 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +1 -0
- package/esm/deno.d.ts +440 -0
- package/esm/deno.d.ts.map +1 -0
- package/esm/deno.js +526 -0
- package/esm/{index.d.ts → extensions/ext-observability-opentelemetry/src/index.d.ts} +21 -0
- package/esm/extensions/ext-observability-opentelemetry/src/index.d.ts.map +1 -0
- package/esm/{index.js → extensions/ext-observability-opentelemetry/src/index.js} +255 -28
- package/esm/src/config/defaults.d.ts +39 -0
- package/esm/src/config/defaults.d.ts.map +1 -0
- package/esm/src/config/defaults.js +65 -0
- package/esm/src/errors/error-registry/agent.d.ts +18 -0
- package/esm/src/errors/error-registry/agent.d.ts.map +1 -0
- package/esm/src/errors/error-registry/agent.js +60 -0
- package/esm/src/errors/error-registry/boundary.d.ts +16 -0
- package/esm/src/errors/error-registry/boundary.d.ts.map +1 -0
- package/esm/src/errors/error-registry/boundary.js +52 -0
- package/esm/src/errors/error-registry/build.d.ts +20 -0
- package/esm/src/errors/error-registry/build.d.ts.map +1 -0
- package/esm/src/errors/error-registry/build.js +68 -0
- package/esm/src/errors/error-registry/config.d.ts +22 -0
- package/esm/src/errors/error-registry/config.d.ts.map +1 -0
- package/esm/src/errors/error-registry/config.js +70 -0
- package/esm/src/errors/error-registry/deploy.d.ts +12 -0
- package/esm/src/errors/error-registry/deploy.d.ts.map +1 -0
- package/esm/src/errors/error-registry/deploy.js +36 -0
- package/esm/src/errors/error-registry/dev.d.ts +14 -0
- package/esm/src/errors/error-registry/dev.d.ts.map +1 -0
- package/esm/src/errors/error-registry/dev.js +44 -0
- package/esm/src/errors/error-registry/general.d.ts +29 -0
- package/esm/src/errors/error-registry/general.d.ts.map +1 -0
- package/esm/src/errors/error-registry/general.js +92 -0
- package/esm/src/errors/error-registry/module.d.ts +16 -0
- package/esm/src/errors/error-registry/module.d.ts.map +1 -0
- package/esm/src/errors/error-registry/module.js +52 -0
- package/esm/src/errors/error-registry/route.d.ts +16 -0
- package/esm/src/errors/error-registry/route.d.ts.map +1 -0
- package/esm/src/errors/error-registry/route.js +52 -0
- package/esm/src/errors/error-registry/runtime.d.ts +18 -0
- package/esm/src/errors/error-registry/runtime.d.ts.map +1 -0
- package/esm/src/errors/error-registry/runtime.js +60 -0
- package/esm/src/errors/error-registry/server.d.ts +39 -0
- package/esm/src/errors/error-registry/server.d.ts.map +1 -0
- package/esm/src/errors/error-registry/server.js +129 -0
- package/esm/src/errors/error-registry-helpers.d.ts +6 -0
- package/esm/src/errors/error-registry-helpers.d.ts.map +1 -0
- package/esm/src/errors/error-registry-helpers.js +9 -0
- package/esm/src/errors/error-registry.d.ts +114 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -0
- package/esm/src/errors/error-registry.js +60 -0
- package/esm/src/errors/types.d.ts +84 -0
- package/esm/src/errors/types.d.ts.map +1 -0
- package/esm/src/errors/types.js +69 -0
- package/esm/src/errors/veryfront-error.d.ts +149 -0
- package/esm/src/errors/veryfront-error.d.ts.map +1 -0
- package/esm/src/errors/veryfront-error.js +61 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts +13 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts.map +1 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.js +55 -0
- package/esm/src/observability/tracing/api-shim.d.ts +191 -0
- package/esm/src/observability/tracing/api-shim.d.ts.map +1 -0
- package/esm/src/observability/tracing/api-shim.js +281 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts +61 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -0
- package/esm/src/observability/tracing/otlp-setup.js +213 -0
- package/esm/src/observability/tracing/telemetry-env.d.ts +3 -0
- package/esm/src/observability/tracing/telemetry-env.d.ts.map +1 -0
- package/esm/src/observability/tracing/telemetry-env.js +10 -0
- package/esm/src/platform/adapters/base.d.ts +193 -0
- package/esm/src/platform/adapters/base.d.ts.map +1 -0
- package/esm/src/platform/adapters/base.js +15 -0
- package/esm/src/platform/compat/constants.d.ts +13 -0
- package/esm/src/platform/compat/constants.d.ts.map +1 -0
- package/esm/src/platform/compat/constants.js +12 -0
- package/esm/src/platform/compat/dynamic-import.d.ts +11 -0
- package/esm/src/platform/compat/dynamic-import.d.ts.map +1 -0
- package/esm/src/platform/compat/dynamic-import.js +10 -0
- package/esm/src/platform/compat/fs.d.ts +71 -0
- package/esm/src/platform/compat/fs.d.ts.map +1 -0
- package/esm/src/platform/compat/fs.js +277 -0
- package/esm/src/platform/compat/path/resolution.d.ts +6 -0
- package/esm/src/platform/compat/path/resolution.d.ts.map +1 -0
- package/esm/src/platform/compat/path/resolution.js +121 -0
- package/esm/src/platform/compat/path/runtime.d.ts +8 -0
- package/esm/src/platform/compat/path/runtime.d.ts.map +1 -0
- package/esm/src/platform/compat/path/runtime.js +20 -0
- package/esm/src/platform/compat/path/types.d.ts +22 -0
- package/esm/src/platform/compat/path/types.d.ts.map +1 -0
- package/esm/src/platform/compat/path/types.js +1 -0
- package/esm/src/platform/compat/process/command.d.ts +31 -0
- package/esm/src/platform/compat/process/command.d.ts.map +1 -0
- package/esm/src/platform/compat/process/command.js +194 -0
- package/esm/src/platform/compat/process/env.d.ts +35 -0
- package/esm/src/platform/compat/process/env.d.ts.map +1 -0
- package/esm/src/platform/compat/process/env.js +194 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts +99 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -0
- package/esm/src/platform/compat/process/lifecycle.js +327 -0
- package/esm/src/platform/compat/process/runtime-process.d.ts +10 -0
- package/esm/src/platform/compat/process/runtime-process.d.ts.map +1 -0
- package/esm/src/platform/compat/process/runtime-process.js +25 -0
- package/esm/src/platform/compat/process.d.ts +5 -0
- package/esm/src/platform/compat/process.d.ts.map +1 -0
- package/esm/src/platform/compat/process.js +4 -0
- package/esm/src/platform/compat/runtime.d.ts +51 -0
- package/esm/src/platform/compat/runtime.d.ts.map +1 -0
- package/esm/src/platform/compat/runtime.js +101 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts +70 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/url-builder.js +152 -0
- package/esm/src/utils/base64url.d.ts +6 -0
- package/esm/src/utils/base64url.d.ts.map +1 -0
- package/esm/src/utils/base64url.js +12 -0
- package/esm/src/utils/bundle-manifest.d.ts +63 -0
- package/esm/src/utils/bundle-manifest.d.ts.map +1 -0
- package/esm/src/utils/bundle-manifest.js +96 -0
- package/esm/src/utils/constants/buffers.d.ts +24 -0
- package/esm/src/utils/constants/buffers.d.ts.map +1 -0
- package/esm/src/utils/constants/buffers.js +23 -0
- package/esm/src/utils/constants/build.d.ts +8 -0
- package/esm/src/utils/constants/build.d.ts.map +1 -0
- package/esm/src/utils/constants/build.js +7 -0
- package/esm/src/utils/constants/cache.d.ts +74 -0
- package/esm/src/utils/constants/cache.d.ts.map +1 -0
- package/esm/src/utils/constants/cache.js +133 -0
- package/esm/src/utils/constants/cdn.d.ts +29 -0
- package/esm/src/utils/constants/cdn.d.ts.map +1 -0
- package/esm/src/utils/constants/cdn.js +58 -0
- package/esm/src/utils/constants/crypto.d.ts +10 -0
- package/esm/src/utils/constants/crypto.d.ts.map +1 -0
- package/esm/src/utils/constants/crypto.js +9 -0
- package/esm/src/utils/constants/env.d.ts +16 -0
- package/esm/src/utils/constants/env.d.ts.map +1 -0
- package/esm/src/utils/constants/env.js +20 -0
- package/esm/src/utils/constants/hash.d.ts +5 -0
- package/esm/src/utils/constants/hash.d.ts.map +1 -0
- package/esm/src/utils/constants/hash.js +4 -0
- package/esm/src/utils/constants/hmr.d.ts +24 -0
- package/esm/src/utils/constants/hmr.d.ts.map +1 -0
- package/esm/src/utils/constants/hmr.js +26 -0
- package/esm/src/utils/constants/html.d.ts +13 -0
- package/esm/src/utils/constants/html.d.ts.map +1 -0
- package/esm/src/utils/constants/html.js +12 -0
- package/esm/src/utils/constants/http.d.ts +77 -0
- package/esm/src/utils/constants/http.d.ts.map +1 -0
- package/esm/src/utils/constants/http.js +76 -0
- package/esm/src/utils/constants/index.d.ts +23 -0
- package/esm/src/utils/constants/index.d.ts.map +1 -0
- package/esm/src/utils/constants/index.js +22 -0
- package/esm/src/utils/constants/limits.d.ts +27 -0
- package/esm/src/utils/constants/limits.d.ts.map +1 -0
- package/esm/src/utils/constants/limits.js +26 -0
- package/esm/src/utils/constants/metrics.d.ts +10 -0
- package/esm/src/utils/constants/metrics.d.ts.map +1 -0
- package/esm/src/utils/constants/metrics.js +34 -0
- package/esm/src/utils/constants/network.d.ts +23 -0
- package/esm/src/utils/constants/network.d.ts.map +1 -0
- package/esm/src/utils/constants/network.js +27 -0
- package/esm/src/utils/constants/priorities.d.ts +31 -0
- package/esm/src/utils/constants/priorities.d.ts.map +1 -0
- package/esm/src/utils/constants/priorities.js +30 -0
- package/esm/src/utils/constants/retry.d.ts +14 -0
- package/esm/src/utils/constants/retry.d.ts.map +1 -0
- package/esm/src/utils/constants/retry.js +13 -0
- package/esm/src/utils/constants/security.d.ts +16 -0
- package/esm/src/utils/constants/security.d.ts.map +1 -0
- package/esm/src/utils/constants/security.js +15 -0
- package/esm/src/utils/constants/server.d.ts +107 -0
- package/esm/src/utils/constants/server.d.ts.map +1 -0
- package/esm/src/utils/constants/server.js +120 -0
- package/esm/src/utils/feature-flags.d.ts +7 -0
- package/esm/src/utils/feature-flags.d.ts.map +1 -0
- package/esm/src/utils/feature-flags.js +8 -0
- package/esm/src/utils/hash-utils.d.ts +19 -0
- package/esm/src/utils/hash-utils.d.ts.map +1 -0
- package/esm/src/utils/hash-utils.js +42 -0
- package/esm/src/utils/import-lockfile.d.ts +52 -0
- package/esm/src/utils/import-lockfile.d.ts.map +1 -0
- package/esm/src/utils/import-lockfile.js +187 -0
- package/esm/src/utils/index.d.ts +27 -0
- package/esm/src/utils/index.d.ts.map +1 -0
- package/esm/src/utils/index.js +25 -0
- package/esm/src/utils/logger/components.d.ts +73 -0
- package/esm/src/utils/logger/components.d.ts.map +1 -0
- package/esm/src/utils/logger/components.js +81 -0
- package/esm/src/utils/logger/core.d.ts +73 -0
- package/esm/src/utils/logger/core.d.ts.map +1 -0
- package/esm/src/utils/logger/core.js +143 -0
- package/esm/src/utils/logger/index.d.ts +10 -0
- package/esm/src/utils/logger/index.d.ts.map +1 -0
- package/esm/src/utils/logger/index.js +9 -0
- package/esm/src/utils/logger/logger.d.ts +179 -0
- package/esm/src/utils/logger/logger.d.ts.map +1 -0
- package/esm/src/utils/logger/logger.js +490 -0
- package/esm/src/utils/logger/redact.d.ts +74 -0
- package/esm/src/utils/logger/redact.d.ts.map +1 -0
- package/esm/src/utils/logger/redact.js +294 -0
- package/esm/src/utils/logger/request-context.d.ts +27 -0
- package/esm/src/utils/logger/request-context.d.ts.map +1 -0
- package/esm/src/utils/logger/request-context.js +28 -0
- package/esm/src/utils/memoize.d.ts +19 -0
- package/esm/src/utils/memoize.d.ts.map +1 -0
- package/esm/src/utils/memoize.js +72 -0
- package/esm/src/utils/parallel.d.ts +25 -0
- package/esm/src/utils/parallel.d.ts.map +1 -0
- package/esm/src/utils/parallel.js +91 -0
- package/esm/src/utils/path-utils.d.ts +34 -0
- package/esm/src/utils/path-utils.d.ts.map +1 -0
- package/esm/src/utils/path-utils.js +138 -0
- package/esm/src/utils/perf-timer.d.ts +11 -0
- package/esm/src/utils/perf-timer.d.ts.map +1 -0
- package/esm/src/utils/perf-timer.js +114 -0
- package/esm/src/utils/platform.d.ts +9 -0
- package/esm/src/utils/platform.d.ts.map +1 -0
- package/esm/src/utils/platform.js +20 -0
- package/esm/src/utils/runtime-guards.d.ts +29 -0
- package/esm/src/utils/runtime-guards.d.ts.map +1 -0
- package/esm/src/utils/runtime-guards.js +23 -0
- package/esm/src/utils/version-constant.d.ts +3 -0
- package/esm/src/utils/version-constant.d.ts.map +1 -0
- package/esm/src/utils/version-constant.js +4 -0
- package/esm/src/utils/version.d.ts +17 -0
- package/esm/src/utils/version.d.ts.map +1 -0
- package/esm/src/utils/version.js +36 -0
- package/package.json +25 -7
- package/esm/index.d.ts.map +0 -1
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @module extensions/ext-observability-opentelemetry
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import "../../../_dnt.polyfills.js";
|
|
17
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
18
|
+
import { VERSION } from "../../../src/utils/index.js";
|
|
17
19
|
const NOOP_SPAN = {
|
|
18
20
|
setAttribute() {
|
|
19
21
|
return NOOP_SPAN;
|
|
@@ -124,9 +126,79 @@ function parseHeaders(headerInput) {
|
|
|
124
126
|
}
|
|
125
127
|
return result;
|
|
126
128
|
}
|
|
129
|
+
function parseResourceAttributes(value) {
|
|
130
|
+
if (!value)
|
|
131
|
+
return {};
|
|
132
|
+
const attributes = {};
|
|
133
|
+
for (const part of value.split(",")) {
|
|
134
|
+
const [rawKey, ...rawValueParts] = part.split("=");
|
|
135
|
+
const key = rawKey?.trim();
|
|
136
|
+
if (!key || rawValueParts.length === 0)
|
|
137
|
+
continue;
|
|
138
|
+
attributes[key] = rawValueParts.join("=").trim();
|
|
139
|
+
}
|
|
140
|
+
return attributes;
|
|
141
|
+
}
|
|
142
|
+
function resolveServiceName(read, resourceAttributes) {
|
|
143
|
+
return read("OTEL_SERVICE_NAME") ?? resourceAttributes["service.name"] ??
|
|
144
|
+
read("DD_SERVICE") ?? "veryfront";
|
|
145
|
+
}
|
|
146
|
+
function resolveServiceVersion(read, resourceAttributes) {
|
|
147
|
+
return resourceAttributes["service.version"] ??
|
|
148
|
+
read("OTEL_SERVICE_VERSION") ??
|
|
149
|
+
read("DD_VERSION") ??
|
|
150
|
+
read("VERYFRONT_VERSION") ??
|
|
151
|
+
read("RELEASE_VERSION") ??
|
|
152
|
+
read("npm_package_version") ??
|
|
153
|
+
VERSION;
|
|
154
|
+
}
|
|
155
|
+
function resolveDeploymentEnvironment(read, resourceAttributes) {
|
|
156
|
+
return resourceAttributes["deployment.environment.name"] ??
|
|
157
|
+
resourceAttributes["deployment.environment"] ??
|
|
158
|
+
read("OTEL_DEPLOYMENT_ENVIRONMENT") ??
|
|
159
|
+
read("DD_ENV") ??
|
|
160
|
+
read("APP_ENVIRONMENT") ??
|
|
161
|
+
read("VERYFRONT_ENVIRONMENT") ??
|
|
162
|
+
read("NODE_ENV") ??
|
|
163
|
+
"development";
|
|
164
|
+
}
|
|
127
165
|
function headersOrDefault(signalHeaders, defaultHeaders) {
|
|
128
166
|
return signalHeaders ?? defaultHeaders;
|
|
129
167
|
}
|
|
168
|
+
function getHeaderValue(headers, headerName) {
|
|
169
|
+
const normalizedName = headerName.toLowerCase();
|
|
170
|
+
return Object.entries(headers ?? {}).find(([key]) => key.toLowerCase() === normalizedName)?.[1];
|
|
171
|
+
}
|
|
172
|
+
function setHeaderValue(headers, headerName, value) {
|
|
173
|
+
const normalizedName = headerName.toLowerCase();
|
|
174
|
+
for (const key of Object.keys(headers)) {
|
|
175
|
+
if (key.toLowerCase() === normalizedName && key !== headerName) {
|
|
176
|
+
delete headers[key];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
headers[headerName] = value;
|
|
180
|
+
}
|
|
181
|
+
function resolveLlmObservabilityEnabled(read, tracesHeaders) {
|
|
182
|
+
const explicitFlag = isTruthySignalFlag(read("DD_LLMOBS_ENABLED") ?? read("OTEL_LLMOBS_ENABLED"));
|
|
183
|
+
if (explicitFlag !== undefined)
|
|
184
|
+
return explicitFlag;
|
|
185
|
+
return getHeaderValue(tracesHeaders, "dd-otlp-source") === "llmobs";
|
|
186
|
+
}
|
|
187
|
+
function resolveLlmObservabilityHeaders(read, tracesHeaders) {
|
|
188
|
+
const headers = { ...tracesHeaders };
|
|
189
|
+
const datadogApiKey = getHeaderValue(headers, "dd-api-key") ??
|
|
190
|
+
read("DD_API_KEY") ??
|
|
191
|
+
read("DATADOG_OTLP_API_KEY");
|
|
192
|
+
if (datadogApiKey) {
|
|
193
|
+
setHeaderValue(headers, "dd-api-key", datadogApiKey);
|
|
194
|
+
}
|
|
195
|
+
setHeaderValue(headers, "dd-otlp-source", "llmobs");
|
|
196
|
+
const mlApp = read("DD_LLMOBS_ML_APP");
|
|
197
|
+
if (mlApp) {
|
|
198
|
+
setHeaderValue(headers, "dd-ml-app", mlApp);
|
|
199
|
+
}
|
|
200
|
+
return headers;
|
|
201
|
+
}
|
|
130
202
|
function metricTemporalityPreference(otel, preference) {
|
|
131
203
|
const enumValue = otel.metricsExporter.AggregationTemporalityPreference;
|
|
132
204
|
if (preference === "cumulative")
|
|
@@ -148,7 +220,79 @@ function logSeverityNumber(otel, level) {
|
|
|
148
220
|
return otel.apiLogs.SeverityNumber.INFO;
|
|
149
221
|
}
|
|
150
222
|
}
|
|
151
|
-
|
|
223
|
+
const TRACE_ID_LOG_ALIASES = ["trace.id", "otel.trace_id"];
|
|
224
|
+
const SPAN_ID_LOG_ALIASES = ["span.id", "otel.span_id"];
|
|
225
|
+
const PROJECT_ID_LOG_ALIASES = ["project.id"];
|
|
226
|
+
const RUN_ID_LOG_ALIASES = ["run.id"];
|
|
227
|
+
const AGENT_ID_LOG_ALIASES = ["agent.id", "gen_ai.agent.id"];
|
|
228
|
+
const THREAD_ID_LOG_ALIASES = ["thread.id"];
|
|
229
|
+
const SCHEDULE_ID_LOG_ALIASES = ["schedule.id", "run.trigger.id"];
|
|
230
|
+
const SCHEDULE_NAME_LOG_ALIASES = ["schedule.name"];
|
|
231
|
+
const TOOL_NAME_LOG_ALIASES = ["tool.name", "gen_ai.tool.name"];
|
|
232
|
+
const TOOL_CALL_ID_LOG_ALIASES = ["tool.call.id", "gen_ai.tool.call.id"];
|
|
233
|
+
const LOG_ATTRIBUTE_ALIASES = {
|
|
234
|
+
trace_id: TRACE_ID_LOG_ALIASES,
|
|
235
|
+
span_id: SPAN_ID_LOG_ALIASES,
|
|
236
|
+
project_id: PROJECT_ID_LOG_ALIASES,
|
|
237
|
+
run_id: RUN_ID_LOG_ALIASES,
|
|
238
|
+
agent_id: AGENT_ID_LOG_ALIASES,
|
|
239
|
+
thread_id: THREAD_ID_LOG_ALIASES,
|
|
240
|
+
schedule_id: SCHEDULE_ID_LOG_ALIASES,
|
|
241
|
+
schedule_name: SCHEDULE_NAME_LOG_ALIASES,
|
|
242
|
+
tool_name: TOOL_NAME_LOG_ALIASES,
|
|
243
|
+
tool_call_id: TOOL_CALL_ID_LOG_ALIASES,
|
|
244
|
+
};
|
|
245
|
+
const CONTEXT_LOG_ATTRIBUTE_ALIASES = {
|
|
246
|
+
traceId: TRACE_ID_LOG_ALIASES,
|
|
247
|
+
trace_id: TRACE_ID_LOG_ALIASES,
|
|
248
|
+
spanId: SPAN_ID_LOG_ALIASES,
|
|
249
|
+
span_id: SPAN_ID_LOG_ALIASES,
|
|
250
|
+
projectId: PROJECT_ID_LOG_ALIASES,
|
|
251
|
+
project_id: PROJECT_ID_LOG_ALIASES,
|
|
252
|
+
runId: RUN_ID_LOG_ALIASES,
|
|
253
|
+
run_id: RUN_ID_LOG_ALIASES,
|
|
254
|
+
agentId: AGENT_ID_LOG_ALIASES,
|
|
255
|
+
agent_id: AGENT_ID_LOG_ALIASES,
|
|
256
|
+
threadId: THREAD_ID_LOG_ALIASES,
|
|
257
|
+
thread_id: THREAD_ID_LOG_ALIASES,
|
|
258
|
+
scheduleId: SCHEDULE_ID_LOG_ALIASES,
|
|
259
|
+
schedule_id: SCHEDULE_ID_LOG_ALIASES,
|
|
260
|
+
scheduleName: SCHEDULE_NAME_LOG_ALIASES,
|
|
261
|
+
schedule_name: SCHEDULE_NAME_LOG_ALIASES,
|
|
262
|
+
toolName: TOOL_NAME_LOG_ALIASES,
|
|
263
|
+
tool_name: TOOL_NAME_LOG_ALIASES,
|
|
264
|
+
toolCallId: TOOL_CALL_ID_LOG_ALIASES,
|
|
265
|
+
tool_call_id: TOOL_CALL_ID_LOG_ALIASES,
|
|
266
|
+
};
|
|
267
|
+
function isLogAttributeValue(value) {
|
|
268
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
269
|
+
}
|
|
270
|
+
function hexToUnsignedDecimal(value) {
|
|
271
|
+
const normalized = value?.trim().replace(/^0x/, "");
|
|
272
|
+
if (!normalized || !/^[0-9a-f]+$/i.test(normalized))
|
|
273
|
+
return undefined;
|
|
274
|
+
try {
|
|
275
|
+
return BigInt(`0x${normalized}`).toString(10);
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function addLogAttributeAliases(attributes, key, value) {
|
|
282
|
+
const aliases = LOG_ATTRIBUTE_ALIASES[key] ?? CONTEXT_LOG_ATTRIBUTE_ALIASES[key];
|
|
283
|
+
for (const alias of aliases ?? []) {
|
|
284
|
+
attributes[alias] ??= value;
|
|
285
|
+
}
|
|
286
|
+
if (key === "trace_id" || key === "traceId") {
|
|
287
|
+
const traceId = typeof value === "string" ? value : String(value);
|
|
288
|
+
attributes["dd.trace_id"] ??= hexToUnsignedDecimal(traceId.slice(-16)) ?? traceId;
|
|
289
|
+
}
|
|
290
|
+
if (key === "span_id" || key === "spanId") {
|
|
291
|
+
const spanId = typeof value === "string" ? value : String(value);
|
|
292
|
+
attributes["dd.span_id"] ??= hexToUnsignedDecimal(spanId) ?? spanId;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
export function logAttributes(record) {
|
|
152
296
|
const attributes = {};
|
|
153
297
|
for (const [key, value] of Object.entries(record)) {
|
|
154
298
|
if (key === "timestamp" ||
|
|
@@ -158,14 +302,16 @@ function logAttributes(record) {
|
|
|
158
302
|
key === "error") {
|
|
159
303
|
continue;
|
|
160
304
|
}
|
|
161
|
-
if (
|
|
305
|
+
if (isLogAttributeValue(value)) {
|
|
162
306
|
attributes[key] = value;
|
|
307
|
+
addLogAttributeAliases(attributes, key, value);
|
|
163
308
|
}
|
|
164
309
|
}
|
|
165
310
|
if (record.context) {
|
|
166
311
|
for (const [key, value] of Object.entries(record.context)) {
|
|
167
|
-
if (
|
|
312
|
+
if (isLogAttributeValue(value)) {
|
|
168
313
|
attributes[`context.${key}`] = value;
|
|
314
|
+
addLogAttributeAliases(attributes, key, value);
|
|
169
315
|
}
|
|
170
316
|
}
|
|
171
317
|
}
|
|
@@ -213,8 +359,12 @@ function resolveMetricsTemporalityPreference(value) {
|
|
|
213
359
|
return "delta";
|
|
214
360
|
}
|
|
215
361
|
export function resolveOtlpExtensionConfig(read = readEnv) {
|
|
362
|
+
const resourceAttributes = parseResourceAttributes(read("OTEL_RESOURCE_ATTRIBUTES"));
|
|
216
363
|
const endpoint = read("OTEL_EXPORTER_OTLP_ENDPOINT");
|
|
217
364
|
const tracesEndpoint = read("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT") ?? endpoint;
|
|
365
|
+
const llmObservabilityEndpoint = read("OTEL_EXPORTER_OTLP_LLMOBS_ENDPOINT") ??
|
|
366
|
+
read("DD_LLMOBS_OTLP_ENDPOINT") ??
|
|
367
|
+
tracesEndpoint;
|
|
218
368
|
const metricsEndpoint = read("OTEL_EXPORTER_OTLP_METRICS_ENDPOINT") ?? endpoint;
|
|
219
369
|
const logsEndpoint = read("OTEL_EXPORTER_OTLP_LOGS_ENDPOINT") ?? endpoint;
|
|
220
370
|
const metricsExportIntervalMillis = Number.parseInt(read("OTEL_METRIC_EXPORT_INTERVAL") ?? "60000", 10);
|
|
@@ -222,17 +372,22 @@ export function resolveOtlpExtensionConfig(read = readEnv) {
|
|
|
222
372
|
const tracesHeaders = mergeHeaders(headers, parseHeaders(read("OTEL_EXPORTER_OTLP_TRACES_HEADERS")));
|
|
223
373
|
const metricsHeaders = mergeHeaders(headers, parseHeaders(read("OTEL_EXPORTER_OTLP_METRICS_HEADERS")));
|
|
224
374
|
const logsHeaders = mergeHeaders(headers, parseHeaders(read("OTEL_EXPORTER_OTLP_LOGS_HEADERS")));
|
|
375
|
+
const llmObservabilityHeaders = resolveLlmObservabilityHeaders(read, tracesHeaders);
|
|
225
376
|
return {
|
|
226
|
-
serviceName: read
|
|
227
|
-
serviceVersion:
|
|
377
|
+
serviceName: resolveServiceName(read, resourceAttributes),
|
|
378
|
+
serviceVersion: resolveServiceVersion(read, resourceAttributes),
|
|
379
|
+
deploymentEnvironment: resolveDeploymentEnvironment(read, resourceAttributes),
|
|
228
380
|
headers,
|
|
229
381
|
tracesHeaders,
|
|
230
382
|
metricsHeaders,
|
|
231
383
|
logsHeaders,
|
|
384
|
+
llmObservabilityHeaders,
|
|
232
385
|
tracesEnabled: resolveSignalEnabled(read("OTEL_TRACES_ENABLED"), read("OTEL_TRACES_EXPORTER")),
|
|
386
|
+
llmObservabilityEnabled: resolveLlmObservabilityEnabled(read, tracesHeaders),
|
|
233
387
|
metricsEnabled: resolveSignalEnabled(read("OTEL_METRICS_ENABLED"), read("OTEL_METRICS_EXPORTER")),
|
|
234
388
|
logsEnabled: resolveSignalEnabled(read("OTEL_LOGS_ENABLED"), read("OTEL_LOGS_EXPORTER")),
|
|
235
389
|
tracesUrl: resolveOtlpSignalUrl(tracesEndpoint, "traces"),
|
|
390
|
+
llmObservabilityUrl: resolveOtlpSignalUrl(llmObservabilityEndpoint, "traces"),
|
|
236
391
|
metricsUrl: resolveOtlpSignalUrl(metricsEndpoint, "metrics"),
|
|
237
392
|
logsUrl: resolveOtlpSignalUrl(logsEndpoint, "logs"),
|
|
238
393
|
metricsExportIntervalMillis: Number.isFinite(metricsExportIntervalMillis)
|
|
@@ -241,6 +396,34 @@ export function resolveOtlpExtensionConfig(read = readEnv) {
|
|
|
241
396
|
metricsTemporalityPreference: resolveMetricsTemporalityPreference(read("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE")),
|
|
242
397
|
};
|
|
243
398
|
}
|
|
399
|
+
function isGenAiSpan(span) {
|
|
400
|
+
const attributes = span.attributes;
|
|
401
|
+
return typeof attributes?.["gen_ai.operation.name"] === "string";
|
|
402
|
+
}
|
|
403
|
+
class FilteringSpanExporter {
|
|
404
|
+
delegate;
|
|
405
|
+
includeSpan;
|
|
406
|
+
successCode;
|
|
407
|
+
constructor(delegate, includeSpan, successCode) {
|
|
408
|
+
this.delegate = delegate;
|
|
409
|
+
this.includeSpan = includeSpan;
|
|
410
|
+
this.successCode = successCode;
|
|
411
|
+
}
|
|
412
|
+
export(spans, resultCallback) {
|
|
413
|
+
const includedSpans = spans.filter(this.includeSpan);
|
|
414
|
+
if (includedSpans.length === 0) {
|
|
415
|
+
resultCallback({ code: this.successCode });
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
this.delegate.export(includedSpans, resultCallback);
|
|
419
|
+
}
|
|
420
|
+
shutdown() {
|
|
421
|
+
return this.delegate.shutdown();
|
|
422
|
+
}
|
|
423
|
+
forceFlush() {
|
|
424
|
+
return this.delegate.forceFlush?.() ?? Promise.resolve();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
244
427
|
class OtlpTracingExporter {
|
|
245
428
|
sdkProvider = null;
|
|
246
429
|
meterProvider = null;
|
|
@@ -251,26 +434,41 @@ class OtlpTracingExporter {
|
|
|
251
434
|
logRecordEmitter = null;
|
|
252
435
|
async start(_ctxConfig) {
|
|
253
436
|
const cfg = resolveOtlpExtensionConfig(readEnv);
|
|
254
|
-
// Honor
|
|
255
|
-
//
|
|
256
|
-
if (!cfg.tracesEnabled && !cfg.metricsEnabled && !cfg.logsEnabled)
|
|
437
|
+
// Honor signal gates: when unset/false, skip exporter wiring so deployments
|
|
438
|
+
// opting out never create OTLP traffic or set globals.
|
|
439
|
+
if (!cfg.tracesEnabled && !cfg.llmObservabilityEnabled && !cfg.metricsEnabled && !cfg.logsEnabled) {
|
|
257
440
|
return;
|
|
441
|
+
}
|
|
258
442
|
const otel = await loadOpenTelemetryRuntime();
|
|
259
443
|
const resource = otel.resources.resourceFromAttributes({
|
|
260
444
|
[otel.semanticConventions.ATTR_SERVICE_NAME]: cfg.serviceName,
|
|
261
445
|
[otel.semanticConventions.ATTR_SERVICE_VERSION]: cfg.serviceVersion,
|
|
446
|
+
"deployment.environment": cfg.deploymentEnvironment,
|
|
447
|
+
"deployment.environment.name": cfg.deploymentEnvironment,
|
|
262
448
|
});
|
|
263
|
-
if (cfg.tracesEnabled) {
|
|
264
|
-
if (!cfg.tracesUrl) {
|
|
449
|
+
if (cfg.tracesEnabled || cfg.llmObservabilityEnabled) {
|
|
450
|
+
if (cfg.tracesEnabled && !cfg.tracesUrl) {
|
|
265
451
|
throw new Error("OTEL_TRACES_ENABLED=true requires OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT");
|
|
266
452
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
453
|
+
if (cfg.llmObservabilityEnabled && !cfg.llmObservabilityUrl) {
|
|
454
|
+
throw new Error("DD_LLMOBS_ENABLED=true requires OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, or OTEL_EXPORTER_OTLP_LLMOBS_ENDPOINT");
|
|
455
|
+
}
|
|
456
|
+
const spanProcessors = [];
|
|
457
|
+
if (cfg.tracesEnabled && cfg.tracesUrl) {
|
|
458
|
+
spanProcessors.push(new otel.sdkTraceBase.BatchSpanProcessor(new otel.traceExporter.OTLPTraceExporter({
|
|
459
|
+
url: cfg.tracesUrl,
|
|
460
|
+
headers: cfg.tracesHeaders,
|
|
461
|
+
})));
|
|
462
|
+
}
|
|
463
|
+
if (cfg.llmObservabilityEnabled && cfg.llmObservabilityUrl) {
|
|
464
|
+
spanProcessors.push(new otel.sdkTraceBase.BatchSpanProcessor(new FilteringSpanExporter(new otel.traceExporter.OTLPTraceExporter({
|
|
465
|
+
url: cfg.llmObservabilityUrl,
|
|
466
|
+
headers: cfg.llmObservabilityHeaders,
|
|
467
|
+
}), isGenAiSpan, otel.core.ExportResultCode.SUCCESS)));
|
|
468
|
+
}
|
|
271
469
|
const provider = new otel.sdkTraceBase.BasicTracerProvider({
|
|
272
470
|
resource,
|
|
273
|
-
spanProcessors
|
|
471
|
+
spanProcessors,
|
|
274
472
|
});
|
|
275
473
|
// Wire OTel SDK globals so the real API delegates to this provider.
|
|
276
474
|
// The shim also gets wired separately in bootstrap.ts via getProvider().
|
|
@@ -400,27 +598,37 @@ class OpenTelemetryNodeTelemetryProvider {
|
|
|
400
598
|
sdk = null;
|
|
401
599
|
async initialize(options) {
|
|
402
600
|
const tracesEnabled = options.tracesEnabled ?? true;
|
|
601
|
+
const llmObservabilityEnabled = options.llmObservabilityEnabled ?? false;
|
|
403
602
|
const metricsEnabled = options.metricsEnabled ?? false;
|
|
404
603
|
const logsEnabled = options.logsEnabled ?? false;
|
|
405
|
-
if (!tracesEnabled && !metricsEnabled && !logsEnabled)
|
|
604
|
+
if (!tracesEnabled && !llmObservabilityEnabled && !metricsEnabled && !logsEnabled)
|
|
406
605
|
return false;
|
|
407
606
|
const otel = await loadOpenTelemetryRuntime();
|
|
408
607
|
const resource = otel.resources.resourceFromAttributes({
|
|
409
608
|
"service.name": options.serviceName,
|
|
410
609
|
"service.version": options.serviceVersion,
|
|
411
610
|
"deployment.environment": options.deploymentEnvironment,
|
|
611
|
+
"deployment.environment.name": options.deploymentEnvironment,
|
|
412
612
|
});
|
|
413
|
-
const spanProcessors =
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
613
|
+
const spanProcessors = [];
|
|
614
|
+
if (tracesEnabled) {
|
|
615
|
+
spanProcessors.push(new otel.sdkTraceBase.BatchSpanProcessor(new otel.traceExporter.OTLPTraceExporter({
|
|
616
|
+
url: options.tracesEndpoint,
|
|
617
|
+
headers: headersOrDefault(options.tracesHeaders, options.exporterHeaders),
|
|
618
|
+
}), {
|
|
619
|
+
maxExportBatchSize: 100,
|
|
620
|
+
scheduledDelayMillis: 500,
|
|
621
|
+
}));
|
|
622
|
+
}
|
|
623
|
+
if (llmObservabilityEnabled) {
|
|
624
|
+
spanProcessors.push(new otel.sdkTraceBase.BatchSpanProcessor(new FilteringSpanExporter(new otel.traceExporter.OTLPTraceExporter({
|
|
625
|
+
url: options.llmObservabilityEndpoint ?? options.tracesEndpoint,
|
|
626
|
+
headers: headersOrDefault(options.llmObservabilityHeaders, options.tracesHeaders),
|
|
627
|
+
}), isGenAiSpan, otel.core.ExportResultCode.SUCCESS), {
|
|
628
|
+
maxExportBatchSize: 100,
|
|
629
|
+
scheduledDelayMillis: 500,
|
|
630
|
+
}));
|
|
631
|
+
}
|
|
424
632
|
const metricReaders = metricsEnabled
|
|
425
633
|
? [
|
|
426
634
|
new otel.sdkMetrics.PeriodicExportingMetricReader({
|
|
@@ -495,6 +703,7 @@ class OpenTelemetryNodeTelemetryProvider {
|
|
|
495
703
|
tracesEnabled,
|
|
496
704
|
metricsEnabled,
|
|
497
705
|
logsEnabled,
|
|
706
|
+
llmObservabilityEnabled,
|
|
498
707
|
});
|
|
499
708
|
options.processTarget?.on("SIGTERM", async () => {
|
|
500
709
|
await this.shutdown();
|
|
@@ -535,13 +744,31 @@ const extOpenTelemetry = () => {
|
|
|
535
744
|
keys: [
|
|
536
745
|
"OTEL_EXPORTER_OTLP_ENDPOINT",
|
|
537
746
|
"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
|
|
747
|
+
"OTEL_EXPORTER_OTLP_LLMOBS_ENDPOINT",
|
|
538
748
|
"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT",
|
|
539
749
|
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT",
|
|
540
750
|
"OTEL_EXPORTER_OTLP_HEADERS",
|
|
541
751
|
"OTEL_EXPORTER_OTLP_TRACES_HEADERS",
|
|
542
752
|
"OTEL_EXPORTER_OTLP_METRICS_HEADERS",
|
|
543
753
|
"OTEL_EXPORTER_OTLP_LOGS_HEADERS",
|
|
754
|
+
"OTEL_RESOURCE_ATTRIBUTES",
|
|
544
755
|
"OTEL_SERVICE_NAME",
|
|
756
|
+
"OTEL_SERVICE_VERSION",
|
|
757
|
+
"OTEL_DEPLOYMENT_ENVIRONMENT",
|
|
758
|
+
"DD_SERVICE",
|
|
759
|
+
"DD_VERSION",
|
|
760
|
+
"DD_ENV",
|
|
761
|
+
"DD_API_KEY",
|
|
762
|
+
"DATADOG_OTLP_API_KEY",
|
|
763
|
+
"DD_LLMOBS_ENABLED",
|
|
764
|
+
"DD_LLMOBS_ML_APP",
|
|
765
|
+
"DD_LLMOBS_OTLP_ENDPOINT",
|
|
766
|
+
"OTEL_LLMOBS_ENABLED",
|
|
767
|
+
"VERYFRONT_VERSION",
|
|
768
|
+
"RELEASE_VERSION",
|
|
769
|
+
"APP_ENVIRONMENT",
|
|
770
|
+
"VERYFRONT_ENVIRONMENT",
|
|
771
|
+
"NODE_ENV",
|
|
545
772
|
"OTEL_TRACES_ENABLED",
|
|
546
773
|
"OTEL_METRICS_ENABLED",
|
|
547
774
|
"OTEL_LOGS_ENABLED",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DEFAULT_PORT } from "../platform/compat/constants.js";
|
|
2
|
+
export { DEFAULT_PORT };
|
|
3
|
+
export declare const DEFAULT_TIMEOUT_MS = 5000;
|
|
4
|
+
export declare const SSR_TIMEOUT_MS = 10000;
|
|
5
|
+
export declare const SANDBOX_TIMEOUT_MS = 5000;
|
|
6
|
+
/** Timeout for user data fetching functions (getServerData, getStaticData) */
|
|
7
|
+
export declare const DATA_FETCH_TIMEOUT_MS = 10000;
|
|
8
|
+
export declare const DEFAULT_CACHE_MAX_SIZE = 100;
|
|
9
|
+
export declare const DURATION_HISTOGRAM_BOUNDARIES_MS: readonly [5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000];
|
|
10
|
+
export declare const SIZE_HISTOGRAM_BOUNDARIES_KB: readonly [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000];
|
|
11
|
+
export declare const defaultConfig: {
|
|
12
|
+
readonly server: {
|
|
13
|
+
readonly port: 3000;
|
|
14
|
+
readonly hostname: "0.0.0.0";
|
|
15
|
+
};
|
|
16
|
+
readonly timeouts: {
|
|
17
|
+
readonly default: 5000;
|
|
18
|
+
readonly api: 30000;
|
|
19
|
+
readonly ssr: 10000;
|
|
20
|
+
readonly hmr: 30000;
|
|
21
|
+
readonly sandbox: 5000;
|
|
22
|
+
};
|
|
23
|
+
readonly cache: {
|
|
24
|
+
readonly jit: {
|
|
25
|
+
readonly maxSize: 100;
|
|
26
|
+
readonly tempDirPrefix: "vf-bundle-";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly metrics: {
|
|
30
|
+
readonly ssrBoundaries: readonly [5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const DEFAULT_PREFETCH_DELAY_MS = 100;
|
|
34
|
+
export declare const DEFAULT_METRICS_COLLECT_INTERVAL_MS = 60000;
|
|
35
|
+
export declare const DEFAULT_REDIS_SCAN_COUNT = 100;
|
|
36
|
+
export declare const DEFAULT_REDIS_BATCH_DELETE_SIZE = 1000;
|
|
37
|
+
export declare const PAGE_TRANSITION_DELAY_MS = 150;
|
|
38
|
+
export type DefaultConfig = typeof defaultConfig;
|
|
39
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,gCAAgC,iFAenC,CAAC;AAEX,eAAO,MAAM,4BAA4B,qEAa/B,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;CAqBhB,CAAC;AAEX,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,eAAO,MAAM,mCAAmC,QAAQ,CAAC;AACzD,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,+BAA+B,OAAO,CAAC;AACpD,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DEFAULT_PORT } from "../platform/compat/constants.js";
|
|
2
|
+
export { DEFAULT_PORT };
|
|
3
|
+
export const DEFAULT_TIMEOUT_MS = 5000;
|
|
4
|
+
export const SSR_TIMEOUT_MS = 10000;
|
|
5
|
+
export const SANDBOX_TIMEOUT_MS = 5000;
|
|
6
|
+
/** Timeout for user data fetching functions (getServerData, getStaticData) */
|
|
7
|
+
export const DATA_FETCH_TIMEOUT_MS = 10000;
|
|
8
|
+
export const DEFAULT_CACHE_MAX_SIZE = 100;
|
|
9
|
+
export const DURATION_HISTOGRAM_BOUNDARIES_MS = [
|
|
10
|
+
5,
|
|
11
|
+
10,
|
|
12
|
+
25,
|
|
13
|
+
50,
|
|
14
|
+
75,
|
|
15
|
+
100,
|
|
16
|
+
250,
|
|
17
|
+
500,
|
|
18
|
+
750,
|
|
19
|
+
1000,
|
|
20
|
+
2500,
|
|
21
|
+
5000,
|
|
22
|
+
7500,
|
|
23
|
+
10000,
|
|
24
|
+
];
|
|
25
|
+
export const SIZE_HISTOGRAM_BOUNDARIES_KB = [
|
|
26
|
+
1,
|
|
27
|
+
5,
|
|
28
|
+
10,
|
|
29
|
+
25,
|
|
30
|
+
50,
|
|
31
|
+
100,
|
|
32
|
+
250,
|
|
33
|
+
500,
|
|
34
|
+
1000,
|
|
35
|
+
2500,
|
|
36
|
+
5000,
|
|
37
|
+
10000,
|
|
38
|
+
];
|
|
39
|
+
export const defaultConfig = {
|
|
40
|
+
server: {
|
|
41
|
+
port: DEFAULT_PORT,
|
|
42
|
+
hostname: "0.0.0.0",
|
|
43
|
+
},
|
|
44
|
+
timeouts: {
|
|
45
|
+
default: DEFAULT_TIMEOUT_MS,
|
|
46
|
+
api: 30000,
|
|
47
|
+
ssr: SSR_TIMEOUT_MS,
|
|
48
|
+
hmr: 30000,
|
|
49
|
+
sandbox: SANDBOX_TIMEOUT_MS,
|
|
50
|
+
},
|
|
51
|
+
cache: {
|
|
52
|
+
jit: {
|
|
53
|
+
maxSize: DEFAULT_CACHE_MAX_SIZE,
|
|
54
|
+
tempDirPrefix: "vf-bundle-",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
metrics: {
|
|
58
|
+
ssrBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const DEFAULT_PREFETCH_DELAY_MS = 100;
|
|
62
|
+
export const DEFAULT_METRICS_COLLECT_INTERVAL_MS = 60000;
|
|
63
|
+
export const DEFAULT_REDIS_SCAN_COUNT = 100;
|
|
64
|
+
export const DEFAULT_REDIS_BATCH_DELETE_SIZE = 1000;
|
|
65
|
+
export const PAGE_TRANSITION_DELAY_MS = 150;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const AGENT_ERROR: import("../types.js").RegisteredError;
|
|
2
|
+
export declare const AGENT_NOT_FOUND: import("../types.js").RegisteredError;
|
|
3
|
+
export declare const AGENT_TIMEOUT: import("../types.js").RegisteredError;
|
|
4
|
+
export declare const AGENT_INTENT_ERROR: import("../types.js").RegisteredError;
|
|
5
|
+
export declare const ORCHESTRATION_ERROR: import("../types.js").RegisteredError;
|
|
6
|
+
export declare const COST_LIMIT_EXCEEDED: import("../types.js").RegisteredError;
|
|
7
|
+
export declare const TOOL_ID_CONFLICT: import("../types.js").RegisteredError;
|
|
8
|
+
/** Registry fragment for AGENT errors (slug → definition). */
|
|
9
|
+
export declare const AGENT_REGISTRY: {
|
|
10
|
+
readonly "agent-error": import("../types.js").RegisteredError;
|
|
11
|
+
readonly "agent-not-found": import("../types.js").RegisteredError;
|
|
12
|
+
readonly "agent-timeout": import("../types.js").RegisteredError;
|
|
13
|
+
readonly "agent-intent-error": import("../types.js").RegisteredError;
|
|
14
|
+
readonly "orchestration-error": import("../types.js").RegisteredError;
|
|
15
|
+
readonly "cost-limit-exceeded": import("../types.js").RegisteredError;
|
|
16
|
+
readonly "tool-id-conflict": import("../types.js").RegisteredError;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../../src/src/errors/error-registry/agent.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,uCAMtB,CAAC;AAEH,eAAO,MAAM,eAAe,uCAM1B,CAAC;AAEH,eAAO,MAAM,aAAa,uCAMxB,CAAC;AAEH,eAAO,MAAM,kBAAkB,uCAM7B,CAAC;AAEH,eAAO,MAAM,mBAAmB,uCAM9B,CAAC;AAEH,eAAO,MAAM,mBAAmB,uCAM9B,CAAC;AAEH,eAAO,MAAM,gBAAgB,uCAM3B,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,cAAc;;;;;;;;CAQjB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineError } from "../types.js";
|
|
2
|
+
export const AGENT_ERROR = defineError({
|
|
3
|
+
slug: "agent-error",
|
|
4
|
+
category: "AGENT",
|
|
5
|
+
status: 500,
|
|
6
|
+
title: "Agent operation error",
|
|
7
|
+
suggestion: "Check agent configuration and logs",
|
|
8
|
+
});
|
|
9
|
+
export const AGENT_NOT_FOUND = defineError({
|
|
10
|
+
slug: "agent-not-found",
|
|
11
|
+
category: "AGENT",
|
|
12
|
+
status: 404,
|
|
13
|
+
title: "Agent not found",
|
|
14
|
+
suggestion: "Verify the agent ID exists",
|
|
15
|
+
});
|
|
16
|
+
export const AGENT_TIMEOUT = defineError({
|
|
17
|
+
slug: "agent-timeout",
|
|
18
|
+
category: "AGENT",
|
|
19
|
+
status: 408,
|
|
20
|
+
title: "Agent operation timed out",
|
|
21
|
+
suggestion: "Increase timeout or simplify the request",
|
|
22
|
+
});
|
|
23
|
+
export const AGENT_INTENT_ERROR = defineError({
|
|
24
|
+
slug: "agent-intent-error",
|
|
25
|
+
category: "AGENT",
|
|
26
|
+
status: 400,
|
|
27
|
+
title: "Agent intent parsing error",
|
|
28
|
+
suggestion: "Rephrase the request more clearly",
|
|
29
|
+
});
|
|
30
|
+
export const ORCHESTRATION_ERROR = defineError({
|
|
31
|
+
slug: "orchestration-error",
|
|
32
|
+
category: "AGENT",
|
|
33
|
+
status: 500,
|
|
34
|
+
title: "Multi-agent orchestration error",
|
|
35
|
+
suggestion: "Check agent coordination logic",
|
|
36
|
+
});
|
|
37
|
+
export const COST_LIMIT_EXCEEDED = defineError({
|
|
38
|
+
slug: "cost-limit-exceeded",
|
|
39
|
+
category: "AGENT",
|
|
40
|
+
status: 429,
|
|
41
|
+
title: "Cost limit exceeded",
|
|
42
|
+
suggestion: "Wait for the budget period to reset or increase the limit",
|
|
43
|
+
});
|
|
44
|
+
export const TOOL_ID_CONFLICT = defineError({
|
|
45
|
+
slug: "tool-id-conflict",
|
|
46
|
+
category: "AGENT",
|
|
47
|
+
status: 409,
|
|
48
|
+
title: "Tool ID conflict",
|
|
49
|
+
suggestion: "Use a unique tool ID or rename one of the conflicting tools",
|
|
50
|
+
});
|
|
51
|
+
/** Registry fragment for AGENT errors (slug → definition). */
|
|
52
|
+
export const AGENT_REGISTRY = {
|
|
53
|
+
"agent-error": AGENT_ERROR,
|
|
54
|
+
"agent-not-found": AGENT_NOT_FOUND,
|
|
55
|
+
"agent-timeout": AGENT_TIMEOUT,
|
|
56
|
+
"agent-intent-error": AGENT_INTENT_ERROR,
|
|
57
|
+
"orchestration-error": ORCHESTRATION_ERROR,
|
|
58
|
+
"cost-limit-exceeded": COST_LIMIT_EXCEEDED,
|
|
59
|
+
"tool-id-conflict": TOOL_ID_CONFLICT,
|
|
60
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const CLIENT_BOUNDARY_VIOLATION: import("../types.js").RegisteredError;
|
|
2
|
+
export declare const SERVER_ONLY_IN_CLIENT: import("../types.js").RegisteredError;
|
|
3
|
+
export declare const CLIENT_ONLY_IN_SERVER: import("../types.js").RegisteredError;
|
|
4
|
+
export declare const INVALID_USE_CLIENT: import("../types.js").RegisteredError;
|
|
5
|
+
export declare const INVALID_USE_SERVER: import("../types.js").RegisteredError;
|
|
6
|
+
export declare const RSC_PAYLOAD_ERROR: import("../types.js").RegisteredError;
|
|
7
|
+
/** Registry fragment for BOUNDARY errors (slug → definition). */
|
|
8
|
+
export declare const BOUNDARY_REGISTRY: {
|
|
9
|
+
readonly "client-boundary-violation": import("../types.js").RegisteredError;
|
|
10
|
+
readonly "server-only-in-client": import("../types.js").RegisteredError;
|
|
11
|
+
readonly "client-only-in-server": import("../types.js").RegisteredError;
|
|
12
|
+
readonly "invalid-use-client": import("../types.js").RegisteredError;
|
|
13
|
+
readonly "invalid-use-server": import("../types.js").RegisteredError;
|
|
14
|
+
readonly "rsc-payload-error": import("../types.js").RegisteredError;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../../src/src/errors/error-registry/boundary.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,uCAMpC,CAAC;AAEH,eAAO,MAAM,qBAAqB,uCAMhC,CAAC;AAEH,eAAO,MAAM,qBAAqB,uCAMhC,CAAC;AAEH,eAAO,MAAM,kBAAkB,uCAM7B,CAAC;AAEH,eAAO,MAAM,kBAAkB,uCAM7B,CAAC;AAEH,eAAO,MAAM,iBAAiB,uCAM5B,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,iBAAiB;;;;;;;CAOpB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineError } from "../types.js";
|
|
2
|
+
export const CLIENT_BOUNDARY_VIOLATION = defineError({
|
|
3
|
+
slug: "client-boundary-violation",
|
|
4
|
+
category: "BOUNDARY",
|
|
5
|
+
status: 400,
|
|
6
|
+
title: "Client boundary rule violation",
|
|
7
|
+
suggestion: "Add 'use client' directive or move code to a client component",
|
|
8
|
+
});
|
|
9
|
+
export const SERVER_ONLY_IN_CLIENT = defineError({
|
|
10
|
+
slug: "server-only-in-client",
|
|
11
|
+
category: "BOUNDARY",
|
|
12
|
+
status: 400,
|
|
13
|
+
title: "Server-only code in client component",
|
|
14
|
+
suggestion: "Move server-only code to a server component",
|
|
15
|
+
});
|
|
16
|
+
export const CLIENT_ONLY_IN_SERVER = defineError({
|
|
17
|
+
slug: "client-only-in-server",
|
|
18
|
+
category: "BOUNDARY",
|
|
19
|
+
status: 400,
|
|
20
|
+
title: "Client-only code in server component",
|
|
21
|
+
suggestion: "Move client-only code to a client component",
|
|
22
|
+
});
|
|
23
|
+
export const INVALID_USE_CLIENT = defineError({
|
|
24
|
+
slug: "invalid-use-client",
|
|
25
|
+
category: "BOUNDARY",
|
|
26
|
+
status: 400,
|
|
27
|
+
title: "Invalid 'use client' directive",
|
|
28
|
+
suggestion: "Place 'use client' at the top of the file",
|
|
29
|
+
});
|
|
30
|
+
export const INVALID_USE_SERVER = defineError({
|
|
31
|
+
slug: "invalid-use-server",
|
|
32
|
+
category: "BOUNDARY",
|
|
33
|
+
status: 400,
|
|
34
|
+
title: "Invalid 'use server' directive",
|
|
35
|
+
suggestion: "Place 'use server' at the top of the file or function",
|
|
36
|
+
});
|
|
37
|
+
export const RSC_PAYLOAD_ERROR = defineError({
|
|
38
|
+
slug: "rsc-payload-error",
|
|
39
|
+
category: "BOUNDARY",
|
|
40
|
+
status: 500,
|
|
41
|
+
title: "RSC payload serialization error",
|
|
42
|
+
suggestion: "Ensure props are serializable (no functions, symbols, etc.)",
|
|
43
|
+
});
|
|
44
|
+
/** Registry fragment for BOUNDARY errors (slug → definition). */
|
|
45
|
+
export const BOUNDARY_REGISTRY = {
|
|
46
|
+
"client-boundary-violation": CLIENT_BOUNDARY_VIOLATION,
|
|
47
|
+
"server-only-in-client": SERVER_ONLY_IN_CLIENT,
|
|
48
|
+
"client-only-in-server": CLIENT_ONLY_IN_SERVER,
|
|
49
|
+
"invalid-use-client": INVALID_USE_CLIENT,
|
|
50
|
+
"invalid-use-server": INVALID_USE_SERVER,
|
|
51
|
+
"rsc-payload-error": RSC_PAYLOAD_ERROR,
|
|
52
|
+
};
|