@deepseek-ai/dsh-otel 0.2.1-alpha.1 → 0.2.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +3 -1
- package/README.zh.md +3 -1
- package/lib/index.js +14 -4
- package/lib/types/event-log.d.ts +2 -1
- package/lib/types/event-transport.d.ts +2 -4
- package/lib/types/index.d.ts +2 -1
- package/lib/types/session-log.d.ts +11 -7
- package/lib/types/transport.d.ts +20 -8
- package/locale/en.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +14 -12
package/README.i18n.yaml
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
en: f141a9d909c555d8
|
|
19
19
|
zh: e4f5b690ccb1337c
|
|
20
20
|
/deepseek-ai-dsh-otel/understand-the-implementation:
|
|
21
|
-
en:
|
|
22
|
-
zh:
|
|
21
|
+
en: 56298bd5a3be2cdb
|
|
22
|
+
zh: 4dff467a0cb30a38
|
|
23
23
|
/deepseek-ai-dsh-otel/further-exploration:
|
|
24
24
|
en: ee17b991de098cc0
|
|
25
25
|
zh: f90257e411921f2b
|
package/README.md
CHANGED
|
@@ -34,7 +34,9 @@ Headers are explicit. The service does not add a channel header or inherit ambie
|
|
|
34
34
|
<a id="understand-the-implementation"></a>
|
|
35
35
|
## Understand the implementation
|
|
36
36
|
|
|
37
|
-
`src/index.ts` registers the service; `event-log.ts` owns ordinary SDK batching; `session-log.ts` owns byte/count scheduling; `transport.ts` supplies the Session SDK JSON HTTP delegate; `event-transport.ts` uses Got for cancellable ordinary-event HTTP requests and retry waits with SDK serialization and export accounting. No global OTel provider is installed. The Session processor measures each record once, groups conservative sizes, and waits for the SDK concurrency queue to clear after every callback before sending another request.
|
|
37
|
+
`src/index.ts` registers the service; `event-log.ts` owns ordinary SDK batching; `session-log.ts` owns byte/count scheduling; `transport.ts` supplies the Session SDK JSON HTTP delegate and owns the shared exporter metrics recorder, which receives no meter provider and records nothing; `event-transport.ts` uses Got for cancellable ordinary-event HTTP requests and retry waits with SDK serialization and export accounting. No global OTel provider is installed; the accepted exporter options exclude the upstream `selfObsMeterProvider`, and the Session processor accepts only the batching fields it implements, so exporter and Session-processor self-observability metrics stay unrecorded. The Session processor measures each record once, groups conservative sizes, and waits for the SDK concurrency queue to clear after every callback before sending another request.
|
|
38
|
+
|
|
39
|
+
OpenTelemetry SDK dependencies use exact versions from one coordinated release across this service and its two adapters.
|
|
38
40
|
|
|
39
41
|
Composition tests exercise independent channels and service removal; adapter tests cover dependent-fiber cleanup and feedback authorization.
|
|
40
42
|
|
package/README.zh.md
CHANGED
|
@@ -34,7 +34,9 @@ Header 显式提供。服务不会附加 channel header,也不继承环境中
|
|
|
34
34
|
<a id="understand-the-implementation"></a>
|
|
35
35
|
## 理解实现
|
|
36
36
|
|
|
37
|
-
`src/index.ts` 注册服务;`event-log.ts` 负责普通事件的 SDK 聚合;`session-log.ts` 负责字节和条数调度;`transport.ts` 提供 Session 的 SDK JSON HTTP delegate
|
|
37
|
+
`src/index.ts` 注册服务;`event-log.ts` 负责普通事件的 SDK 聚合;`session-log.ts` 负责字节和条数调度;`transport.ts` 提供 Session 的 SDK JSON HTTP delegate,并持有共享的 exporter 指标记录器(不接收 meter provider,不记录任何指标);`event-transport.ts` 使用 Got 实现可取消的普通事件 HTTP 请求和重试等待,序列化与导出计数仍由 SDK 负责。不安装全局 OTel provider;接受的 exporter 选项排除上游的 `selfObsMeterProvider`,Session processor 也只接受它实现的聚合字段,因此 exporter 和 Session processor 的自观测指标都不会被记录。Session processor 对每条记录只计量一次,按保守大小组包,并在每次回调后等待 SDK 并发队列清理完成才发送下一请求。
|
|
38
|
+
|
|
39
|
+
本服务及其两个适配器的 OpenTelemetry SDK 依赖使用同一配套版本系列的精确版本。
|
|
38
40
|
|
|
39
41
|
组合测试覆盖独立通道和服务移除;适配器测试覆盖依赖 fiber 清理与反馈授权。
|
|
40
42
|
|
package/lib/index.js
CHANGED
|
@@ -7,17 +7,27 @@ import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs
|
|
|
7
7
|
import { gzipSync } from "node:zlib";
|
|
8
8
|
import got from "got";
|
|
9
9
|
import { OTLPExporterBase, createOtlpNetworkExportDelegate, getSharedConfigurationDefaults, mergeOtlpSharedConfigurationWithDefaults } from "@opentelemetry/otlp-exporter-base";
|
|
10
|
-
import { JsonLogsSerializer } from "@opentelemetry/otlp-transformer";
|
|
11
|
-
import { createOtlpHttpExportDelegate, getSharedConfigurationFromEnvironment, httpAgentFactoryFromOptions } from "@opentelemetry/otlp-exporter-base/node-http";
|
|
10
|
+
import { JsonLogsSerializer, LogsExporterMetricsHelper } from "@opentelemetry/otlp-transformer";
|
|
11
|
+
import { createOtlpHttpExportDelegate, createOtlpHttpExporterMetrics, getSharedConfigurationFromEnvironment, httpAgentFactoryFromOptions } from "@opentelemetry/otlp-exporter-base/node-http";
|
|
12
12
|
//#region lib/types/transport.js
|
|
13
13
|
/** Explicit OTLP JSON transport for feedback-authorized Session logs. */
|
|
14
|
+
/** `otel.component.type` reported by OTLP HTTP log exporter self-observability metrics. */
|
|
15
|
+
const OTLP_HTTP_LOG_EXPORTER_COMPONENT_TYPE = "otlp_http_log_exporter";
|
|
14
16
|
/**
|
|
15
17
|
* Create an SDK JSON exporter without inheriting another collector's headers or TLS identity.
|
|
16
18
|
* @param options - explicit endpoint, headers, agent, and SDK transport settings.
|
|
17
19
|
* @returns the exporter owned by one independent log pipeline.
|
|
18
20
|
*/
|
|
19
21
|
function createLogExporter(options) {
|
|
20
|
-
return new OTLPExporterBase(createOtlpHttpExportDelegate(logTransportOptions(options), JsonLogsSerializer));
|
|
22
|
+
return new OTLPExporterBase(createOtlpHttpExportDelegate(logTransportOptions(options), JsonLogsSerializer, OTLP_HTTP_LOG_EXPORTER_COMPONENT_TYPE, LogsExporterMetricsHelper, void 0));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create one log exporter's self-observability metrics; without a meter provider they record nothing.
|
|
26
|
+
* @param url - collector endpoint recorded as the metrics server address and port.
|
|
27
|
+
* @returns the metrics recorder required by an OTLP HTTP log export delegate.
|
|
28
|
+
*/
|
|
29
|
+
function createLogExporterMetrics(url) {
|
|
30
|
+
return createOtlpHttpExporterMetrics(OTLP_HTTP_LOG_EXPORTER_COMPONENT_TYPE, LogsExporterMetricsHelper, url, void 0);
|
|
21
31
|
}
|
|
22
32
|
/**
|
|
23
33
|
* Resolve collector-local headers and agents with shared SDK timeout and compression defaults.
|
|
@@ -50,7 +60,7 @@ function logTransportOptions(options) {
|
|
|
50
60
|
function createEventLogExporter(options, signal) {
|
|
51
61
|
const config = logTransportOptions(options);
|
|
52
62
|
let agent;
|
|
53
|
-
const exporter = new OTLPExporterBase(createOtlpNetworkExportDelegate(config, JsonLogsSerializer, {
|
|
63
|
+
const exporter = new OTLPExporterBase(createOtlpNetworkExportDelegate(config, JsonLogsSerializer, createLogExporterMetrics(config.url), {
|
|
54
64
|
async send(data, timeoutMillis) {
|
|
55
65
|
signal.throwIfAborted();
|
|
56
66
|
agent ??= config.agentFactory(new URL(config.url).protocol);
|
package/lib/types/event-log.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Attributes } from '@opentelemetry/api';
|
|
|
3
3
|
import { SeverityNumber } from '@opentelemetry/api-logs';
|
|
4
4
|
import type { BatchLogRecordProcessorOptions } from '@opentelemetry/sdk-logs';
|
|
5
5
|
import type { SessionLogOptions } from './session-log.ts';
|
|
6
|
+
import type { LogExporterOptions } from './transport.ts';
|
|
6
7
|
/** Scalar values accepted by the collector's Arrow attributes map. */
|
|
7
8
|
export type OTelEventScalar = string | number | boolean;
|
|
8
9
|
/** Explicitly selected analytics fields; object values may contain scalars only. */
|
|
@@ -20,7 +21,7 @@ export interface OTelEventRecord {
|
|
|
20
21
|
}
|
|
21
22
|
/** Ordinary-event transport, resource, scope, and count-batching options. */
|
|
22
23
|
export interface EventLogOptions {
|
|
23
|
-
exporter:
|
|
24
|
+
exporter: LogExporterOptions;
|
|
24
25
|
resourceAttributes: Attributes;
|
|
25
26
|
scope: {
|
|
26
27
|
name: string;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { type OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
2
1
|
import type { LogRecordExporter } from '@opentelemetry/sdk-logs';
|
|
2
|
+
import { type LogExporterOptions } from './transport.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Create a channel-owned exporter whose cancellation releases requests and retry timers.
|
|
5
5
|
* @param options - explicit collector and SDK HTTP settings.
|
|
6
6
|
* @param signal - channel cancellation, shared by current and future batch exports.
|
|
7
7
|
* @returns the SDK exporter; shutdown also destroys its owned HTTP agent.
|
|
8
8
|
*/
|
|
9
|
-
export declare function createEventLogExporter(options:
|
|
10
|
-
url: string;
|
|
11
|
-
}, signal: AbortSignal): LogRecordExporter;
|
|
9
|
+
export declare function createEventLogExporter(options: LogExporterOptions, signal: AbortSignal): LogRecordExporter;
|
|
12
10
|
//# sourceMappingURL=event-transport.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -26,5 +26,6 @@ export default class OTel extends Service {
|
|
|
26
26
|
createSessionLogReporter(options: SessionLogOptions): SessionLogReporter;
|
|
27
27
|
}
|
|
28
28
|
export type { EventLogOptions, OTelEventRecord, OTelEventScalar, EventLogReporter } from './event-log.ts';
|
|
29
|
-
export type { SessionLogRecord, SessionLogOptions, SessionLogReporter } from './session-log.ts';
|
|
29
|
+
export type { SessionLogProcessorOptions, SessionLogRecord, SessionLogOptions, SessionLogReporter } from './session-log.ts';
|
|
30
|
+
export type { LogExporterOptions } from './transport.ts';
|
|
30
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session';
|
|
3
3
|
import type { Attributes } from '@opentelemetry/api';
|
|
4
4
|
import { SeverityNumber } from '@opentelemetry/api-logs';
|
|
5
|
-
import type { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
6
5
|
import { type BatchLogRecordProcessorOptions } from '@opentelemetry/sdk-logs';
|
|
6
|
+
import { type LogExporterOptions } from './transport.ts';
|
|
7
7
|
/** Collector request ceiling in uncompressed UTF-8 bytes, including the OTLP envelope. */
|
|
8
8
|
export declare const SESSION_LOG_MAX_REQUEST_BYTES = 4000000;
|
|
9
9
|
/** One canonical event with its separately owned Session identity and redacted payload. */
|
|
@@ -18,15 +18,19 @@ export interface SessionLogRecord {
|
|
|
18
18
|
/** Omitted values use INFO. */
|
|
19
19
|
severityNumber?: SeverityNumber;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Byte and count batching fields implemented by {@link SessionLogProcessor}.
|
|
23
|
+
*
|
|
24
|
+
* `exporter` belongs to the owning channel, and `selfObsMeterProvider` is
|
|
25
|
+
* excluded because this processor implements no self-observability metering.
|
|
26
|
+
*/
|
|
27
|
+
export type SessionLogProcessorOptions = Omit<BatchLogRecordProcessorOptions, 'exporter' | 'selfObsMeterProvider'>;
|
|
21
28
|
/** Session-log transport and byte/count queue settings. */
|
|
22
29
|
export interface SessionLogOptions {
|
|
23
|
-
/** Explicit destination and SDK transport
|
|
24
|
-
exporter:
|
|
25
|
-
/** Full HTTP(S) logs destination. */
|
|
26
|
-
url: string;
|
|
27
|
-
};
|
|
30
|
+
/** Explicit destination and SDK transport settings; exporter self-observability metering is not supported. */
|
|
31
|
+
exporter: LogExporterOptions;
|
|
28
32
|
/** Session-only queue settings, independent of product-event aggregation. */
|
|
29
|
-
processor?:
|
|
33
|
+
processor?: SessionLogProcessorOptions;
|
|
30
34
|
/** May lower, but never exceed, the collector's 4,000,000-byte limit. */
|
|
31
35
|
maxRequestBytes?: number;
|
|
32
36
|
/** Instrumentation scope supplied by the business owner. */
|
package/lib/types/transport.d.ts
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
/** Explicit OTLP JSON transport for feedback-authorized Session logs. */
|
|
2
2
|
import { createOtlpHttpExportDelegate } from '@opentelemetry/otlp-exporter-base/node-http';
|
|
3
|
-
import { type OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
4
|
-
import type { LogRecordExporter } from '@opentelemetry/sdk-logs';
|
|
3
|
+
import { type ExporterMetrics, type OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base';
|
|
4
|
+
import type { LogRecordExporter, ReadableLogRecord } from '@opentelemetry/sdk-logs';
|
|
5
|
+
/**
|
|
6
|
+
* Collector and SDK HTTP settings accepted by this package's log exporters.
|
|
7
|
+
*
|
|
8
|
+
* `OTLPExporterConfigBase.selfObsMeterProvider` is excluded: every channel here
|
|
9
|
+
* passes no meter provider to the exporter metrics recorder, which stays noop.
|
|
10
|
+
*/
|
|
11
|
+
export type LogExporterOptions = Omit<OTLPExporterNodeConfigBase, 'selfObsMeterProvider'> & {
|
|
12
|
+
/** Full HTTP(S) logs destination. */
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
|
5
15
|
/**
|
|
6
16
|
* Create an SDK JSON exporter without inheriting another collector's headers or TLS identity.
|
|
7
17
|
* @param options - explicit endpoint, headers, agent, and SDK transport settings.
|
|
8
18
|
* @returns the exporter owned by one independent log pipeline.
|
|
9
19
|
*/
|
|
10
|
-
export declare function createLogExporter(options:
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
export declare function createLogExporter(options: LogExporterOptions): LogRecordExporter;
|
|
21
|
+
/**
|
|
22
|
+
* Create one log exporter's self-observability metrics; without a meter provider they record nothing.
|
|
23
|
+
* @param url - collector endpoint recorded as the metrics server address and port.
|
|
24
|
+
* @returns the metrics recorder required by an OTLP HTTP log export delegate.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createLogExporterMetrics(url: string): ExporterMetrics<ReadableLogRecord[]>;
|
|
13
27
|
/**
|
|
14
28
|
* Resolve collector-local headers and agents with shared SDK timeout and compression defaults.
|
|
15
29
|
* @param options - explicit endpoint and SDK HTTP settings.
|
|
16
30
|
* @returns resolved transport settings without ambient credentials.
|
|
17
31
|
*/
|
|
18
|
-
export declare function logTransportOptions(options:
|
|
19
|
-
url: string;
|
|
20
|
-
}): Parameters<typeof createOtlpHttpExportDelegate>[0];
|
|
32
|
+
export declare function logTransportOptions(options: LogExporterOptions): Parameters<typeof createOtlpHttpExportDelegate>[0];
|
|
21
33
|
//# sourceMappingURL=transport.d.ts.map
|
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-otel",
|
|
3
3
|
"description": "Cordis service for independent ordinary-event and byte-bounded Session-log OTLP channels",
|
|
4
|
-
"version": "0.2.1-alpha.
|
|
4
|
+
"version": "0.2.1-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -19,29 +19,31 @@
|
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
21
|
"./src/*": "./src/*",
|
|
22
|
-
"./package.json": "./package.json"
|
|
22
|
+
"./package.json": "./package.json",
|
|
23
|
+
"./locale/*.json": "./locale/*.json"
|
|
23
24
|
},
|
|
24
25
|
"files": [
|
|
26
|
+
"locale/*.json",
|
|
25
27
|
"lib/index.js",
|
|
26
28
|
"lib/types/**/*.d.ts"
|
|
27
29
|
],
|
|
28
30
|
"license": "MIT",
|
|
29
31
|
"dependencies": {
|
|
30
32
|
"@opentelemetry/api": "^1.9.1",
|
|
31
|
-
"@opentelemetry/api-logs": "
|
|
32
|
-
"@opentelemetry/otlp-exporter-base": "
|
|
33
|
-
"@opentelemetry/resources": "
|
|
34
|
-
"@opentelemetry/sdk-logs": "
|
|
35
|
-
"@opentelemetry/core": "2.
|
|
36
|
-
"@opentelemetry/otlp-transformer": "
|
|
33
|
+
"@opentelemetry/api-logs": "0.222.0",
|
|
34
|
+
"@opentelemetry/otlp-exporter-base": "0.222.0",
|
|
35
|
+
"@opentelemetry/resources": "2.11.0",
|
|
36
|
+
"@opentelemetry/sdk-logs": "0.222.0",
|
|
37
|
+
"@opentelemetry/core": "2.11.0",
|
|
38
|
+
"@opentelemetry/otlp-transformer": "0.222.0",
|
|
37
39
|
"got": "^14.6.6"
|
|
38
40
|
},
|
|
39
41
|
"peerDependencies": {
|
|
40
|
-
"@deepseek-ai/cordis": "~4.0.5-alpha.
|
|
41
|
-
"@deepseek-ai/dsh-session": "0.2.1-alpha.
|
|
42
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
43
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.3"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
|
-
"@deepseek-ai/cordis": "~4.0.5-alpha.
|
|
45
|
-
"@deepseek-ai/dsh-session": "0.2.1-alpha.
|
|
46
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
47
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.3"
|
|
46
48
|
}
|
|
47
49
|
}
|