Build Route node QN and properties for HTTP/async service edges. */
| 1591 | |
| 1592 | /* Build Route node QN and properties for HTTP/async service edges. */ |
| 1593 | static int64_t build_service_route(cbm_gbuf_t *gbuf, const char *arg, const char *method, |
| 1594 | const char *broker, cbm_svc_kind_t svc) { |
| 1595 | char route_qn[CBM_ROUTE_QN_SIZE]; |
| 1596 | const char *prefix; |
| 1597 | char cpath[CBM_SZ_256]; |
| 1598 | const char *qpath = arg; |
| 1599 | if (svc == CBM_SVC_HTTP) { |
| 1600 | prefix = method ? method : "ANY"; |
| 1601 | qpath = cbm_route_canon_path(arg, cpath, sizeof(cpath)); |
| 1602 | } else { |
| 1603 | prefix = broker ? broker : "async"; |
| 1604 | } |
| 1605 | snprintf(route_qn, sizeof(route_qn), "__route__%s__%s", prefix, qpath); |
| 1606 | char route_props[CBM_SZ_256]; |
| 1607 | if (method) { |
| 1608 | snprintf(route_props, sizeof(route_props), "{\"method\":\"%s\"}", method); |
| 1609 | } else if (broker) { |
| 1610 | snprintf(route_props, sizeof(route_props), "{\"broker\":\"%s\"}", broker); |
| 1611 | } else { |
| 1612 | snprintf(route_props, sizeof(route_props), "{}"); |
| 1613 | } |
| 1614 | return cbm_gbuf_upsert_node(gbuf, "Route", arg, route_qn, "", 0, 0, route_props); |
| 1615 | } |
| 1616 | |
| 1617 | /* Emit HTTP_CALLS or ASYNC_CALLS edge via Route node. */ |
| 1618 | static void emit_http_async_service_edge(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source, |
no test coverage detected