Skip to content

Commit

Observability's request search finds a request by its route as well as its address. Software outside g1t.page often reports only http.route on its server spans, so its requests had no address to match and a search for a path found nothing.

syntaqxcommitted Parentac8b3daBrowse files
2 files+10−10/2 viewed
+8−0
208208 const trace = store.trace(TRACE)!;
209209 assert.deepEqual(trace.spans.map((s) => [s.name, s.parent_span_id]), [["GET /users/:id", null], ["db.query", "ddddddddddddddd1"]]);
210210 assert.equal(trace.logs[0].body, "in handler");
211+ // Found by its route too: an OTLP server span often has no address.
212+ const { secret: other } = await store.createToken("prj_1", "api", null);
213+ await store.ingest(
214+ readTraces({ resourceSpans: [{ resource: { attributes: [{ key: "service.name", value: { stringValue: "billing" } }] }, scopeSpans: [{ spans: [{ traceId: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", spanId: "bbbbbbbbbbbbbbbb", name: "POST", kind: 2, startTimeUnixNano: `${NOW_MS}000000`, attributes: [{ key: "http.route", value: { stringValue: "/invoices" } }] }] }] }] }, OTLP_DOOR, 10),
215+ [],
216+ other,
217+ );
218+ assert.equal(store.requests({ text: "invoices" }).items.length, 1);
211219 const list = store.traces({});
212220 assert.equal(list.items[0].trace_id, TRACE);
213221 assert.equal(list.items[0].name, "GET /users/:id");
+2−1
660660 const { clauses, args } = this.filter(q, "time_us");
661661 const { words, pairs } = parseSearch(q.text);
662662 this.pairs(pairs, ["method", "route", "status", "outcome", "region", "country", "trace_id", "service", "environment", "deployment_id", "commit_sha", "trigger"], clauses, args, "");
663− for (const w of words) clauses.push("(url LIKE ? OR error_message LIKE ? OR error_name LIKE ?)"), args.push(`%${w}%`, `%${w}%`, `%${w}%`);
663+ // Software outside g1t.page often reports a route and no address: both are searched.
664+ for (const w of words) clauses.push("(url LIKE ? OR route LIKE ? OR error_message LIKE ? OR error_name LIKE ?)"), args.push(`%${w}%`, `%${w}%`, `%${w}%`, `%${w}%`);
664665 if (q.status?.length) {
665666 const parts: string[] = [];
666667 for (const s of q.status) {