Skip to content

[followup] AST walker resolveIncErrorCall: handle CallExpr cast form #137

Description

@trilamsr

Source: docs/followups/opportunistic.md row 8 (Next up).

runbook_kinds_test.go::resolveIncErrorCall (in components/receivers/kernelevents/) resolves IncError(kindFoo) (*ast.Ident) and IncError(selftelemetry.KindBar) (*ast.SelectorExpr) but not IncError(selftelemetry.Kind("foo")) (*ast.CallExpr cast). The kind would slip past the RUNBOOK parity check.

Trigger status (FIRED): call sites of selftelemetry.Kind("...") already exist in:

  • internal/selftelemetry/capturing_test.go:52
  • components/exporters/otlphttp/classify_internal_test.go:23,33,38

(None are inside an IncError(...) argument today, but the AST walker should still handle the cast form before a future caller introduces it.)

Files:

  • components/receivers/kernelevents/runbook_kinds_test.go — extend resolveIncErrorCall switch with *ast.CallExpr case, recognize selftelemetry.Kind("literal").
  • Same file in any other receiver that copies the pattern.

Acceptance:

  • Adding a test fixture IncError(selftelemetry.Kind("test_kind")) in receiver.go surfaces "test_kind" in extractEmittedKinds.
  • Existing RUNBOOK parity test still passes.

Note: the original follow-up cited the file as components/receivers/dcgm/runbook_kinds_test.go; correct path is components/receivers/kernelevents/runbook_kinds_test.go. DCGM uses docs_parity_test.go for an equivalent walker; both should grow the CallExpr handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions