sensu / sensu-go

Simple. Scalable. Multi-cloud monitoring.
https://sensu.io
MIT License
1.01k stars 177 forks source link

Reorder proxy entity state and config creation #4998

Closed c-kruse closed 1 year ago

c-kruse commented 1 year ago

Eventd creates proxy entities when they are contained in an event but do not already exist. Avoid a SQL NOT NULL constraint by creating the entity config before entity state.

Found in staging from this log line

{
  "check_name": "proxy-check",
  "check_namespace": "default",
  "component": "eventd",
  "entity_name": "staging-agent-0-managed-entity",
  "entity_namespace": "default",
  "error": "internal error: ERROR: null value in column \"entity_config_id\" violates not-null constraint (SQLSTATE 23502)",
  "event_id": "2cc79025-b6ed-403b-ae4a-b8e858300ce8",
  "level": "error",
  "msg": "error handling event from event channel",
  "time": "2023-04-24T22:51:54Z"
}