bcquality/microsoft/knowledge/style/telemetry-event-id-stable-unique.md
Jesper Schulz-Wedde b11f3ec506 Improve PR-review parity: suggestion blocks, missing KB articles, privacy cross-ref
Adds the contract field, skill instructions, and two knowledge articles
that BCAppsBCQuality's PR-review agent needs to match (and exceed) the
coverage of the embedded review agent in BCAppsCampAIRHack:

skills/do.md
- New optional findings[].suggested-code field. Documents what it MUST
  contain (a literal line-replacement payload) and when to emit it.

microsoft/skills/review/al-code-review.md
- Instructs both the agent self-review pass and rolled-up sub-skill
  findings to populate suggested-code when the fix is mechanical.
- Lists examples (dead code removal, Count > 0 -> IsEmpty, object-scope
  Label) that map to issues observed in the parity comparison.

microsoft/knowledge/style/telemetry-event-id-stable-unique.{md,bad.al,good.al}
- New knowledge article: telemetry event IDs must be stable, unique,
  and non-placeholder. Closes a gap surfaced by the parity comparison.

microsoft/knowledge/style/labels-declared-at-object-scope.{md,bad.al,good.al}
- New knowledge article: Labels must live in the object-level var
  block, not in procedure-local var blocks. Closes the second gap.

microsoft/knowledge/privacy/no-pii-in-telemetry-message-string.md
- Adds an explicit note that changing DataClassification alone does not
  make embedding PII into the message string acceptable, plus links to
  the two adjacent privacy articles. Resolves the privacy advice the
  parity comparison flagged as ambiguous.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-27 15:45:49 +02:00

2.2 KiB

bc-version domain keywords technologies countries application-area
all
style
telemetry
logmessage
event-id
sessionlogmessage
observability
al
w1
all

Telemetry event IDs must be stable, unique, and non-placeholder

Description

The first parameter of Session.LogMessage is the event ID. Telemetry consumers — Application Insights queries, KQL dashboards, alert rules, support runbooks — pivot on this ID to filter and aggregate events. The contract works only when the ID is:

  • Stable across releases: the same logical event keeps the same ID, so existing queries continue to match it.
  • Unique within the extension's telemetry catalogue: two different events MUST NOT share an ID, or downstream consumers cannot distinguish them.
  • Non-placeholder: literal IDs like '0000', '1234', 'TODO', or 'XX0000' are placeholders that collide with other placeholder-using extensions, are unsearchable, and indicate the catalogue entry was never registered.

The convention used by Microsoft first-party AL code is a short prefix identifying the publisher or feature followed by a numeric suffix — for example 'AL0001', 'CUST0042', 'SHPFY-0007'. The exact format is up to the extension; the requirements are stability, uniqueness, and that the chosen ID is registered in whatever catalogue or wiki the extension's telemetry consumers reference.

Best Practice

Assign each Session.LogMessage call a real, registered event ID drawn from the extension's catalogue. Treat the ID as part of the public contract of the event — renaming it is a breaking change for consumers. Keep IDs short, deterministic, and free of personal or environment-specific tokens.

See sample: telemetry-event-id-stable-unique.good.al.

Anti Pattern

Calling Session.LogMessage('0000', ...) (or '1234', 'TODO', an empty string, a GUID generated at runtime, or any other placeholder) leaves the event unsearchable and indistinguishable from every other event using the same placeholder. The catalogue entry never gets created because the developer "will fix it later", and the placeholder ships.

See sample: telemetry-event-id-stable-unique.bad.al.