|
7 | 7 | main config (which has no <http_handlers>). Built-in hardcoded handlers |
8 | 8 | (/ping, /replicas_status, /play, etc.) remain available as fallbacks. |
9 | 9 |
|
10 | | - Endpoint: GET /events?composition_id=<id>[&limit=50] |
| 10 | + Endpoint: GET /events?composition_id=<uid>[&limit=50] |
11 | 11 | Returns: FORMAT JSON rows; transformed into SSEK8sEvent by the RESTAction |
12 | 12 | JQ filter in restaction.composition-events.yaml. |
13 | 13 | Mount at: /etc/clickhouse-server/config.d/http-handlers.xml |
|
21 | 21 |
|
22 | 22 | <!-- ================================================================ |
23 | 23 | Custom: Krateo K8s events endpoint |
24 | | - GET /events?composition_id=<id>[&limit=50] |
25 | | - {composition_id:String} is read from the URL query parameter. |
| 24 | + GET /events?composition_id=<uid>[&limit=50] |
| 25 | + {composition_id:String} is the composition resource's UID, |
| 26 | + matching the value of label krateo.io/composition-id on managed |
| 27 | + resources. |
26 | 28 |
|
27 | | - k8sobjects receiver stores events as raw Kubernetes watch JSON in Body: |
28 | | - Body = {"object": {"reason":"...", "message":"...", "type":"Normal|Warning", |
29 | | - "involvedObject": {"name":"...", "namespace":"...", |
30 | | - "kind":"...", "uid":"..."}, |
31 | | - "eventTime":"...", ...}, "type":"ADDED|MODIFIED"} |
| 29 | + The compositionresolver OTel processor enriches each K8s event |
| 30 | + log record with a LogAttribute "krateo.io/composition-id" by |
| 31 | + resolving the involvedObject via the K8s API — the same logic |
| 32 | + the old EventRouter performed. |
32 | 33 |
|
33 | | - We filter by k8s.namespace.name (ResourceAttribute set by the k8sobjects |
34 | | - receiver from the event's metadata.namespace), which maps to the Krateo |
35 | | - composition namespace. Event fields are extracted with JSONExtractString. |
| 34 | + Event fields are extracted from the raw K8s watch JSON in Body |
| 35 | + using JSONExtractString. |
36 | 36 | ================================================================ --> |
37 | 37 | <rule> |
38 | 38 | <url>/events</url> |
|
56 | 56 | ifNull(JSONExtractString(Body, 'object', 'source', 'component'), '') AS source_component |
57 | 57 | FROM otel_logs |
58 | 58 | WHERE ResourceAttributes['telemetry.source'] = 'k8s-events' |
59 | | - AND ResourceAttributes['k8s.namespace.name'] = {composition_id:String} |
| 59 | + AND LogAttributes['krateo.io/composition-id'] = {composition_id:String} |
60 | 60 | AND JSONExtractString(Body, 'object', 'reason') != '' |
61 | 61 | ORDER BY Timestamp DESC |
62 | 62 | LIMIT 50 |
|
0 commit comments