Skip to content

alarm: clarify queryAlarms entity / layer semantics (doc only)#158

Closed
wu-sheng wants to merge 1 commit into
apache:masterfrom
wu-sheng:alarm-doc-clarify-entity-layer-semantics
Closed

alarm: clarify queryAlarms entity / layer semantics (doc only)#158
wu-sheng wants to merge 1 commit into
apache:masterfrom
wu-sheng:alarm-doc-clarify-entity-layer-semantics

Conversation

@wu-sheng

Copy link
Copy Markdown
Member

Summary

Doc-only fix to alarm.graphqls so the schema text matches how the OAP backend actually filters queryAlarms.

What was inaccurate

  • Relation-entity match: the previous doc said a relation entity ({ServiceRelation, A→B}) matches alarms 'whether the entity appears as the source or the dest of the relation' — implying id0 OR id1. The actual OAP backend uses strict AND (id0=src AND id1=dest), which makes the relation filter narrow to one specific edge. Operators who want 'any alarm involving service A' should pass the non-relation {Service A} entity (which expands to id0=A OR id1=A).
  • Layer match: the previous doc said 'a service observed under multiple normal layers (e.g., GENERAL + K8S_SERVICE) matches when any one of them is in the list' — implying multi-value storage. The OAP alarm record actually stores ONE layer per row (the alphabetically first when the alarmed service has multiple layers), so a service in [GENERAL, K8S_SERVICE] is filed under GENERAL and only layers: [\"GENERAL\"] matches it.

Why doc-only

Both issues are cosmetic — the GraphQL types, names, and arguments are unchanged. The fix replaces the misleading prose so:

  • API consumers don't expect broader matches than they get.
  • The single-layer-per-row reality is documented for operators that need it.

The narrowing for relations is a deliberate OAP design choice (per-entity AND/OR semantics in the storage DAO) and shouldn't be changed without breaking the relation-filter contract.

No schema breakage

Test plan

  • No backend changes needed — text-only fix
  • Confirm reading the doc top-to-bottom matches the apache/skywalking 11.0.0 behavior

🤖 Generated with Claude Code

Updates the AlarmQueryCondition input type doc to match how the OAP
backend actually filters:

* Relation entities (ServiceRelation, ServiceInstanceRelation, etc.)
  do EXACT match on (id0=src AND id1=dest). The previous doc said
  the entity 'matches whether it appears as the source or the dest',
  which would imply id0 OR id1 — actual behaviour is the strict AND.
  Operators wanting 'anything involving service A' should pass a
  non-relation Entity {Service A} (which expands to id0=A OR id1=A).

* Layer matching is single-value-per-row. An alarm record stores ONE
  layer (the alphabetically first when the alarmed service has multiple
  layers). The previous doc implied multi-value matching ('matches when
  any one is in the list'), but the persisted value is a scalar.

Doc-only change; no schema breakage.
@wu-sheng wu-sheng closed this May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant