Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plugins/Jaeger/v1/configValidation.json
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."
}
]
}
6 changes: 6 additions & 0 deletions plugins/Jaeger/v1/cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"words": [
"jaeger",
"opentelemetry"
]
}
16 changes: 16 additions & 0 deletions plugins/Jaeger/v1/custom_types.json
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"
}
]
68 changes: 68 additions & 0 deletions plugins/Jaeger/v1/dataStreams/dependencies.json
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 ? timeframe.unixEnd * 1000 : Date.now()}}"
},
{
"key": "lookback",
"value": "{{(timeframe?.unixStart && timeframe?.unixEnd) ? (timeframe.unixEnd - timeframe.unixStart) * 1000 : 1800000}}"
}
Comment on lines +20 to +28

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use the documented one-hour fallback.

When no timeframe exists, Line 27 sends a lookback of 1800000 ms. This selects 30 minutes. The README states that scheduled dependency indexing uses a one-hour trailing window.

Set the fallback to 3600000. Otherwise, scheduled imports omit dependency calls from half of the documented query window.

Proposed fix
-                "value": "{{(timeframe?.unixStart && timeframe?.unixEnd) ? (timeframe.unixEnd - timeframe.unixStart) * 1000 : 1800000}}"
+                "value": "{{(timeframe?.unixStart && timeframe?.unixEnd) ? (timeframe.unixEnd - timeframe.unixStart) * 1000 : 3600000}}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"getArgs": [
{
"key": "endTs",
"value": "{{timeframe?.unixEnd ? timeframe.unixEnd * 1000 : Date.now()}}"
},
{
"key": "lookback",
"value": "{{(timeframe?.unixStart && timeframe?.unixEnd) ? (timeframe.unixEnd - timeframe.unixStart) * 1000 : 1800000}}"
}
"getArgs": [
{
"key": "endTs",
"value": "{{timeframe?.unixEnd ? timeframe.unixEnd * 1000 : Date.now()}}"
},
{
"key": "lookback",
"value": "{{(timeframe?.unixStart && timeframe?.unixEnd) ? (timeframe.unixEnd - timeframe.unixStart) * 1000 : 3600000}}"
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/Jaeger/v1/dataStreams/dependencies.json` around lines 20 - 28, Update
the lookback fallback in the getArgs configuration to 3600000 milliseconds when
timeframe?.unixStart and timeframe?.unixEnd are unavailable, while preserving
the existing calculated duration for valid timeframes.

],
"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
}
]
},
{
"name": "source",
"displayName": "Source",
"shape": "string",
"visible": false
}
]
}
41 changes: 41 additions & 0 deletions plugins/Jaeger/v1/dataStreams/operations.json
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"
}
]
}
83 changes: 83 additions & 0 deletions plugins/Jaeger/v1/dataStreams/scripts/traces.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// 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 attrsToObject(attributes) {
const obj = {};
(attributes || []).forEach((a) => {
const value = a.value || {};
obj[a.key] =
value.stringValue ??
value.intValue ??
value.doubleValue ??
value.boolValue;
});
Comment on lines +27 to +36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

file="plugins/Jaeger/v1/dataStreams/scripts/traces.js"
printf '%s\n' "== target file =="
cat -n "$file" | sed -n '1,140p'

printf '%s\n' "== related Jaeger data-stream files =="
git ls-files 'plugins/Jaeger/v1/dataStreams/*' | sed -n '1,160p'

printf '%s\n' "== attrsToObject usages and attribute fixtures =="
rg -n -S 'attrsToObject|attributes|bytesValue|arrayValue|kvlistValue|intValue|doubleValue|boolValue' \
  plugins/Jaeger/v1/dataStreams plugins/Jaeger/v1 2>/dev/null | sed -n '1,240p'

Repository: squaredup/plugins

Length of output: 5749


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' "== traces data-stream schema around attributes =="
cat -n plugins/Jaeger/v1/dataStreams/traces.json | sed -n '80,125p'

printf '%s\n' "== plugin metadata and version references =="
fd -i 'metadata.json' plugins/Jaeger | while read -r f; do
    printf '\n%s\n' "[$f]"
    cat -n "$f" | sed -n '1,100p'
done

printf '%s\n' "== standalone behavior probe =="
node - <<'JS'
function attrsToObject(attributes) {
    const obj = {};
    (attributes || []).forEach((a) => {
        const value = a.value || {};
        obj[a.key] =
            value.stringValue ??
            value.intValue ??
            value.doubleValue ??
            value.boolValue;
    });
    return obj;
}

const input = [
    { key: "bytes", value: { bytesValue: "AQI=" } },
    {
        key: "array",
        value: { arrayValue: { values: [
            { stringValue: "x" },
            { intValue: "7" }
        ] } }
    },
    {
        key: "map",
        value: { kvlistValue: { values: [
            { key: "nested", value: { boolValue: true } }
        ] } }
    }
];

const output = attrsToObject(input);
console.log("object:", JSON.stringify(output));
console.log("bytes:", output.bytes);
console.log("array:", output.array);
console.log("map:", output.map);
console.log("serialized:", JSON.stringify({ attributes: output }));
JS

Repository: squaredup/plugins

Length of output: 3210


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' "== changed files =="
git diff --name-only

printf '%s\n' "== change summary =="
git diff --stat

printf '%s\n' "== metadata change, if any =="
git diff -- plugins/Jaeger/v1/metadata.json

Repository: squaredup/plugins

Length of output: 226


Preserve non-scalar OTLP attributes.

attrsToObject handles only scalar AnyValue variants. Valid bytesValue, arrayValue, and kvlistValue attributes become undefined, so JSON serialization omits them from the attributes field. Implement a recursive AnyValue converter and add fixtures for each non-scalar variant.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/Jaeger/v1/dataStreams/scripts/traces.js` around lines 27 - 36, Update
attrsToObject to recursively convert every OTLP AnyValue variant, including
bytesValue, arrayValue elements, and kvlistValue entries, while preserving
existing scalar conversions. Ensure non-scalar values remain present and
correctly nested in serialized attributes, and add fixtures covering each
non-scalar variant.

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),
};
});
});
});
25 changes: 25 additions & 0 deletions plugins/Jaeger/v1/dataStreams/services.json
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"
}
]
}
113 changes: 113 additions & 0 deletions plugins/Jaeger/v1/dataStreams/traces.json
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
}
]
}
12 changes: 12 additions & 0 deletions plugins/Jaeger/v1/defaultContent/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"items": [
{
"name": "overview",
"type": "dashboard"
},
{
"name": "service",
"type": "dashboard"
}
]
}
Loading
Loading