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.
2 files+10−10/2 viewed
| 208 | 208 | const trace = store.trace(TRACE)!; | |
| 209 | 209 | assert.deepEqual(trace.spans.map((s) => [s.name, s.parent_span_id]), [["GET /users/:id", null], ["db.query", "ddddddddddddddd1"]]); | |
| 210 | 210 | 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); | |
| 211 | 219 | const list = store.traces({}); | |
| 212 | 220 | assert.equal(list.items[0].trace_id, TRACE); | |
| 213 | 221 | assert.equal(list.items[0].name, "GET /users/:id"); |
| 660 | 660 | const { clauses, args } = this.filter(q, "time_us"); | |
| 661 | 661 | const { words, pairs } = parseSearch(q.text); | |
| 662 | 662 | 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}%`); | |
| 664 | 665 | if (q.status?.length) { | |
| 665 | 666 | const parts: string[] = []; | |
| 666 | 667 | for (const s of q.status) { |