Skip to content

feat(cli): warn when no instrumentation rules match during build #505

@beep-boopp

Description

@beep-boopp

Problem

I noticed this while working on the --debug flag fix (#499) and reading through the match pipeline.

When instrumentation rules match nothing, otelc completes successfully with no user-visible feedback. This results in an uninstrumented binary without any indication that rules were ineffective.

Reproduction

  1. Create a rule with an incorrect target (e.g. typo in package path — net/htp instead of net/http)
  2. Run: otelc --rules broken.yaml go build -o app .

Observed behavior

  • Exit code 0
  • No output on stdout/stderr
  • .otelc-build/matched.json contains []
  • debug.log shows "Found available rules""Stored matched sets" with no indication that zero matches occurred

Even in debug mode, a zero-match outcome is only observable by the absence of "Match ..." log lines.

Expected behavior

Users should receive an explicit warning when no rules match, since this commonly indicates misconfiguration (typos, version mismatches, renamed functions, outdated targets).

Proposal

Emit a warning to stderr when matchDeps returns empty, e.g.:

0 rules matched — no instrumentation will be applied.

This is a small, low-risk change that provides immediate feedback to users. Happy to open a PR.

This could also open the door to something like otelc list down the line, a read-only command to preview what rules match without building, but that's a separate discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions