@openplait/adapter-jaeger 0.1.0-alpha.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/LICENSE +201 -0
- package/README.md +38 -0
- package/dist/src/adapter.d.ts +34 -0
- package/dist/src/adapter.d.ts.map +1 -0
- package/dist/src/adapter.js +306 -0
- package/dist/src/adapter.js.map +1 -0
- package/dist/src/compiler.d.ts +8 -0
- package/dist/src/compiler.d.ts.map +1 -0
- package/dist/src/compiler.js +115 -0
- package/dist/src/compiler.js.map +1 -0
- package/dist/src/datasets.d.ts +8 -0
- package/dist/src/datasets.d.ts.map +1 -0
- package/dist/src/datasets.js +25 -0
- package/dist/src/datasets.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/normalization.d.ts +8 -0
- package/dist/src/normalization.d.ts.map +1 -0
- package/dist/src/normalization.js +97 -0
- package/dist/src/normalization.js.map +1 -0
- package/dist/src/types.d.ts +95 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @openplait/adapter-jaeger
|
|
2
|
+
|
|
3
|
+
Portable Jaeger Query HTTP adapter for OpenPlait semantic and native trace reads.
|
|
4
|
+
|
|
5
|
+
## Capabilities
|
|
6
|
+
|
|
7
|
+
- `GET /api/services` — service discovery / health
|
|
8
|
+
- `GET /api/traces?service=&start=&end=&limit=` — bounded search (timestamps in µs)
|
|
9
|
+
- `GET /api/traces/{id}` — full trace with span logs → events
|
|
10
|
+
- Automatic `/jaeger` path fallback when the base URL is a reverse-proxy root
|
|
11
|
+
|
|
12
|
+
Jaeger cannot push down OR-of-AND AI selectors or server aggregation. Hosts
|
|
13
|
+
(OpenLIT) sample + filter in-process.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @openplait/adapter-jaeger
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick use
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { JaegerAdapter } from "@openplait/adapter-jaeger";
|
|
25
|
+
|
|
26
|
+
const adapter = new JaegerAdapter({ url: "http://localhost:16686" });
|
|
27
|
+
const services = await adapter.listServices();
|
|
28
|
+
const traces = await adapter.searchTraces({
|
|
29
|
+
service: services[0],
|
|
30
|
+
startMs: Date.now() - 3_600_000,
|
|
31
|
+
endMs: Date.now(),
|
|
32
|
+
limit: 20,
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Local stack
|
|
37
|
+
|
|
38
|
+
See `test/integration/docker-compose.yml` for Jaeger all-in-one with OTLP.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { NativeQuery, QueryResult, SemanticQuery, SemanticSchema } from "@openplait/core";
|
|
2
|
+
import { type AdapterManifest, type AdapterValidationResult, type CompileContext, type CompiledQuery, type DatasourceAdapter, type DatasourceCapabilities, type DiscoveryContext, type ExecutionContext, type QueryExplanation } from "@openplait/adapter-sdk";
|
|
3
|
+
import type { JaegerAdapterConfig, JaegerAdapterOptions, JaegerCompiledRequest, JaegerNormalizedSpan, JaegerSearchParams, JaegerTrace } from "./types.js";
|
|
4
|
+
export declare const JAEGER_ADAPTER_MANIFEST: AdapterManifest;
|
|
5
|
+
export declare const JAEGER_CAPABILITIES: DatasourceCapabilities;
|
|
6
|
+
export declare function validateJaegerConfig(config: JaegerAdapterConfig): AdapterValidationResult<JaegerAdapterConfig>;
|
|
7
|
+
export declare class JaegerAdapter implements DatasourceAdapter {
|
|
8
|
+
private readonly config;
|
|
9
|
+
readonly manifest: AdapterManifest;
|
|
10
|
+
private apiBaseUrl;
|
|
11
|
+
private readonly fetchImpl;
|
|
12
|
+
private readonly now;
|
|
13
|
+
constructor(config: JaegerAdapterConfig, options?: JaegerAdapterOptions);
|
|
14
|
+
/** Effective Query API base after `/jaeger` path fallback (if any). */
|
|
15
|
+
get resolvedUrl(): string;
|
|
16
|
+
validateConfig(config: JaegerAdapterConfig): AdapterValidationResult<JaegerAdapterConfig>;
|
|
17
|
+
getCapabilities(_config: JaegerAdapterConfig): Promise<DatasourceCapabilities>;
|
|
18
|
+
discoverSchema(_context?: DiscoveryContext): Promise<SemanticSchema>;
|
|
19
|
+
compile(query: SemanticQuery | NativeQuery, context?: CompileContext): Promise<CompiledQuery<JaegerCompiledRequest>>;
|
|
20
|
+
execute(query: CompiledQuery<JaegerCompiledRequest> | NativeQuery, context: ExecutionContext): Promise<QueryResult>;
|
|
21
|
+
explain(query: SemanticQuery | NativeQuery, context?: CompileContext): Promise<QueryExplanation<JaegerCompiledRequest>>;
|
|
22
|
+
/** Discover services (or return configured list). Retries under `/jaeger` when needed. */
|
|
23
|
+
listServices(): Promise<string[]>;
|
|
24
|
+
/** GET /api/services/{service}/operations — Jaeger Search operation dropdown. */
|
|
25
|
+
listOperations(service: string): Promise<string[]>;
|
|
26
|
+
searchTraces(params: JaegerSearchParams, context?: ExecutionContext): Promise<JaegerTrace[]>;
|
|
27
|
+
getTrace(traceId: string, context?: ExecutionContext): Promise<JaegerTrace | null>;
|
|
28
|
+
/** Convenience: normalize a list of Jaeger traces into OpenLIT-style spans. */
|
|
29
|
+
normalizeSpans(traces: JaegerTrace[]): JaegerNormalizedSpan[];
|
|
30
|
+
getTraceResult(traceId: string, context?: ExecutionContext): Promise<QueryResult | null>;
|
|
31
|
+
private authHeaders;
|
|
32
|
+
private requestJson;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIL,KAAK,eAAe,EAEpB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAShC,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAElB,WAAW,EAEZ,MAAM,YAAY,CAAC;AAQpB,eAAO,MAAM,uBAAuB,EAAE,eAMrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,sBAOjC,CAAC;AAUF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,mBAAmB,GAC1B,uBAAuB,CAAC,mBAAmB,CAAC,CAgE9C;AAED,qBAAa,aAAc,YAAW,iBAAiB;IAOnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB,QAAQ,CAAC,QAAQ,kBAA2B;IAC5C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAGhB,MAAM,EAAE,mBAAmB,EAC5C,OAAO,GAAE,oBAAyB;IAapC,uEAAuE;IACvE,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,cAAc,CAAC,MAAM,E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/adapter-sdk";
|
|
2
|
+
import { compileJaegerQuery } from "./compiler.js";
|
|
3
|
+
import { JAEGER_DATASET_NAME, jaegerSemanticSchema } from "./datasets.js";
|
|
4
|
+
import { flattenJaegerTraces, normalizeJaegerSearchResponse, normalizeJaegerTraceResponse, } from "./normalization.js";
|
|
5
|
+
const ADAPTER_VERSION = "0.1.0-alpha.0";
|
|
6
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
7
|
+
const DEFAULT_MAX_RESULT_ROWS = 1_000;
|
|
8
|
+
const SAFE_HEADER = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
9
|
+
const SAFE_REQUEST_ID = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
10
|
+
export const JAEGER_ADAPTER_MANIFEST = {
|
|
11
|
+
name: "jaeger",
|
|
12
|
+
displayName: "Jaeger",
|
|
13
|
+
version: ADAPTER_VERSION,
|
|
14
|
+
queryLanguages: ["openplait-semantic"],
|
|
15
|
+
signals: ["traces"],
|
|
16
|
+
};
|
|
17
|
+
export const JAEGER_CAPABILITIES = {
|
|
18
|
+
signals: ["traces"],
|
|
19
|
+
operations: ["select", "filter", "order", "limit"],
|
|
20
|
+
joins: { local: false, crossDatasource: false },
|
|
21
|
+
nativeQueryLanguages: [],
|
|
22
|
+
explain: true,
|
|
23
|
+
schemaDiscovery: true,
|
|
24
|
+
};
|
|
25
|
+
function positiveIntegerIssue(value, path) {
|
|
26
|
+
if (value === undefined || (Number.isInteger(value) && value > 0))
|
|
27
|
+
return undefined;
|
|
28
|
+
return { code: "CONFIG_INVALID", path, message: "Value must be a positive integer." };
|
|
29
|
+
}
|
|
30
|
+
export function validateJaegerConfig(config) {
|
|
31
|
+
const errors = [];
|
|
32
|
+
try {
|
|
33
|
+
const url = new URL(config.url);
|
|
34
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
35
|
+
errors.push({
|
|
36
|
+
code: "CONFIG_INVALID",
|
|
37
|
+
path: "/url",
|
|
38
|
+
message: "Jaeger URL must use http or https.",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (url.search || url.hash) {
|
|
42
|
+
errors.push({
|
|
43
|
+
code: "CONFIG_INVALID",
|
|
44
|
+
path: "/url",
|
|
45
|
+
message: "Jaeger URL cannot contain a query string or fragment.",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
errors.push({ code: "CONFIG_INVALID", path: "/url", message: "Jaeger URL is invalid." });
|
|
51
|
+
}
|
|
52
|
+
const hasUser = !!config.username?.trim();
|
|
53
|
+
const hasPass = !!config.password;
|
|
54
|
+
const hasBearer = !!config.bearerToken?.trim();
|
|
55
|
+
if ((hasUser || hasPass) && hasBearer) {
|
|
56
|
+
errors.push({
|
|
57
|
+
code: "CONFIG_INVALID",
|
|
58
|
+
path: "/bearerToken",
|
|
59
|
+
message: "Use either basic auth or bearer token, not both.",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (hasUser !== hasPass) {
|
|
63
|
+
errors.push({
|
|
64
|
+
code: "CONFIG_INVALID",
|
|
65
|
+
path: hasUser ? "/password" : "/username",
|
|
66
|
+
message: "Basic auth requires both username and password.",
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
for (const issue of [
|
|
70
|
+
positiveIntegerIssue(config.requestTimeoutMs, "/requestTimeoutMs"),
|
|
71
|
+
positiveIntegerIssue(config.maxResultRows, "/maxResultRows"),
|
|
72
|
+
positiveIntegerIssue(config.maxTimeRangeMs, "/maxTimeRangeMs"),
|
|
73
|
+
positiveIntegerIssue(config.perServiceLimit, "/perServiceLimit"),
|
|
74
|
+
]) {
|
|
75
|
+
if (issue)
|
|
76
|
+
errors.push(issue);
|
|
77
|
+
}
|
|
78
|
+
if (config.httpHeaders) {
|
|
79
|
+
for (const [key, value] of Object.entries(config.httpHeaders)) {
|
|
80
|
+
if (!SAFE_HEADER.test(key) || typeof value !== "string") {
|
|
81
|
+
errors.push({
|
|
82
|
+
code: "CONFIG_INVALID",
|
|
83
|
+
path: `/httpHeaders/${key}`,
|
|
84
|
+
message: "Header names must be valid HTTP tokens with string values.",
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return errors.length
|
|
90
|
+
? { valid: false, errors }
|
|
91
|
+
: { valid: true, value: config, errors: [] };
|
|
92
|
+
}
|
|
93
|
+
export class JaegerAdapter {
|
|
94
|
+
config;
|
|
95
|
+
manifest = JAEGER_ADAPTER_MANIFEST;
|
|
96
|
+
apiBaseUrl;
|
|
97
|
+
fetchImpl;
|
|
98
|
+
now;
|
|
99
|
+
constructor(config, options = {}) {
|
|
100
|
+
this.config = config;
|
|
101
|
+
const validation = validateJaegerConfig(config);
|
|
102
|
+
if (!validation.valid) {
|
|
103
|
+
throw new AdapterError("CONFIG_INVALID", validation.errors[0]?.message || "Invalid config", {
|
|
104
|
+
details: { errors: validation.errors },
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
this.apiBaseUrl = config.url.replace(/\/$/, "");
|
|
108
|
+
this.fetchImpl = options.fetch ?? fetch;
|
|
109
|
+
this.now = options.now ?? Date.now;
|
|
110
|
+
}
|
|
111
|
+
/** Effective Query API base after `/jaeger` path fallback (if any). */
|
|
112
|
+
get resolvedUrl() {
|
|
113
|
+
return this.apiBaseUrl;
|
|
114
|
+
}
|
|
115
|
+
validateConfig(config) {
|
|
116
|
+
return validateJaegerConfig(config);
|
|
117
|
+
}
|
|
118
|
+
async getCapabilities(_config) {
|
|
119
|
+
return {
|
|
120
|
+
...JAEGER_CAPABILITIES,
|
|
121
|
+
limits: {
|
|
122
|
+
...(this.config.maxResultRows === undefined
|
|
123
|
+
? {}
|
|
124
|
+
: { maxResultRows: this.config.maxResultRows }),
|
|
125
|
+
...(this.config.maxTimeRangeMs === undefined
|
|
126
|
+
? {}
|
|
127
|
+
: { maxTimeRangeMs: this.config.maxTimeRangeMs }),
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
async discoverSchema(_context) {
|
|
132
|
+
return jaegerSemanticSchema();
|
|
133
|
+
}
|
|
134
|
+
async compile(query, context = {}) {
|
|
135
|
+
if (query.spec.mode === "native") {
|
|
136
|
+
throw new AdapterError("UNSUPPORTED_OPERATION", "Jaeger does not support native query languages; use semantic mode with service.name.");
|
|
137
|
+
}
|
|
138
|
+
return compileJaegerQuery(query, {
|
|
139
|
+
...(context.variables ? { variables: context.variables } : {}),
|
|
140
|
+
maxResultRows: context.maxResultRows ?? this.config.maxResultRows ?? DEFAULT_MAX_RESULT_ROWS,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
async execute(query, context) {
|
|
144
|
+
if (!isCompiledQuery(query)) {
|
|
145
|
+
throw new AdapterError("UNSUPPORTED_OPERATION", "Jaeger execute expects a compiled semantic query.");
|
|
146
|
+
}
|
|
147
|
+
const traces = await this.searchTraces({
|
|
148
|
+
service: query.compiled.service,
|
|
149
|
+
startMs: query.compiled.startMs,
|
|
150
|
+
endMs: query.compiled.endMs,
|
|
151
|
+
limit: query.compiled.limit,
|
|
152
|
+
...(query.compiled.operation ? { operation: query.compiled.operation } : {}),
|
|
153
|
+
...(query.compiled.tags ? { tags: query.compiled.tags } : {}),
|
|
154
|
+
}, context);
|
|
155
|
+
return normalizeJaegerSearchResponse(traces, query.fields);
|
|
156
|
+
}
|
|
157
|
+
async explain(query, context = {}) {
|
|
158
|
+
if (query.spec.mode === "native") {
|
|
159
|
+
return {
|
|
160
|
+
summary: "Native Jaeger queries are not supported.",
|
|
161
|
+
steps: [],
|
|
162
|
+
warnings: ["Jaeger has no native query language in OpenPlait."],
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const compiledQuery = await this.compile(query, context);
|
|
166
|
+
return {
|
|
167
|
+
summary: `Jaeger /api/traces search for service=${compiledQuery.compiled.service}`,
|
|
168
|
+
steps: [
|
|
169
|
+
`Resolve dataset '${compiledQuery.source.dataset}'.`,
|
|
170
|
+
`GET /api/traces?service=${compiledQuery.compiled.service}&limit=${compiledQuery.compiled.limit}`,
|
|
171
|
+
],
|
|
172
|
+
compiledQuery,
|
|
173
|
+
warnings: compiledQuery.warnings,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/** Discover services (or return configured list). Retries under `/jaeger` when needed. */
|
|
177
|
+
async listServices() {
|
|
178
|
+
if (this.config.services?.length)
|
|
179
|
+
return [...this.config.services];
|
|
180
|
+
try {
|
|
181
|
+
const response = await this.requestJson("/api/services");
|
|
182
|
+
return (response.data || []).map(String).filter(Boolean);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
if (new URL(this.apiBaseUrl).pathname === "/") {
|
|
186
|
+
this.apiBaseUrl = `${this.apiBaseUrl}/jaeger`;
|
|
187
|
+
const response = await this.requestJson("/api/services");
|
|
188
|
+
return (response.data || []).map(String).filter(Boolean);
|
|
189
|
+
}
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/** GET /api/services/{service}/operations — Jaeger Search operation dropdown. */
|
|
194
|
+
async listOperations(service) {
|
|
195
|
+
const name = encodeURIComponent(service.trim());
|
|
196
|
+
if (!name)
|
|
197
|
+
return [];
|
|
198
|
+
const response = await this.requestJson(`/api/services/${name}/operations`);
|
|
199
|
+
return (response.data || []).map(String).filter(Boolean);
|
|
200
|
+
}
|
|
201
|
+
async searchTraces(params, context) {
|
|
202
|
+
const url = new URL(`${this.apiBaseUrl}/api/traces`);
|
|
203
|
+
url.searchParams.set("service", params.service);
|
|
204
|
+
url.searchParams.set("start", String(params.startMs * 1000));
|
|
205
|
+
url.searchParams.set("end", String(params.endMs * 1000));
|
|
206
|
+
url.searchParams.set("limit", String(params.limit ?? this.config.perServiceLimit ?? 100));
|
|
207
|
+
if (params.operation)
|
|
208
|
+
url.searchParams.set("operation", params.operation);
|
|
209
|
+
if (params.tags && Object.keys(params.tags).length) {
|
|
210
|
+
url.searchParams.set("tags", JSON.stringify(params.tags));
|
|
211
|
+
}
|
|
212
|
+
const response = await this.requestJson(url.toString(), context);
|
|
213
|
+
return response.data || [];
|
|
214
|
+
}
|
|
215
|
+
async getTrace(traceId, context) {
|
|
216
|
+
const id = encodeURIComponent(traceId.trim());
|
|
217
|
+
if (!id)
|
|
218
|
+
return null;
|
|
219
|
+
const response = await this.requestJson(`/api/traces/${id}`, context);
|
|
220
|
+
return response.data?.[0] || null;
|
|
221
|
+
}
|
|
222
|
+
/** Convenience: normalize a list of Jaeger traces into OpenLIT-style spans. */
|
|
223
|
+
normalizeSpans(traces) {
|
|
224
|
+
return flattenJaegerTraces(traces);
|
|
225
|
+
}
|
|
226
|
+
async getTraceResult(traceId, context) {
|
|
227
|
+
const trace = await this.getTrace(traceId, context);
|
|
228
|
+
return trace ? normalizeJaegerTraceResponse(trace) : null;
|
|
229
|
+
}
|
|
230
|
+
authHeaders() {
|
|
231
|
+
const headers = {
|
|
232
|
+
Accept: "application/json",
|
|
233
|
+
...(this.config.httpHeaders || {}),
|
|
234
|
+
};
|
|
235
|
+
if (this.config.bearerToken) {
|
|
236
|
+
headers.Authorization = `Bearer ${this.config.bearerToken}`;
|
|
237
|
+
}
|
|
238
|
+
else if (this.config.username && this.config.password) {
|
|
239
|
+
const token = Buffer.from(`${this.config.username}:${this.config.password}`, "utf8").toString("base64");
|
|
240
|
+
headers.Authorization = `Basic ${token}`;
|
|
241
|
+
}
|
|
242
|
+
return headers;
|
|
243
|
+
}
|
|
244
|
+
async requestJson(pathOrUrl, context) {
|
|
245
|
+
const requestId = context?.audit.requestId;
|
|
246
|
+
if (requestId && !SAFE_REQUEST_ID.test(requestId)) {
|
|
247
|
+
throw new AdapterError("CONFIG_INVALID", "Invalid request id.");
|
|
248
|
+
}
|
|
249
|
+
const url = pathOrUrl.startsWith("http")
|
|
250
|
+
? pathOrUrl
|
|
251
|
+
: `${this.apiBaseUrl}${pathOrUrl.startsWith("/") ? "" : "/"}${pathOrUrl}`;
|
|
252
|
+
const controller = new AbortController();
|
|
253
|
+
const timeout = setTimeout(() => controller.abort(), this.config.requestTimeoutMs || DEFAULT_TIMEOUT_MS);
|
|
254
|
+
if (context?.abortSignal) {
|
|
255
|
+
if (context.abortSignal.aborted)
|
|
256
|
+
controller.abort();
|
|
257
|
+
else
|
|
258
|
+
context.abortSignal.addEventListener("abort", () => controller.abort(), { once: true });
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
const response = await this.fetchImpl(url, {
|
|
262
|
+
method: "GET",
|
|
263
|
+
headers: {
|
|
264
|
+
...this.authHeaders(),
|
|
265
|
+
...(requestId ? { "X-Request-Id": requestId } : {}),
|
|
266
|
+
},
|
|
267
|
+
signal: controller.signal,
|
|
268
|
+
});
|
|
269
|
+
const bodyText = await response.text();
|
|
270
|
+
if (!response.ok) {
|
|
271
|
+
throw new AdapterError("EXECUTION_FAILED", `Jaeger request failed (${response.status})`, {
|
|
272
|
+
details: {
|
|
273
|
+
status: response.status,
|
|
274
|
+
body: bodyText.slice(0, 1000),
|
|
275
|
+
endpoint: url,
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if (!bodyText)
|
|
280
|
+
return {};
|
|
281
|
+
try {
|
|
282
|
+
return JSON.parse(bodyText);
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
throw new AdapterError("EXECUTION_FAILED", "Jaeger returned non-JSON body", {
|
|
286
|
+
details: {
|
|
287
|
+
endpoint: url,
|
|
288
|
+
body: bodyText.slice(0, 500),
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
if (isAbortError(error)) {
|
|
295
|
+
throw new AdapterError("TIMEOUT", "Jaeger request timed out or was cancelled.");
|
|
296
|
+
}
|
|
297
|
+
if (error instanceof AdapterError)
|
|
298
|
+
throw error;
|
|
299
|
+
throw new AdapterError("EXECUTION_FAILED", String(error?.message || error));
|
|
300
|
+
}
|
|
301
|
+
finally {
|
|
302
|
+
clearTimeout(timeout);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,GAWhB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAY5B,MAAM,eAAe,GAAG,eAAe,CAAC;AACxC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AACtC,MAAM,WAAW,GAAG,+BAA+B,CAAC;AACpD,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAAoB;IACtD,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,eAAe;IACxB,cAAc,EAAE,CAAC,oBAAoB,CAAC;IACtC,OAAO,EAAE,CAAC,QAAQ,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,OAAO,EAAE,CAAC,QAAQ,CAAC;IACnB,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;IAClD,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;IAC/C,oBAAoB,EAAE,EAAE;IACxB,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,IAAI;CACtB,CAAC;AAEF,SAAS,oBAAo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ledQuery } from "@openplait/adapter-sdk";
|
|
2
|
+
import type { SemanticQuery } from "@openplait/core";
|
|
3
|
+
import type { JaegerCompiledRequest } from "./types.js";
|
|
4
|
+
export declare function compileJaegerQuery(query: SemanticQuery, context?: {
|
|
5
|
+
variables?: Record<string, unknown>;
|
|
6
|
+
maxResultRows?: number;
|
|
7
|
+
}): CompiledQuery<JaegerCompiledRequest>;
|
|
8
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../src/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAyDxD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5E,aAAa,CAAC,qBAAqB,CAAC,CA+DtC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AdapterError } from "@openplait/adapter-sdk";
|
|
2
|
+
import { JAEGER_DATASET_NAME, JAEGER_TRACE_FIELDS } from "./datasets.js";
|
|
3
|
+
function resolveVariable(value, variables) {
|
|
4
|
+
if (typeof value !== "string")
|
|
5
|
+
return value;
|
|
6
|
+
const match = value.match(/^\$\{([^}]+)\}$/);
|
|
7
|
+
if (!match?.[1])
|
|
8
|
+
return value;
|
|
9
|
+
return variables?.[match[1]] ?? value;
|
|
10
|
+
}
|
|
11
|
+
function asIsoMs(value) {
|
|
12
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
13
|
+
return value;
|
|
14
|
+
const date = new Date(String(value || ""));
|
|
15
|
+
if (Number.isNaN(date.getTime())) {
|
|
16
|
+
throw new AdapterError("INVALID_PARAMETER", "Jaeger time range bounds are invalid.");
|
|
17
|
+
}
|
|
18
|
+
return date.getTime();
|
|
19
|
+
}
|
|
20
|
+
function extractServiceFilter(where, variables) {
|
|
21
|
+
const tags = {};
|
|
22
|
+
let service;
|
|
23
|
+
let operation;
|
|
24
|
+
const visit = (node) => {
|
|
25
|
+
if (!node || typeof node !== "object")
|
|
26
|
+
return;
|
|
27
|
+
const record = node;
|
|
28
|
+
if (Array.isArray(record.and)) {
|
|
29
|
+
for (const child of record.and)
|
|
30
|
+
visit(child);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (typeof record.field !== "string")
|
|
34
|
+
return;
|
|
35
|
+
const field = record.field;
|
|
36
|
+
const operator = String(record.operator || "equals");
|
|
37
|
+
if (operator !== "equals")
|
|
38
|
+
return;
|
|
39
|
+
const raw = resolveVariable(record.value, variables);
|
|
40
|
+
const value = String(raw ?? "");
|
|
41
|
+
if (!value)
|
|
42
|
+
return;
|
|
43
|
+
if (field === "service.name")
|
|
44
|
+
service = value;
|
|
45
|
+
else if (field === "span.name" || field === "operation.name")
|
|
46
|
+
operation = value;
|
|
47
|
+
else if (field.startsWith("attributes.") || field.startsWith("resource.")) {
|
|
48
|
+
tags[field.replace(/^(attributes|resource)\./, "")] = value;
|
|
49
|
+
}
|
|
50
|
+
else if (!(field in JAEGER_TRACE_FIELDS)) {
|
|
51
|
+
tags[field] = value;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
visit(where);
|
|
55
|
+
return {
|
|
56
|
+
tags,
|
|
57
|
+
...(service ? { service } : {}),
|
|
58
|
+
...(operation ? { operation } : {}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export function compileJaegerQuery(query, context = {}) {
|
|
62
|
+
const entity = query.spec.input?.entity || JAEGER_DATASET_NAME;
|
|
63
|
+
if (entity !== JAEGER_DATASET_NAME) {
|
|
64
|
+
throw new AdapterError("DATASET_NOT_FOUND", `Unknown Jaeger entity "${entity}".`);
|
|
65
|
+
}
|
|
66
|
+
if (query.spec.input?.signal && query.spec.input.signal !== "traces") {
|
|
67
|
+
throw new AdapterError("UNSUPPORTED_OPERATION", "Jaeger adapter only supports traces.");
|
|
68
|
+
}
|
|
69
|
+
const from = asIsoMs(resolveVariable(query.spec.timeRange?.from, context.variables));
|
|
70
|
+
const to = asIsoMs(resolveVariable(query.spec.timeRange?.to, context.variables));
|
|
71
|
+
const { service, operation, tags } = extractServiceFilter(query.spec.where, context.variables);
|
|
72
|
+
if (!service) {
|
|
73
|
+
throw new AdapterError("QUERY_VALIDATION_FAILED", 'Jaeger search requires a service.name equals filter (Jaeger Query API is service-scoped).');
|
|
74
|
+
}
|
|
75
|
+
const limit = Math.min(Math.max(1, Number(query.spec.limit) || 100), context.maxResultRows || 1_000);
|
|
76
|
+
const selected = (query.spec.select || [
|
|
77
|
+
{ field: "trace.id" },
|
|
78
|
+
{ field: "span.id" },
|
|
79
|
+
{ field: "timestamp" },
|
|
80
|
+
{ field: "duration" },
|
|
81
|
+
{ field: "service.name" },
|
|
82
|
+
{ field: "span.name" },
|
|
83
|
+
])
|
|
84
|
+
.filter((item) => "field" in item)
|
|
85
|
+
.map((item) => {
|
|
86
|
+
const name = item.as || item.field;
|
|
87
|
+
const meta = JAEGER_TRACE_FIELDS[item.field];
|
|
88
|
+
return {
|
|
89
|
+
name,
|
|
90
|
+
source: meta?.resultKey || item.field,
|
|
91
|
+
type: meta?.type || "string",
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
kind: "CompiledQuery",
|
|
96
|
+
language: "openplait-semantic",
|
|
97
|
+
compiled: {
|
|
98
|
+
endpoint: "search",
|
|
99
|
+
service,
|
|
100
|
+
startMs: from,
|
|
101
|
+
endMs: to,
|
|
102
|
+
limit,
|
|
103
|
+
...(operation ? { operation } : {}),
|
|
104
|
+
...(Object.keys(tags).length ? { tags } : {}),
|
|
105
|
+
},
|
|
106
|
+
parameters: {},
|
|
107
|
+
fields: selected,
|
|
108
|
+
source: {
|
|
109
|
+
resourceName: query.metadata.name,
|
|
110
|
+
dataset: JAEGER_DATASET_NAME,
|
|
111
|
+
},
|
|
112
|
+
warnings: [],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../src/compiler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGzE,SAAS,eAAe,CAAC,KAAc,EAAE,SAAmC;IAC1E,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9B,OAAO,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;AACxC,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,YAAY,CAAC,mBAAmB,EAAE,uCAAuC,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;AACxB,CAAC;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AAO;YACP,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,EAAE;YACT,KAAK;YACL,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C;QACD,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;YACjC,OAAO,EAAE,mBAAmB;SAC7B;QACD,QAAQ,EAAE,EAAE;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SemanticSchema } from "@openplait/core";
|
|
2
|
+
export declare const JAEGER_DATASET_NAME = "jaeger.traces";
|
|
3
|
+
export declare const JAEGER_TRACE_FIELDS: Record<string, {
|
|
4
|
+
type: "string" | "time" | "duration" | "number" | "trace";
|
|
5
|
+
resultKey?: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function jaegerSemanticSchema(): SemanticSchema;
|
|
8
|
+
//# sourceMappingURL=datasets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../src/datasets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAEnD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,MAAM,EACN;IAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CASlF,CAAC;AAEF,wBAAgB,oBAAoB,IAAI,cAAc,CAarD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const JAEGER_DATASET_NAME = "jaeger.traces";
|
|
2
|
+
export const JAEGER_TRACE_FIELDS = {
|
|
3
|
+
"trace.id": { type: "trace", resultKey: "traceId" },
|
|
4
|
+
"span.id": { type: "string", resultKey: "spanId" },
|
|
5
|
+
timestamp: { type: "time", resultKey: "timestamp" },
|
|
6
|
+
duration: { type: "duration", resultKey: "durationNs" },
|
|
7
|
+
"service.name": { type: "string", resultKey: "serviceName" },
|
|
8
|
+
"span.name": { type: "string", resultKey: "name" },
|
|
9
|
+
"status.code": { type: "string", resultKey: "statusCode" },
|
|
10
|
+
};
|
|
11
|
+
export function jaegerSemanticSchema() {
|
|
12
|
+
return {
|
|
13
|
+
datasets: [
|
|
14
|
+
{
|
|
15
|
+
name: JAEGER_DATASET_NAME,
|
|
16
|
+
signal: "traces",
|
|
17
|
+
fields: Object.entries(JAEGER_TRACE_FIELDS).map(([name, meta]) => ({
|
|
18
|
+
name,
|
|
19
|
+
type: meta.type,
|
|
20
|
+
})),
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=datasets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../src/datasets.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAEnD,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE;IACnD,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE;IAClD,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE;IACnD,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE;IACvD,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE;IAC5D,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE;IAClD,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE;CAC3D,CAAC;AAEF,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,mBAAmB;gBACzB,MAAM,EAAE,QAAQ;gBAChB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;oBACjE,IAAI;oBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,CAAC,CAAC;aACJ;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { JAEGER_ADAPTER_MANIFEST, JAEGER_CAPABILITIES, JaegerAdapter, validateJaegerConfig, } from "./adapter.js";
|
|
2
|
+
export { compileJaegerQuery } from "./compiler.js";
|
|
3
|
+
export { JAEGER_DATASET_NAME, JAEGER_TRACE_FIELDS, jaegerSemanticSchema, } from "./datasets.js";
|
|
4
|
+
export { flattenJaegerTraces, normalizeJaegerSearchResponse, normalizeJaegerSpan, normalizeJaegerTraceResponse, } from "./normalization.js";
|
|
5
|
+
export type { JaegerAdapterConfig, JaegerAdapterOptions, JaegerCompiledRequest, JaegerLog, JaegerNormalizedSpan, JaegerProcess, JaegerRef, JaegerSearchParams, JaegerServicesResponse, JaegerSpan, JaegerTag, JaegerTrace, JaegerTracesResponse, } from "./types.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,UAAU,EACV,SAAS,EACT,WAAW,EACX,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { JAEGER_ADAPTER_MANIFEST, JAEGER_CAPABILITIES, JaegerAdapter, validateJaegerConfig, } from "./adapter.js";
|
|
2
|
+
export { compileJaegerQuery } from "./compiler.js";
|
|
3
|
+
export { JAEGER_DATASET_NAME, JAEGER_TRACE_FIELDS, jaegerSemanticSchema, } from "./datasets.js";
|
|
4
|
+
export { flattenJaegerTraces, normalizeJaegerSearchResponse, normalizeJaegerSpan, normalizeJaegerTraceResponse, } from "./normalization.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CompiledField } from "@openplait/adapter-sdk";
|
|
2
|
+
import type { QueryResult } from "@openplait/core";
|
|
3
|
+
import type { JaegerNormalizedSpan, JaegerProcess, JaegerSpan, JaegerTrace } from "./types.js";
|
|
4
|
+
export declare function normalizeJaegerSpan(span: JaegerSpan, processes: Record<string, JaegerProcess>): JaegerNormalizedSpan;
|
|
5
|
+
export declare function flattenJaegerTraces(traces: JaegerTrace[]): JaegerNormalizedSpan[];
|
|
6
|
+
export declare function normalizeJaegerSearchResponse(traces: JaegerTrace[], fields?: CompiledField[]): QueryResult;
|
|
7
|
+
export declare function normalizeJaegerTraceResponse(trace: JaegerTrace): QueryResult;
|
|
8
|
+
//# sourceMappingURL=normalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalization.d.ts","sourceRoot":"","sources":["../../src/normalization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,UAAU,EAEV,WAAW,EACZ,MAAM,YAAY,CAAC;AAUpB,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GACvC,oBAAoB,CA2CtB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,oBAAoB,EAAE,CASjF;AA4BD,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,GAAE,aAAa,EAAmB,GACvC,WAAW,CAab;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAE5E"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
function tagsToMap(tags) {
|
|
2
|
+
const out = {};
|
|
3
|
+
for (const tag of tags || []) {
|
|
4
|
+
if (tag.key !== undefined)
|
|
5
|
+
out[tag.key] = String(tag.value);
|
|
6
|
+
}
|
|
7
|
+
return out;
|
|
8
|
+
}
|
|
9
|
+
export function normalizeJaegerSpan(span, processes) {
|
|
10
|
+
const process = span.processID ? processes[span.processID] : undefined;
|
|
11
|
+
const resourceAttributes = tagsToMap(process?.tags);
|
|
12
|
+
const serviceName = process?.serviceName || resourceAttributes["service.name"] || "";
|
|
13
|
+
if (serviceName)
|
|
14
|
+
resourceAttributes["service.name"] = serviceName;
|
|
15
|
+
const spanAttributes = tagsToMap(span.tags);
|
|
16
|
+
const parentRef = (span.references || []).find((ref) => ref.refType === "CHILD_OF" || ref.refType === "FOLLOWS_FROM");
|
|
17
|
+
const events = (span.logs || []).map((log) => {
|
|
18
|
+
const fields = tagsToMap(log.fields);
|
|
19
|
+
const timestamp = log.timestamp
|
|
20
|
+
? new Date(log.timestamp / 1000).toISOString()
|
|
21
|
+
: undefined;
|
|
22
|
+
return {
|
|
23
|
+
name: fields.event || fields.name || "log",
|
|
24
|
+
...(timestamp ? { timestamp } : {}),
|
|
25
|
+
attributes: fields,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
const statusCode = spanAttributes["otel.status_code"] ||
|
|
29
|
+
(spanAttributes.error === "true" ? "STATUS_CODE_ERROR" : "");
|
|
30
|
+
const costStr = spanAttributes["gen_ai.usage.cost"];
|
|
31
|
+
return {
|
|
32
|
+
traceId: String(span.traceID || ""),
|
|
33
|
+
spanId: String(span.spanID || ""),
|
|
34
|
+
parentSpanId: String(parentRef?.spanID || ""),
|
|
35
|
+
name: String(span.operationName || ""),
|
|
36
|
+
serviceName,
|
|
37
|
+
timestamp: span.startTime
|
|
38
|
+
? new Date(span.startTime / 1000).toISOString()
|
|
39
|
+
: "",
|
|
40
|
+
durationNs: Math.round((span.duration || 0) * 1000),
|
|
41
|
+
statusCode,
|
|
42
|
+
...(spanAttributes["span.kind"] ? { spanKind: spanAttributes["span.kind"] } : {}),
|
|
43
|
+
spanAttributes,
|
|
44
|
+
resourceAttributes,
|
|
45
|
+
events,
|
|
46
|
+
...(costStr !== undefined ? { cost: Number(costStr) || 0 } : {}),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export function flattenJaegerTraces(traces) {
|
|
50
|
+
const spans = [];
|
|
51
|
+
for (const trace of traces) {
|
|
52
|
+
const processes = trace.processes || {};
|
|
53
|
+
for (const span of trace.spans || []) {
|
|
54
|
+
spans.push(normalizeJaegerSpan(span, processes));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return spans;
|
|
58
|
+
}
|
|
59
|
+
const DEFAULT_FIELDS = [
|
|
60
|
+
{ name: "trace.id", source: "traceId", type: "trace" },
|
|
61
|
+
{ name: "span.id", source: "spanId", type: "string" },
|
|
62
|
+
{ name: "timestamp", source: "timestamp", type: "time" },
|
|
63
|
+
{ name: "duration", source: "durationNs", type: "duration", unit: "ns" },
|
|
64
|
+
{ name: "service.name", source: "serviceName", type: "string" },
|
|
65
|
+
{ name: "span.name", source: "name", type: "string" },
|
|
66
|
+
{ name: "status.code", source: "statusCode", type: "string" },
|
|
67
|
+
];
|
|
68
|
+
function fieldValues(spans, source) {
|
|
69
|
+
return spans.map((span) => {
|
|
70
|
+
const record = span;
|
|
71
|
+
return record[source] ?? null;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function dataField(field, values) {
|
|
75
|
+
return {
|
|
76
|
+
name: field.name,
|
|
77
|
+
type: field.type,
|
|
78
|
+
...(field.unit ? { unit: field.unit } : {}),
|
|
79
|
+
values,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function normalizeJaegerSearchResponse(traces, fields = DEFAULT_FIELDS) {
|
|
83
|
+
const spans = flattenJaegerTraces(traces);
|
|
84
|
+
return {
|
|
85
|
+
frames: [
|
|
86
|
+
{
|
|
87
|
+
name: "spans",
|
|
88
|
+
length: spans.length,
|
|
89
|
+
fields: fields.map((field) => dataField(field, fieldValues(spans, field.source ?? field.name))),
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export function normalizeJaegerTraceResponse(trace) {
|
|
95
|
+
return normalizeJaegerSearchResponse([trace]);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=normalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalization.js","sourceRoot":"","sources":["../../src/normalization.ts"],"names":[],"mappings":"AAWA,SAAS,SAAS,CAAC,IAAkB;IACnC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;QAC7B,IAAI,GAAG,CAAC,GAAG,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,IAAgB,EAChB,SAAwC;IAExC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,MAAM,kBAAkB,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,WAAW,GACf,OAAO,EAAE,WAAW,IAAI,kBAAkB,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IACnE,IAAI,WAAW;QAAE,kBAAkB,CAAC,cAAc,CAAC,GAAG,WAAW,CAAC;IAClE,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,UAAU,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KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CACjE;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,KAAkB;IAC7D,OAAO,6BAA6B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export type JaegerTag = {
|
|
2
|
+
key: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
value: unknown;
|
|
5
|
+
};
|
|
6
|
+
export type JaegerLog = {
|
|
7
|
+
timestamp?: number;
|
|
8
|
+
fields?: JaegerTag[];
|
|
9
|
+
};
|
|
10
|
+
export type JaegerRef = {
|
|
11
|
+
refType?: string;
|
|
12
|
+
traceID?: string;
|
|
13
|
+
spanID?: string;
|
|
14
|
+
};
|
|
15
|
+
export type JaegerSpan = {
|
|
16
|
+
traceID?: string;
|
|
17
|
+
spanID?: string;
|
|
18
|
+
operationName?: string;
|
|
19
|
+
references?: JaegerRef[];
|
|
20
|
+
startTime?: number;
|
|
21
|
+
duration?: number;
|
|
22
|
+
tags?: JaegerTag[];
|
|
23
|
+
logs?: JaegerLog[];
|
|
24
|
+
processID?: string;
|
|
25
|
+
};
|
|
26
|
+
export type JaegerProcess = {
|
|
27
|
+
serviceName?: string;
|
|
28
|
+
tags?: JaegerTag[];
|
|
29
|
+
};
|
|
30
|
+
export type JaegerTrace = {
|
|
31
|
+
traceID?: string;
|
|
32
|
+
spans?: JaegerSpan[];
|
|
33
|
+
processes?: Record<string, JaegerProcess>;
|
|
34
|
+
};
|
|
35
|
+
export type JaegerServicesResponse = {
|
|
36
|
+
data?: string[];
|
|
37
|
+
};
|
|
38
|
+
export type JaegerTracesResponse = {
|
|
39
|
+
data?: JaegerTrace[];
|
|
40
|
+
};
|
|
41
|
+
export interface JaegerAdapterConfig {
|
|
42
|
+
url: string;
|
|
43
|
+
httpHeaders?: Record<string, string>;
|
|
44
|
+
username?: string;
|
|
45
|
+
password?: string;
|
|
46
|
+
bearerToken?: string;
|
|
47
|
+
requestTimeoutMs?: number;
|
|
48
|
+
maxResultRows?: number;
|
|
49
|
+
maxTimeRangeMs?: number;
|
|
50
|
+
/** Prefer an explicit service list instead of `/api/services`. */
|
|
51
|
+
services?: string[];
|
|
52
|
+
/** Default per-service search limit (Jaeger `limit` query param). */
|
|
53
|
+
perServiceLimit?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface JaegerAdapterOptions {
|
|
56
|
+
fetch?: typeof fetch;
|
|
57
|
+
now?: () => number;
|
|
58
|
+
}
|
|
59
|
+
export interface JaegerSearchParams {
|
|
60
|
+
service: string;
|
|
61
|
+
startMs: number;
|
|
62
|
+
endMs: number;
|
|
63
|
+
limit?: number;
|
|
64
|
+
operation?: string;
|
|
65
|
+
tags?: Record<string, string>;
|
|
66
|
+
}
|
|
67
|
+
export interface JaegerNormalizedSpan {
|
|
68
|
+
traceId: string;
|
|
69
|
+
spanId: string;
|
|
70
|
+
parentSpanId: string;
|
|
71
|
+
name: string;
|
|
72
|
+
serviceName: string;
|
|
73
|
+
timestamp: string;
|
|
74
|
+
durationNs: number;
|
|
75
|
+
statusCode: string;
|
|
76
|
+
spanKind?: string;
|
|
77
|
+
spanAttributes: Record<string, string>;
|
|
78
|
+
resourceAttributes: Record<string, string>;
|
|
79
|
+
events: Array<{
|
|
80
|
+
name: string;
|
|
81
|
+
timestamp?: string;
|
|
82
|
+
attributes: Record<string, string>;
|
|
83
|
+
}>;
|
|
84
|
+
cost?: number;
|
|
85
|
+
}
|
|
86
|
+
export interface JaegerCompiledRequest {
|
|
87
|
+
endpoint: "search";
|
|
88
|
+
service: string;
|
|
89
|
+
startMs: number;
|
|
90
|
+
endMs: number;
|
|
91
|
+
limit: number;
|
|
92
|
+
operation?: string;
|
|
93
|
+
tags?: Record<string, string>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=types.d.ts.map
|
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CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC,CAAC,CAAC;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openplait/adapter-jaeger",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Jaeger query API datasource adapter for OpenPlait trace queries.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/src",
|
|
9
|
+
"README.md",
|
|
10
|
+
"LICENSE"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/src/index.d.ts",
|
|
15
|
+
"import": "./dist/src/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.build.json",
|
|
20
|
+
"prebuild": "npm run build --workspace @openplait/adapter-sdk",
|
|
21
|
+
"prepack": "npm run build",
|
|
22
|
+
"pretest": "npm run build --workspace @openplait/adapter-sdk",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"pretypecheck": "npm run build --workspace @openplait/adapter-sdk",
|
|
25
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20.19"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@openplait/adapter-sdk": "0.1.0-alpha.0",
|
|
32
|
+
"@openplait/core": "0.1.0-alpha.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"typescript": "^5.9.0",
|
|
36
|
+
"vitest": "^3.2.0"
|
|
37
|
+
},
|
|
38
|
+
"license": "Apache-2.0",
|
|
39
|
+
"author": "OpenLIT",
|
|
40
|
+
"homepage": "https://github.com/openlit/openplait#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/openlit/openplait/issues"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/openlit/openplait.git",
|
|
47
|
+
"directory": "typescript/packages/adapter-jaeger"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public",
|
|
51
|
+
"registry": "https://registry.npmjs.org/"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"openplait",
|
|
55
|
+
"openlit",
|
|
56
|
+
"opentelemetry",
|
|
57
|
+
"observability",
|
|
58
|
+
"datasource",
|
|
59
|
+
"adapter",
|
|
60
|
+
"jaeger",
|
|
61
|
+
"traces"
|
|
62
|
+
]
|
|
63
|
+
}
|