@sebspark/opentelemetry-instrumentation-opensearch 0.1.1 → 0.2.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.
- package/README.md +35 -9
- package/dist/index.d.mts +5 -37
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +106 -67
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -78,13 +78,39 @@ new OpenSearchInstrumentation({ suppressInternalInstrumentation: true })
|
|
|
78
78
|
|
|
79
79
|
## Produced spans
|
|
80
80
|
|
|
81
|
-
| Attribute | Example | Notes |
|
|
82
|
-
|---|---|---|
|
|
83
|
-
| `db.system.name` | `opensearch` | Always set |
|
|
84
|
-
| `db.operation.name` | `search` | Parsed from path (`_search` → `search`) |
|
|
85
|
-
| `db.opensearch.index` | `asset_v0.1.3` | Omitted for cluster-level operations like `bulk` |
|
|
86
|
-
| `db.query.text` | `{"query":{"match_all":{}}}` | Omitted when `dbStatementSerializer: false` |
|
|
87
|
-
| `server.address` | `localhost` | Set from the connection used for the request |
|
|
88
|
-
| `server.port` | `9200` | Omitted when using the default port for the protocol |
|
|
89
|
-
|
|
90
81
|
Span name follows the pattern `<operation> <index>` (e.g. `search asset_v0.1.3`) or just `<operation>` for index-less operations like `bulk`. Falls back to the raw path when the path does not contain an underscore-prefixed operation segment.
|
|
82
|
+
|
|
83
|
+
### Request attributes
|
|
84
|
+
|
|
85
|
+
Set at span creation, before the request is sent.
|
|
86
|
+
|
|
87
|
+
| Attribute | Type | Example | Notes |
|
|
88
|
+
|---|---|---|---|
|
|
89
|
+
| `db.system.name` | string | `opensearch` | Always set |
|
|
90
|
+
| `db.operation.name` | string | `search` | Parsed from path (`_search` → `search`). Omitted when path has no operation segment |
|
|
91
|
+
| `db.opensearch.index` | string | `asset_v0.1.3` | Omitted for cluster-level operations like `_bulk` |
|
|
92
|
+
| `db.query.text` | string | `{"query":{"match_all":{}}}` | The serialized request body. Omitted for bodyless requests or when `dbStatementSerializer: false` |
|
|
93
|
+
|
|
94
|
+
### Response attributes
|
|
95
|
+
|
|
96
|
+
Set on the span after a successful response.
|
|
97
|
+
|
|
98
|
+
| Attribute | Type | Example | Notes |
|
|
99
|
+
|---|---|---|---|
|
|
100
|
+
| `server.address` | string | `opensearch.example.com` | Hostname of the node that handled the request |
|
|
101
|
+
| `server.port` | number | `9200` | Omitted when using the default port for the protocol |
|
|
102
|
+
| `http.response.status_code` | number | `200` | HTTP status code of the response |
|
|
103
|
+
| `db.opensearch.took` | number | `5` | Time in milliseconds OpenSearch spent executing the request |
|
|
104
|
+
| `db.opensearch.timed_out` | boolean | `false` | Whether the request hit the `timeout` threshold |
|
|
105
|
+
| `db.opensearch.terminated_early` | boolean | `true` | Whether the request hit the `terminate_after` document limit and returned partial results. Omitted when not present |
|
|
106
|
+
| `db.opensearch.shards.total` | number | `5` | Total number of shards the request was executed against |
|
|
107
|
+
| `db.opensearch.shards.successful` | number | `5` | Number of shards that responded successfully |
|
|
108
|
+
| `db.opensearch.shards.failed` | number | `0` | Number of shards that failed |
|
|
109
|
+
| `db.opensearch.shards.skipped` | number | `2` | Number of shards skipped (e.g. due to shard-level filtering). Omitted when not present |
|
|
110
|
+
| `db.opensearch.hits.total` | number | `42` | Total number of matching documents. Omitted for non-search responses or when `hits.total` is not an object |
|
|
111
|
+
| `db.opensearch.phase_took.can_match` | number | `1` | Time in milliseconds spent in the can-match phase. Only present for DFS queries |
|
|
112
|
+
| `db.opensearch.phase_took.dfs_pre_query` | number | `2` | Time in milliseconds spent in the DFS pre-query phase |
|
|
113
|
+
| `db.opensearch.phase_took.dfs_query` | number | `3` | Time in milliseconds spent in the DFS query phase |
|
|
114
|
+
| `db.opensearch.phase_took.expand` | number | `0` | Time in milliseconds spent expanding search results |
|
|
115
|
+
| `db.opensearch.phase_took.fetch` | number | `1` | Time in milliseconds spent fetching documents |
|
|
116
|
+
| `db.opensearch.phase_took.query` | number | `4` | Time in milliseconds spent in the query phase |
|
package/dist/index.d.mts
CHANGED
|
@@ -1,57 +1,25 @@
|
|
|
1
1
|
import { ApiResponse, TransportRequestParams } from "@opensearch-project/opensearch/lib/Transport.js";
|
|
2
|
-
import { Span } from "@opentelemetry/api";
|
|
3
2
|
import { InstrumentationBase, InstrumentationConfig } from "@opentelemetry/instrumentation";
|
|
3
|
+
import { Span } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
|
-
//#region src/
|
|
6
|
-
/** Configuration for {@link OpenSearchInstrumentation}. */
|
|
5
|
+
//#region src/types.d.ts
|
|
7
6
|
interface OpenSearchInstrumentationConfig extends InstrumentationConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Serialize the request body into `db.query.text`.
|
|
10
|
-
* Set to `false` to disable capture entirely.
|
|
11
|
-
* Defaults to `JSON.stringify`.
|
|
12
|
-
*/
|
|
13
7
|
dbStatementSerializer?: false | ((params: TransportRequestParams) => string);
|
|
14
|
-
/**
|
|
15
|
-
* Hook called after span attributes are set, before the request is made.
|
|
16
|
-
* Use to add custom attributes.
|
|
17
|
-
*/
|
|
18
8
|
requestHook?: (span: Span, params: TransportRequestParams) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Hook called after a successful response is received.
|
|
21
|
-
* Use to add custom attributes derived from the response.
|
|
22
|
-
*/
|
|
23
9
|
responseHook?: (span: Span, response: ApiResponse) => void;
|
|
24
|
-
/**
|
|
25
|
-
* When `true`, child span creation inside the Transport call is suppressed so
|
|
26
|
-
* HTTP instrumentation cannot produce a duplicate span.
|
|
27
|
-
* When `false` (default), the db span is set as the active context so HTTP
|
|
28
|
-
* child spans are properly parented and W3C trace headers are propagated.
|
|
29
|
-
*/
|
|
30
10
|
suppressInternalInstrumentation?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* If set, the value of the `@opensearch-project/opensearch` client version is
|
|
33
|
-
* recorded as a span attribute under this name.
|
|
34
|
-
* e.g. `'db.opensearch.client.version'`
|
|
35
|
-
*/
|
|
36
11
|
moduleVersionAttributeName?: string;
|
|
37
12
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
* Patches `Transport.prototype.request` to create a `db` CLIENT span for every
|
|
42
|
-
* request. Tracing is suppressed inside the call so the HTTP instrumentation
|
|
43
|
-
* does not produce a duplicate child span.
|
|
44
|
-
*/
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/index.d.ts
|
|
45
15
|
declare class OpenSearchInstrumentation extends InstrumentationBase {
|
|
46
16
|
private readonly osConfig;
|
|
47
17
|
private _original;
|
|
48
18
|
constructor(config?: OpenSearchInstrumentationConfig);
|
|
49
19
|
protected init(): void;
|
|
50
|
-
/** Patches `Transport.prototype.request` with span instrumentation. */
|
|
51
20
|
enable(): void;
|
|
52
|
-
/** Restores the original `Transport.prototype.request`. */
|
|
53
21
|
disable(): void;
|
|
54
22
|
}
|
|
55
23
|
//#endregion
|
|
56
|
-
export { OpenSearchInstrumentation, OpenSearchInstrumentationConfig };
|
|
24
|
+
export { OpenSearchInstrumentation, type OpenSearchInstrumentationConfig };
|
|
57
25
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;UAOiB,+BAAA,SAAwC,qBAAA;EACvD,qBAAA,aAAkC,MAAA,EAAQ,sBAAA;EAC1C,WAAA,IAAe,IAAA,EAAM,IAAA,EAAM,MAAA,EAAQ,sBAAA;EACnC,YAAA,IAAgB,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,WAAA;EACtC,+BAAA;EACA,0BAAA;AAAA;;;cCEW,yBAAA,SAAkC,mBAAA;EAAA,iBAC5B,QAAA;EAAA,QACT,SAAA;cAEI,MAAA,GAAQ,+BAAA;EAAA,UAYV,IAAA,CAAA;EAED,MAAA,CAAA;EAWA,OAAA,CAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,91 +1,130 @@
|
|
|
1
1
|
import Transport from "@opensearch-project/opensearch/lib/Transport.js";
|
|
2
2
|
import opensearchPkg from "@opensearch-project/opensearch/package.json" with { type: "json" };
|
|
3
|
+
import { InstrumentationBase } from "@opentelemetry/instrumentation";
|
|
3
4
|
import { SpanKind, SpanStatusCode, context, trace } from "@opentelemetry/api";
|
|
4
5
|
import { suppressTracing } from "@opentelemetry/core";
|
|
5
|
-
import { InstrumentationBase } from "@opentelemetry/instrumentation";
|
|
6
6
|
import { ATTR_DB_OPERATION_NAME, ATTR_DB_QUERY_TEXT, ATTR_DB_SYSTEM_NAME, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT } from "@opentelemetry/semantic-conventions";
|
|
7
|
+
//#region package.json
|
|
8
|
+
var version = "0.2.0";
|
|
7
9
|
//#endregion
|
|
8
|
-
//#region src/
|
|
9
|
-
const
|
|
10
|
-
const OPENSEARCH_CLIENT_VERSION = opensearchPkg.version;
|
|
11
|
-
/**
|
|
12
|
-
* Parses an OpenSearch path into its index and operation components.
|
|
13
|
-
* e.g. `/my_index/_search` → `{ index: 'my_index', operation: 'search' }`
|
|
14
|
-
* e.g. `/_bulk` → `{ operation: 'bulk' }`
|
|
15
|
-
*/
|
|
16
|
-
function parsePath(path) {
|
|
10
|
+
//#region src/parse-path.ts
|
|
11
|
+
const parsePath = (path) => {
|
|
17
12
|
const match = path.match(/^\/(?:([^/_][^/]*)\/)?_([^/]+)/);
|
|
18
13
|
if (!match) return {};
|
|
19
14
|
return {
|
|
20
15
|
index: match[1],
|
|
21
16
|
operation: match[2]
|
|
22
17
|
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/response-attributes.ts
|
|
21
|
+
const extractResponseAttributes = (res) => {
|
|
22
|
+
const attrs = {};
|
|
23
|
+
const { hostname, port } = res.meta.connection.url;
|
|
24
|
+
attrs[ATTR_SERVER_ADDRESS] = hostname;
|
|
25
|
+
if (port) attrs[ATTR_SERVER_PORT] = Number(port);
|
|
26
|
+
if (res.statusCode != null) attrs["http.response.status_code"] = res.statusCode;
|
|
27
|
+
const body = res.body;
|
|
28
|
+
if (body == null) return attrs;
|
|
29
|
+
if (body.took != null) attrs["db.opensearch.took"] = body.took;
|
|
30
|
+
if (body.timed_out != null) attrs["db.opensearch.timed_out"] = body.timed_out;
|
|
31
|
+
if (body.terminated_early != null) attrs["db.opensearch.terminated_early"] = body.terminated_early;
|
|
32
|
+
const shards = body._shards;
|
|
33
|
+
if (shards != null) {
|
|
34
|
+
attrs["db.opensearch.shards.total"] = shards.total;
|
|
35
|
+
attrs["db.opensearch.shards.successful"] = shards.successful;
|
|
36
|
+
attrs["db.opensearch.shards.failed"] = shards.failed;
|
|
37
|
+
if (shards.skipped != null) attrs["db.opensearch.shards.skipped"] = shards.skipped;
|
|
38
|
+
}
|
|
39
|
+
const phaseTook = body.phase_took;
|
|
40
|
+
if (phaseTook != null) {
|
|
41
|
+
attrs["db.opensearch.phase_took.can_match"] = phaseTook.can_match;
|
|
42
|
+
attrs["db.opensearch.phase_took.dfs_pre_query"] = phaseTook.dfs_pre_query;
|
|
43
|
+
attrs["db.opensearch.phase_took.dfs_query"] = phaseTook.dfs_query;
|
|
44
|
+
attrs["db.opensearch.phase_took.expand"] = phaseTook.expand;
|
|
45
|
+
attrs["db.opensearch.phase_took.fetch"] = phaseTook.fetch;
|
|
46
|
+
attrs["db.opensearch.phase_took.query"] = phaseTook.query;
|
|
47
|
+
}
|
|
48
|
+
const total = body.hits?.total;
|
|
49
|
+
if (total != null && typeof total === "object") attrs["db.opensearch.hits.total"] = total.value;
|
|
50
|
+
return attrs;
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/serialize-body.ts
|
|
54
|
+
const serializeBody = (params, config) => {
|
|
55
|
+
if (!params.body) return void 0;
|
|
56
|
+
if (config.dbStatementSerializer === false) return void 0;
|
|
57
|
+
if (typeof config.dbStatementSerializer === "function") return config.dbStatementSerializer(params);
|
|
58
|
+
return typeof params.body === "string" ? params.body : JSON.stringify(params.body);
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/patch-request.ts
|
|
62
|
+
const createPatchedRequest = (getTracer, config = {}, original, clientVersion) => {
|
|
63
|
+
function patchedRequest(params, options, callback) {
|
|
64
|
+
const { index, operation } = parsePath(params.path);
|
|
65
|
+
const queryText = serializeBody(params, config);
|
|
66
|
+
const span = getTracer().startSpan([operation, index].filter(Boolean).join(" ") || params.path, {
|
|
67
|
+
kind: SpanKind.CLIENT,
|
|
68
|
+
attributes: {
|
|
69
|
+
[ATTR_DB_SYSTEM_NAME]: "opensearch",
|
|
70
|
+
...operation && { [ATTR_DB_OPERATION_NAME]: operation },
|
|
71
|
+
...index && { "db.opensearch.index": index },
|
|
72
|
+
...queryText && { [ATTR_DB_QUERY_TEXT]: queryText }
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
config.requestHook?.(span, params);
|
|
76
|
+
const onSuccess = (res) => {
|
|
77
|
+
for (const [key, value] of Object.entries(extractResponseAttributes(res))) span.setAttribute(key, value);
|
|
78
|
+
if (config.moduleVersionAttributeName) span.setAttribute(config.moduleVersionAttributeName, clientVersion);
|
|
79
|
+
config.responseHook?.(span, res);
|
|
80
|
+
span.end();
|
|
81
|
+
};
|
|
82
|
+
const onError = (err) => {
|
|
83
|
+
if (err instanceof Error) span.recordException(err);
|
|
84
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
85
|
+
span.end();
|
|
86
|
+
};
|
|
87
|
+
const callCtx = config.suppressInternalInstrumentation ? suppressTracing(context.active()) : trace.setSpan(context.active(), span);
|
|
88
|
+
if (typeof callback === "function") {
|
|
89
|
+
const originalWithCallback = original.bind(this);
|
|
90
|
+
return context.with(callCtx, () => originalWithCallback(params, options, (err, res) => {
|
|
91
|
+
err ? onError(err) : onSuccess(res);
|
|
92
|
+
callback(err, res);
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
const result = context.with(callCtx, () => original.call(this, params, options));
|
|
96
|
+
const settled = result.then((res) => {
|
|
97
|
+
onSuccess(res);
|
|
98
|
+
return res;
|
|
99
|
+
}, (err) => {
|
|
100
|
+
onError(err);
|
|
101
|
+
throw err;
|
|
102
|
+
});
|
|
103
|
+
return Object.assign(settled, { abort: result.abort });
|
|
104
|
+
}
|
|
105
|
+
return patchedRequest;
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/index.ts
|
|
109
|
+
const PACKAGE_VERSION = version;
|
|
110
|
+
const OPENSEARCH_CLIENT_VERSION = opensearchPkg.version;
|
|
31
111
|
var OpenSearchInstrumentation = class extends InstrumentationBase {
|
|
32
112
|
osConfig;
|
|
113
|
+
_original;
|
|
33
114
|
constructor(config = {}) {
|
|
34
|
-
super("@sebspark/opentelemetry-instrumentation-opensearch", PACKAGE_VERSION,
|
|
115
|
+
super("@sebspark/opentelemetry-instrumentation-opensearch", PACKAGE_VERSION, {
|
|
116
|
+
...config,
|
|
117
|
+
enabled: false
|
|
118
|
+
});
|
|
35
119
|
this.osConfig = config;
|
|
120
|
+
if (config.enabled !== false) this.enable();
|
|
36
121
|
}
|
|
37
122
|
init() {}
|
|
38
|
-
/** Patches `Transport.prototype.request` with span instrumentation. */
|
|
39
123
|
enable() {
|
|
40
124
|
if (this._original) return;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this._original = original;
|
|
44
|
-
function patchedRequest(params, options, callback) {
|
|
45
|
-
const { index, operation } = parsePath(params.path);
|
|
46
|
-
const spanName = [operation, index].filter(Boolean).join(" ") || params.path;
|
|
47
|
-
const span = self.tracer.startSpan(spanName, {
|
|
48
|
-
kind: SpanKind.CLIENT,
|
|
49
|
-
attributes: {
|
|
50
|
-
[ATTR_DB_SYSTEM_NAME]: "opensearch",
|
|
51
|
-
...operation && { [ATTR_DB_OPERATION_NAME]: operation },
|
|
52
|
-
...index && { "db.opensearch.index": index },
|
|
53
|
-
...params.body && self.osConfig?.dbStatementSerializer !== false && { [ATTR_DB_QUERY_TEXT]: typeof self.osConfig?.dbStatementSerializer === "function" ? self.osConfig.dbStatementSerializer(params) : typeof params.body === "string" ? params.body : JSON.stringify(params.body) }
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
self.osConfig?.requestHook?.(span, params);
|
|
57
|
-
const endSpanOnSuccess = (res) => {
|
|
58
|
-
const { hostname, port } = res.meta.connection.url;
|
|
59
|
-
span.setAttribute(ATTR_SERVER_ADDRESS, hostname);
|
|
60
|
-
if (port) span.setAttribute(ATTR_SERVER_PORT, Number(port));
|
|
61
|
-
if (self.osConfig?.moduleVersionAttributeName) span.setAttribute(self.osConfig.moduleVersionAttributeName, OPENSEARCH_CLIENT_VERSION);
|
|
62
|
-
self.osConfig?.responseHook?.(span, res);
|
|
63
|
-
span.end();
|
|
64
|
-
};
|
|
65
|
-
const endSpanOnError = (err) => {
|
|
66
|
-
if (err instanceof Error) span.recordException(err);
|
|
67
|
-
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
68
|
-
span.end();
|
|
69
|
-
};
|
|
70
|
-
const callCtx = self.osConfig?.suppressInternalInstrumentation ? suppressTracing(context.active()) : trace.setSpan(context.active(), span);
|
|
71
|
-
if (typeof callback === "function") return context.with(callCtx, () => original.call(this, params, options, (err, res) => {
|
|
72
|
-
if (err) endSpanOnError(err);
|
|
73
|
-
else endSpanOnSuccess(res);
|
|
74
|
-
callback(err, res);
|
|
75
|
-
}));
|
|
76
|
-
const result = context.with(callCtx, () => original.call(this, params, options));
|
|
77
|
-
const settled = result.then((res) => {
|
|
78
|
-
endSpanOnSuccess(res);
|
|
79
|
-
return res;
|
|
80
|
-
}, (err) => {
|
|
81
|
-
endSpanOnError(err);
|
|
82
|
-
throw err;
|
|
83
|
-
});
|
|
84
|
-
return Object.assign(settled, { abort: result.abort });
|
|
85
|
-
}
|
|
86
|
-
Transport.prototype.request = patchedRequest;
|
|
125
|
+
this._original = Transport.prototype.request;
|
|
126
|
+
Transport.prototype.request = createPatchedRequest(() => this.tracer, this.osConfig, this._original, OPENSEARCH_CLIENT_VERSION);
|
|
87
127
|
}
|
|
88
|
-
/** Restores the original `Transport.prototype.request`. */
|
|
89
128
|
disable() {
|
|
90
129
|
if (this._original) {
|
|
91
130
|
Transport.prototype.request = this._original;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["pkg.version"],"sources":["../package.json","../src/index.ts"],"sourcesContent":["","import Transport, {\n type ApiError,\n type ApiResponse,\n type TransportRequestCallback,\n type TransportRequestOptions,\n type TransportRequestParams,\n type TransportRequestPromise,\n} from '@opensearch-project/opensearch/lib/Transport.js'\nimport opensearchPkg from '@opensearch-project/opensearch/package.json' with {\n type: 'json',\n}\nimport {\n context,\n type Span,\n SpanKind,\n SpanStatusCode,\n trace,\n} from '@opentelemetry/api'\nimport { suppressTracing } from '@opentelemetry/core'\nimport {\n InstrumentationBase,\n type InstrumentationConfig,\n} from '@opentelemetry/instrumentation'\nimport {\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_SYSTEM_NAME,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions'\nimport pkg from '../package.json' with { type: 'json' }\n\nconst PACKAGE_VERSION: string = pkg.version\nconst OPENSEARCH_CLIENT_VERSION: string = opensearchPkg.version\n\n/**\n * Parses an OpenSearch path into its index and operation components.\n * e.g. `/my_index/_search` → `{ index: 'my_index', operation: 'search' }`\n * e.g. `/_bulk` → `{ operation: 'bulk' }`\n */\nfunction parsePath(path: string): { index?: string; operation?: string } {\n const match = path.match(/^\\/(?:([^/_][^/]*)\\/)?_([^/]+)/)\n if (!match) return {}\n return { index: match[1], operation: match[2] }\n}\n\n/** Configuration for {@link OpenSearchInstrumentation}. */\nexport interface OpenSearchInstrumentationConfig extends InstrumentationConfig {\n /**\n * Serialize the request body into `db.query.text`.\n * Set to `false` to disable capture entirely.\n * Defaults to `JSON.stringify`.\n */\n dbStatementSerializer?: false | ((params: TransportRequestParams) => string)\n\n /**\n * Hook called after span attributes are set, before the request is made.\n * Use to add custom attributes.\n */\n requestHook?: (span: Span, params: TransportRequestParams) => void\n\n /**\n * Hook called after a successful response is received.\n * Use to add custom attributes derived from the response.\n */\n responseHook?: (span: Span, response: ApiResponse) => void\n\n /**\n * When `true`, child span creation inside the Transport call is suppressed so\n * HTTP instrumentation cannot produce a duplicate span.\n * When `false` (default), the db span is set as the active context so HTTP\n * child spans are properly parented and W3C trace headers are propagated.\n */\n suppressInternalInstrumentation?: boolean\n\n /**\n * If set, the value of the `@opensearch-project/opensearch` client version is\n * recorded as a span attribute under this name.\n * e.g. `'db.opensearch.client.version'`\n */\n moduleVersionAttributeName?: string\n}\n\n/**\n * OpenTelemetry instrumentation for `@opensearch-project/opensearch`.\n *\n * Patches `Transport.prototype.request` to create a `db` CLIENT span for every\n * request. Tracing is suppressed inside the call so the HTTP instrumentation\n * does not produce a duplicate child span.\n */\nexport class OpenSearchInstrumentation extends InstrumentationBase {\n private readonly osConfig: OpenSearchInstrumentationConfig\n private declare _original: typeof Transport.prototype.request | undefined\n\n constructor(config: OpenSearchInstrumentationConfig = {}) {\n super(\n '@sebspark/opentelemetry-instrumentation-opensearch',\n PACKAGE_VERSION,\n config\n )\n this.osConfig = config\n }\n\n protected init() {}\n\n /** Patches `Transport.prototype.request` with span instrumentation. */\n override enable() {\n if (this._original) return\n const self = this\n const original: (\n this: Transport,\n params: TransportRequestParams,\n options?: TransportRequestOptions\n ) => TransportRequestPromise<ApiResponse> = Transport.prototype.request\n this._original = original\n\n function patchedRequest(\n params: TransportRequestParams,\n options?: TransportRequestOptions\n ): TransportRequestPromise<ApiResponse>\n function patchedRequest(\n params: TransportRequestParams,\n options: TransportRequestOptions | undefined,\n callback: (err: ApiError, result: ApiResponse) => void\n ): TransportRequestCallback\n function patchedRequest(\n this: Transport,\n params: TransportRequestParams,\n options?: TransportRequestOptions,\n callback?: (err: ApiError, result: ApiResponse) => void\n ): TransportRequestPromise<ApiResponse> | TransportRequestCallback {\n const { index, operation } = parsePath(params.path)\n const spanName =\n [operation, index].filter(Boolean).join(' ') || params.path\n const span = self.tracer.startSpan(spanName, {\n kind: SpanKind.CLIENT,\n attributes: {\n [ATTR_DB_SYSTEM_NAME]: 'opensearch',\n ...(operation && { [ATTR_DB_OPERATION_NAME]: operation }),\n ...(index && { 'db.opensearch.index': index }),\n ...(params.body &&\n self.osConfig?.dbStatementSerializer !== false && {\n [ATTR_DB_QUERY_TEXT]:\n typeof self.osConfig?.dbStatementSerializer === 'function'\n ? self.osConfig.dbStatementSerializer(params)\n : typeof params.body === 'string'\n ? params.body\n : JSON.stringify(params.body),\n }),\n },\n })\n self.osConfig?.requestHook?.(span, params)\n\n const endSpanOnSuccess = (res: ApiResponse) => {\n const { hostname, port } = res.meta.connection.url\n span.setAttribute(ATTR_SERVER_ADDRESS, hostname)\n if (port) span.setAttribute(ATTR_SERVER_PORT, Number(port))\n if (self.osConfig?.moduleVersionAttributeName) {\n span.setAttribute(\n self.osConfig.moduleVersionAttributeName,\n OPENSEARCH_CLIENT_VERSION\n )\n }\n self.osConfig?.responseHook?.(span, res)\n span.end()\n }\n const endSpanOnError = (err: unknown) => {\n if (err instanceof Error) span.recordException(err)\n span.setStatus({ code: SpanStatusCode.ERROR })\n span.end()\n }\n\n const callCtx = self.osConfig?.suppressInternalInstrumentation\n ? suppressTracing(context.active())\n : trace.setSpan(context.active(), span)\n\n if (typeof callback === 'function') {\n return context.with(callCtx, () =>\n (\n original as (\n this: Transport,\n params: TransportRequestParams,\n options: TransportRequestOptions | undefined,\n callback: (err: ApiError, result: ApiResponse) => void\n ) => TransportRequestCallback\n ).call(this, params, options, (err, res) => {\n if (err) endSpanOnError(err)\n else endSpanOnSuccess(res)\n callback(err, res)\n })\n )\n }\n\n const result = context.with(callCtx, () =>\n original.call(this, params, options)\n )\n const settled = result.then(\n (res: ApiResponse) => {\n endSpanOnSuccess(res)\n return res\n },\n (err: unknown) => {\n endSpanOnError(err)\n throw err\n }\n )\n return Object.assign(settled, { abort: result.abort })\n }\n\n Transport.prototype.request = patchedRequest\n }\n\n /** Restores the original `Transport.prototype.request`. */\n override disable() {\n if (this._original) {\n Transport.prototype.request = this._original\n this._original = undefined\n }\n }\n}\n"],"mappings":";;;;;;;;ACgCA,MAAM;AACN,MAAM,4BAAoC,cAAc;;;;;;AAOxD,SAAS,UAAU,MAAsD;CACvE,MAAM,QAAQ,KAAK,MAAM,iCAAiC;AAC1D,KAAI,CAAC,MAAO,QAAO,EAAE;AACrB,QAAO;EAAE,OAAO,MAAM;EAAI,WAAW,MAAM;EAAI;;;;;;;;;AA+CjD,IAAa,4BAAb,cAA+C,oBAAoB;CACjE;CAGA,YAAY,SAA0C,EAAE,EAAE;AACxD,QACE,sDACA,iBACA,OACD;AACD,OAAK,WAAW;;CAGlB,OAAiB;;CAGjB,SAAkB;AAChB,MAAI,KAAK,UAAW;EACpB,MAAM,OAAO;EACb,MAAM,WAIsC,UAAU,UAAU;AAChE,OAAK,YAAY;EAWjB,SAAS,eAEP,QACA,SACA,UACiE;GACjE,MAAM,EAAE,OAAO,cAAc,UAAU,OAAO,KAAK;GACnD,MAAM,WACJ,CAAC,WAAW,MAAM,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,IAAI,OAAO;GACzD,MAAM,OAAO,KAAK,OAAO,UAAU,UAAU;IAC3C,MAAM,SAAS;IACf,YAAY;MACT,sBAAsB;KACvB,GAAI,aAAa,GAAG,yBAAyB,WAAW;KACxD,GAAI,SAAS,EAAE,uBAAuB,OAAO;KAC7C,GAAI,OAAO,QACT,KAAK,UAAU,0BAA0B,SAAS,GAC/C,qBACC,O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AK,WAAW;AAClB,aAAU,UAAU,UAAU,KAAK;AACnC,QAAK,YAAY,KAAA"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["pkg.version"],"sources":["../package.json","../src/parse-path.ts","../src/response-attributes.ts","../src/serialize-body.ts","../src/patch-request.ts","../src/index.ts"],"sourcesContent":["","export const parsePath = (\n path: string\n): { index?: string; operation?: string } => {\n const match = path.match(/^\\/(?:([^/_][^/]*)\\/)?_([^/]+)/)\n if (!match) return {}\n return { index: match[1], operation: match[2] }\n}\n","import type { Types } from '@opensearch-project/opensearch'\nimport type { ApiResponse } from '@opensearch-project/opensearch/lib/Transport.js'\nimport {\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions'\n\nexport const extractResponseAttributes = (\n res: ApiResponse\n): Record<string, string | number | boolean> => {\n const attrs: Record<string, string | number | boolean> = {}\n\n const { hostname, port } = res.meta.connection.url\n attrs[ATTR_SERVER_ADDRESS] = hostname\n if (port) attrs[ATTR_SERVER_PORT] = Number(port)\n if (res.statusCode != null)\n attrs['http.response.status_code'] = res.statusCode\n\n const body = res.body as Types.Core_Search.ResponseBody | null | undefined\n if (body == null) return attrs\n\n if (body.took != null) attrs['db.opensearch.took'] = body.took\n if (body.timed_out != null) attrs['db.opensearch.timed_out'] = body.timed_out\n if (body.terminated_early != null)\n attrs['db.opensearch.terminated_early'] = body.terminated_early\n\n const shards = body._shards\n if (shards != null) {\n attrs['db.opensearch.shards.total'] = shards.total\n attrs['db.opensearch.shards.successful'] = shards.successful\n attrs['db.opensearch.shards.failed'] = shards.failed\n if (shards.skipped != null)\n attrs['db.opensearch.shards.skipped'] = shards.skipped\n }\n\n const phaseTook = body.phase_took\n if (phaseTook != null) {\n attrs['db.opensearch.phase_took.can_match'] = phaseTook.can_match\n attrs['db.opensearch.phase_took.dfs_pre_query'] = phaseTook.dfs_pre_query\n attrs['db.opensearch.phase_took.dfs_query'] = phaseTook.dfs_query\n attrs['db.opensearch.phase_took.expand'] = phaseTook.expand\n attrs['db.opensearch.phase_took.fetch'] = phaseTook.fetch\n attrs['db.opensearch.phase_took.query'] = phaseTook.query\n }\n\n const total = body.hits?.total\n if (total != null && typeof total === 'object') {\n attrs['db.opensearch.hits.total'] = total.value\n }\n\n return attrs\n}\n","import type { TransportRequestParams } from '@opensearch-project/opensearch/lib/Transport.js'\nimport type { OpenSearchInstrumentationConfig } from './types'\n\nexport const serializeBody = (\n params: TransportRequestParams,\n config: Pick<OpenSearchInstrumentationConfig, 'dbStatementSerializer'>\n): string | undefined => {\n if (!params.body) return undefined\n if (config.dbStatementSerializer === false) return undefined\n if (typeof config.dbStatementSerializer === 'function') {\n return config.dbStatementSerializer(params)\n }\n return typeof params.body === 'string'\n ? params.body\n : JSON.stringify(params.body)\n}\n","import type Transport from '@opensearch-project/opensearch/lib/Transport.js'\nimport type {\n ApiError,\n ApiResponse,\n TransportRequestCallback,\n TransportRequestOptions,\n TransportRequestParams,\n TransportRequestPromise,\n} from '@opensearch-project/opensearch/lib/Transport.js'\nimport {\n context,\n SpanKind,\n SpanStatusCode,\n type Tracer,\n trace,\n} from '@opentelemetry/api'\nimport { suppressTracing } from '@opentelemetry/core'\nimport {\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_SYSTEM_NAME,\n} from '@opentelemetry/semantic-conventions'\nimport { parsePath } from './parse-path'\nimport { extractResponseAttributes } from './response-attributes'\nimport { serializeBody } from './serialize-body'\nimport type { OpenSearchInstrumentationConfig } from './types'\n\nexport type OriginalRequest = (\n this: Transport,\n params: TransportRequestParams,\n options?: TransportRequestOptions\n) => TransportRequestPromise<ApiResponse>\n\ntype OriginalRequestWithCallback = (\n this: Transport,\n params: TransportRequestParams,\n options: TransportRequestOptions | undefined,\n callback: (err: ApiError, result: ApiResponse) => void\n) => TransportRequestCallback\n\nexport const createPatchedRequest = (\n getTracer: () => Tracer,\n config: OpenSearchInstrumentationConfig = {},\n original: OriginalRequest,\n clientVersion: string\n) => {\n function patchedRequest(\n params: TransportRequestParams,\n options?: TransportRequestOptions\n ): TransportRequestPromise<ApiResponse>\n function patchedRequest(\n params: TransportRequestParams,\n options: TransportRequestOptions | undefined,\n callback: (err: ApiError, result: ApiResponse) => void\n ): TransportRequestCallback\n function patchedRequest(\n this: Transport,\n params: TransportRequestParams,\n options?: TransportRequestOptions,\n callback?: (err: ApiError, result: ApiResponse) => void\n ): TransportRequestPromise<ApiResponse> | TransportRequestCallback {\n const { index, operation } = parsePath(params.path)\n const queryText = serializeBody(params, config)\n\n const span = getTracer().startSpan(\n [operation, index].filter(Boolean).join(' ') || params.path,\n {\n kind: SpanKind.CLIENT,\n attributes: {\n [ATTR_DB_SYSTEM_NAME]: 'opensearch',\n ...(operation && { [ATTR_DB_OPERATION_NAME]: operation }),\n ...(index && { 'db.opensearch.index': index }),\n ...(queryText && { [ATTR_DB_QUERY_TEXT]: queryText }),\n },\n }\n )\n config.requestHook?.(span, params)\n\n const onSuccess = (res: ApiResponse) => {\n for (const [key, value] of Object.entries(\n extractResponseAttributes(res)\n )) {\n span.setAttribute(key, value)\n }\n if (config.moduleVersionAttributeName) {\n span.setAttribute(config.moduleVersionAttributeName, clientVersion)\n }\n config.responseHook?.(span, res)\n span.end()\n }\n\n const onError = (err: unknown) => {\n if (err instanceof Error) span.recordException(err)\n span.setStatus({ code: SpanStatusCode.ERROR })\n span.end()\n }\n\n const callCtx = config.suppressInternalInstrumentation\n ? suppressTracing(context.active())\n : trace.setSpan(context.active(), span)\n\n if (typeof callback === 'function') {\n const originalWithCallback = (\n original as OriginalRequestWithCallback\n ).bind(this)\n return context.with(callCtx, () =>\n originalWithCallback(params, options, (err, res) => {\n err ? onError(err) : onSuccess(res)\n callback(err, res)\n })\n )\n }\n\n const result = context.with(callCtx, () =>\n original.call(this, params, options)\n )\n const settled = result.then(\n (res: ApiResponse) => {\n onSuccess(res)\n return res\n },\n (err: unknown) => {\n onError(err)\n throw err\n }\n )\n return Object.assign(settled, { abort: result.abort })\n }\n\n return patchedRequest\n}\n","import Transport from '@opensearch-project/opensearch/lib/Transport.js'\nimport opensearchPkg from '@opensearch-project/opensearch/package.json' with {\n type: 'json',\n}\nimport { InstrumentationBase } from '@opentelemetry/instrumentation'\nimport pkg from '../package.json' with { type: 'json' }\nimport { createPatchedRequest, type OriginalRequest } from './patch-request'\nimport type { OpenSearchInstrumentationConfig } from './types'\n\nexport type { OpenSearchInstrumentationConfig } from './types'\n\nconst PACKAGE_VERSION: string = pkg.version\nconst OPENSEARCH_CLIENT_VERSION: string = opensearchPkg.version\n\nexport class OpenSearchInstrumentation extends InstrumentationBase {\n private readonly osConfig: OpenSearchInstrumentationConfig\n private _original: OriginalRequest | undefined\n\n constructor(config: OpenSearchInstrumentationConfig = {}) {\n super(\n '@sebspark/opentelemetry-instrumentation-opensearch',\n PACKAGE_VERSION,\n { ...config, enabled: false }\n )\n this.osConfig = config\n if (config.enabled !== false) {\n this.enable()\n }\n }\n\n protected init() {}\n\n override enable() {\n if (this._original) return\n this._original = Transport.prototype.request as OriginalRequest\n Transport.prototype.request = createPatchedRequest(\n () => this.tracer,\n this.osConfig,\n this._original,\n OPENSEARCH_CLIENT_VERSION\n )\n }\n\n override disable() {\n if (this._original) {\n Transport.prototype.request = this._original\n this._original = undefined\n }\n }\n}\n"],"mappings":";;;;;;;;;;ACAA,MAAa,aACX,SAC2C;CAC3C,MAAM,QAAQ,KAAK,MAAM,iCAAiC;AAC1D,KAAI,CAAC,MAAO,QAAO,EAAE;AACrB,QAAO;EAAE,OAAO,MAAM;EAAI,WAAW,MAAM;EAAI;;;;ACEjD,MAAa,6BACX,QAC8C;CAC9C,MAAM,QAAmD,EAAE;CAE3D,MAAM,EAAE,UAAU,SAAS,IAAI,KAAK,WAAW;AAC/C,OAAM,uBAAuB;AAC7B,KAAI,KAAM,OAAM,oBAAoB,OAAO,KAAK;AAChD,KAAI,IAAI,cAAc,KACpB,OAAM,+BAA+B,IAAI;CAE3C,MAAM,OAAO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,IAAa,4BAAb,cAA+C,oBAAoB;CACjE;CACA;CAEA,YAAY,SAA0C,EAAE,EAAE;AACxD,QACE,sDACA,iBACA;GAAE,GAAG;GAAQ,SAAS;GAAO,CAC9B;AACD,OAAK,WAAW;AAChB,MAAI,OAAO,YAAY,MACrB,MAAK,QAAQ;;CAIjB,OAAiB;CAEjB,SAAkB;AAChB,MAAI,KAAK,UAAW;AACpB,OAAK,YAAY,UAAU,UAAU;AACrC,YAAU,UAAU,UAAU,2BACtB,KAAK,QACX,KAAK,UACL,KAAK,WACL,0BACD;;CAGH,UAAmB;AACjB,MAAI,KAAK,WAAW;AAClB,aAAU,UAAU,UAAU,KAAK;AACnC,QAAK,YAAY,KAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebspark/opentelemetry-instrumentation-opensearch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@opensearch-project/opensearch": "3.5.1",
|
|
36
36
|
"@opentelemetry/api": "1.9.0",
|
|
37
|
+
"@opentelemetry/instrumentation-http": "0.213.0",
|
|
38
|
+
"@opentelemetry/instrumentation-undici": "0.23.0",
|
|
37
39
|
"@opentelemetry/sdk-trace-base": "2.6.0",
|
|
38
40
|
"@opentelemetry/sdk-trace-node": "2.6.0",
|
|
39
41
|
"@testcontainers/opensearch": "11.13.0"
|