-
Notifications
You must be signed in to change notification settings - Fork 7
Jaeger #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Jaeger #108
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "steps": [ | ||
| { | ||
| "displayName": "Check connection", | ||
| "dataStream": { | ||
| "name": "services" | ||
| }, | ||
| "required": true, | ||
| "error": "Could not reach the Jaeger Query API. Check the URL is correct, that the instance is reachable (directly or via an on-prem relay agent), and enable 'Ignore certificate errors' if it uses a self-signed certificate.", | ||
| "success": "Connected successfully." | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "words": [ | ||
| "jaeger", | ||
| "opentelemetry" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [ | ||
| { | ||
| "name": "Service", | ||
| "sourceType": "Service", | ||
| "icon": "server", | ||
| "singular": "Service", | ||
| "plural": "Services" | ||
| }, | ||
| { | ||
| "name": "Dependency", | ||
| "sourceType": "Dependency", | ||
| "icon": "share-nodes", | ||
| "singular": "Dependency", | ||
| "plural": "Dependencies" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| { | ||
| "name": "dependencies", | ||
| "displayName": "Dependencies", | ||
| "description": "Call dependencies between services, one row per parent-child pair", | ||
| "tags": [ | ||
| "Services" | ||
| ], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "matches": "none", | ||
| "timeframes": [ | ||
| "last1hour", | ||
| "last12hours", | ||
| "last24hours", | ||
| "last7days" | ||
| ], | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "/api/dependencies", | ||
| "pathToData": "data", | ||
| "getArgs": [ | ||
| { | ||
| "key": "endTs", | ||
| "value": "{{timeframe.unixEnd * 1000}}" | ||
| }, | ||
| { | ||
| "key": "lookback", | ||
| "value": "{{(timeframe.unixEnd - timeframe.unixStart) * 1000}}" | ||
| } | ||
| ], | ||
| "headers": [] | ||
| }, | ||
| "metadata": [ | ||
| { | ||
| "name": "key", | ||
| "displayName": "Dependency", | ||
| "computed": true, | ||
| "valueExpression": "{{ $['parent'] + ' -> ' + $['child'] }}", | ||
| "shape": "string", | ||
| "role": "label" | ||
| }, | ||
| { | ||
| "name": "parent", | ||
| "displayName": "Parent Service", | ||
| "shape": "string" | ||
| }, | ||
| { | ||
| "name": "child", | ||
| "displayName": "Child Service", | ||
| "shape": "string" | ||
| }, | ||
| { | ||
| "name": "callCount", | ||
| "displayName": "Call Count", | ||
| "shape": [ | ||
| "number", | ||
| { | ||
| "thousandsSeparator": true | ||
| } | ||
| ] | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| }, | ||
| { | ||
| "name": "source", | ||
| "displayName": "Source", | ||
| "shape": "string", | ||
| "visible": false | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| { | ||
| "name": "operations", | ||
| "displayName": "Operations", | ||
| "description": "Operation names reported by a service", | ||
| "tags": [ | ||
| "Operations" | ||
| ], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "matches": { | ||
| "sourceType": { | ||
| "type": "equals", | ||
| "value": "Service" | ||
| } | ||
| }, | ||
| "timeframes": false, | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "/api/v3/operations", | ||
| "getArgs": [ | ||
| { | ||
| "key": "service", | ||
| "value": "{{object.rawId}}" | ||
| } | ||
| ], | ||
| "headers": [], | ||
| "pathToData": "operations" | ||
| }, | ||
| "metadata": [ | ||
| { | ||
| "name": "name", | ||
| "displayName": "Operation", | ||
| "shape": "string", | ||
| "role": "label" | ||
| }, | ||
| { | ||
| "name": "spanKind", | ||
| "displayName": "Span Kind", | ||
| "shape": "string" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| // dataStreams/scripts/traces.js | ||
| // | ||
| // The /api/v3/traces response is a single JSON object shaped | ||
| // { "result": { "resourceSpans": [...] } } (OTLP JSON) - not NDJSON - so the | ||
| // platform's automatic JSON parse populates `data` and we read it directly. | ||
| // | ||
| // OTLP JSON encodes int64 (startTimeUnixNano/endTimeUnixNano) as STRING. | ||
| // Epoch nanoseconds (~1.7e18) exceed JS Number safe-integer precision, so we | ||
| // do the nanosecond arithmetic in BigInt and only convert to Number once | ||
| // we've reduced to milliseconds (~1.7e12, well within safe range). | ||
|
|
||
| const SPAN_KIND = { | ||
| 0: "UNSPECIFIED", | ||
| 1: "INTERNAL", | ||
| 2: "SERVER", | ||
| 3: "CLIENT", | ||
| 4: "PRODUCER", | ||
| 5: "CONSUMER", | ||
| }; | ||
|
|
||
| const STATUS_CODE = { | ||
| 0: "UNSET", | ||
| 1: "OK", | ||
| 2: "ERROR", | ||
| }; | ||
|
|
||
| function anyValueToJs(value) { | ||
| if (!value) return undefined; | ||
| if (value.arrayValue) { | ||
| return (value.arrayValue.values || []).map(anyValueToJs); | ||
| } | ||
| if (value.kvlistValue) { | ||
| const obj = {}; | ||
| (value.kvlistValue.values || []).forEach((kv) => { | ||
| obj[kv.key] = anyValueToJs(kv.value); | ||
| }); | ||
| return obj; | ||
| } | ||
| return ( | ||
| value.stringValue ?? | ||
| value.boolValue ?? | ||
| value.intValue ?? | ||
| value.doubleValue ?? | ||
| value.bytesValue | ||
| ); | ||
| } | ||
|
|
||
| function attrsToObject(attributes) { | ||
| const obj = {}; | ||
| (attributes || []).forEach((a) => { | ||
| obj[a.key] = anyValueToJs(a.value); | ||
| }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| return obj; | ||
| } | ||
|
|
||
| function nanoStrToBig(nanoStr) { | ||
| return BigInt(nanoStr || "0"); | ||
| } | ||
|
|
||
| const resourceSpans = (data && data.result && data.result.resourceSpans) || []; | ||
|
|
||
| result = _.flatMap(resourceSpans, (rs) => { | ||
| const resourceAttrs = attrsToObject((rs.resource || {}).attributes); | ||
| const serviceName = resourceAttrs["service.name"] || ""; | ||
|
|
||
| return _.flatMap(rs.scopeSpans || [], (ss) => { | ||
| return (ss.spans || []).map((s) => { | ||
| const startNsBig = nanoStrToBig(s.startTimeUnixNano); | ||
| const endNsBig = nanoStrToBig(s.endTimeUnixNano); | ||
| // Compute duration from the full-precision nanosecond values before | ||
| // rounding to ms — rounding each endpoint first and then subtracting | ||
| // can be off by up to 1ms (e.g. start=1.999999ms, end=2.000001ms | ||
| // truncate to 1ms/2ms, giving a 1ms duration for a ~2ns span). | ||
| const durationMsBig = (endNsBig - startNsBig) / 1000000n; | ||
| const status = s.status || {}; | ||
| // proto3 JSON omits fields at their default value, so an | ||
| // INTERNAL/unspecified-kind span (kind 0) typically has no `kind` | ||
| // field at all — default the missing case to 0 rather than | ||
| // stringifying `undefined`. | ||
| const kind = s.kind ?? 0; | ||
|
|
||
| return { | ||
| traceId: s.traceId, | ||
| spanId: s.spanId, | ||
| parentSpanId: s.parentSpanId || "", | ||
| operationName: s.name, | ||
| serviceName, | ||
| kind: SPAN_KIND[kind] ?? String(kind), | ||
| startTime: new Date( | ||
| Number(startNsBig / 1000000n), | ||
| ).toISOString(), | ||
| durationMs: Number(durationMsBig), | ||
| statusCode: STATUS_CODE[status.code] ?? "UNSET", | ||
| statusMessage: status.message || "", | ||
| attributes: attrsToObject(s.attributes), | ||
| }; | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "name": "services", | ||
| "displayName": "Services", | ||
| "description": "Services known to the Jaeger backend", | ||
| "tags": [ | ||
| "Services" | ||
| ], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "matches": "none", | ||
| "timeframes": false, | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "/api/v3/services", | ||
| "postRequestScript": "result = (data.services || []).map(service => ({ service }));", | ||
| "headers": [] | ||
| }, | ||
| "metadata": [ | ||
| { | ||
| "name": "service", | ||
| "displayName": "Service", | ||
| "shape": "string", | ||
| "role": "label" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| { | ||
| "name": "traces", | ||
| "displayName": "Traces", | ||
| "description": "Spans reported by a service within the selected timeframe", | ||
| "tags": [ | ||
| "Traces" | ||
| ], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "matches": { | ||
| "sourceType": { | ||
| "type": "equals", | ||
| "value": "Service" | ||
| } | ||
| }, | ||
| "timeframes": true, | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "/api/v3/traces", | ||
| "getArgs": [ | ||
| { | ||
| "key": "query.service_name", | ||
| "value": "{{object.rawId}}" | ||
| }, | ||
| { | ||
| "key": "query.start_time_min", | ||
| "value": "{{timeframe.start}}" | ||
| }, | ||
| { | ||
| "key": "query.start_time_max", | ||
| "value": "{{timeframe.end}}" | ||
| }, | ||
| { | ||
| "key": "query.search_depth", | ||
| "value": "{{limit}}" | ||
| } | ||
| ], | ||
| "headers": [], | ||
| "postRequestScript": "traces.js" | ||
| }, | ||
| "ui": [ | ||
| { | ||
| "name": "limit", | ||
| "label": "Number of Traces", | ||
| "type": "number", | ||
| "defaultValue": 20, | ||
| "min": 1 | ||
| } | ||
| ], | ||
| "metadata": [ | ||
| { | ||
| "name": "traceId", | ||
| "displayName": "Trace ID", | ||
| "shape": "string" | ||
| }, | ||
| { | ||
| "name": "spanId", | ||
| "displayName": "Span ID", | ||
| "shape": "string", | ||
| "visible": false | ||
| }, | ||
| { | ||
| "name": "parentSpanId", | ||
| "displayName": "Parent Span ID", | ||
| "shape": "string", | ||
| "visible": false | ||
| }, | ||
| { | ||
| "name": "operationName", | ||
| "displayName": "Operation", | ||
| "shape": "string", | ||
| "role": "label" | ||
| }, | ||
| { | ||
| "name": "serviceName", | ||
| "displayName": "Service", | ||
| "shape": "string" | ||
| }, | ||
| { | ||
| "name": "kind", | ||
| "displayName": "Kind", | ||
| "shape": "string" | ||
| }, | ||
| { | ||
| "name": "startTime", | ||
| "displayName": "Start Time", | ||
| "shape": "date", | ||
| "role": "timestamp" | ||
| }, | ||
| { | ||
| "name": "durationMs", | ||
| "displayName": "Duration (ms)", | ||
| "shape": "milliseconds", | ||
| "role": "value" | ||
| }, | ||
| { | ||
| "name": "statusCode", | ||
| "displayName": "Status Code", | ||
| "shape": "string" | ||
| }, | ||
| { | ||
| "name": "statusMessage", | ||
| "displayName": "Status Message", | ||
| "shape": "string", | ||
| "visible": false | ||
| }, | ||
| { | ||
| "name": "attributes", | ||
| "displayName": "Attributes", | ||
| "shape": "json", | ||
| "visible": false | ||
| } | ||
| ] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.