Skip to content

Building projects with older grpc versions than instrumentation dependencies causes build failures #494

@amazingakai

Description

@amazingakai

Describe the bug

Building a project that depends on an older google.golang.org/grpc version than the one used by pkg/instrumentation/grpc can fail during instrumentation.

otelc setup initially matches rules against the user's current dependency graph. Later, after instrumentation dependencies are added and go mod tidy runs, the dependency graph may change (for example grpc being bumped).

However, the previously matched rules are still stored using source file paths from the old dependency graph. During instrumentation, this causes stale file paths to be used against newer compile targets and results in build failures.

Environment

  • OS: Fedora Linux
  • Go Version: 1.25.9
  • Version: main

To Reproduce

Steps to reproduce the behavior:

  1. Create a project using google.golang.org/grpc older than v1.80.0 (version from pkg/instrumentation/grpc)
  2. Run otelc go build
  3. Build will fail

Expected behavior

Instrumentation should refresh dependency matching after syncing instrumentation dependencies so matched source file paths always correspond to the final resolved dependency graph.

Additional context

This happens because pkg/instrumentation/grpc introduces newer grpc dep during setup, causing go mod tidy to update the dependency graph after rule matching has already completed.

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions