Skip to content

Allow injecting into non-dependency code #14

Description

@timfish

Currently the module matching only allows you to inject code by matching module name, versions and file path:
https://github.com/DataDog/orchestrion-js/blob/d7d7a8bb84906d801201d32661eaa0dcdbc643a1/src/config.rs#L60-L63

My assumption has been that file_path here is the path relative from the module root!

The above covers most Open Telemetry instrumentations but it does leave some gaps. For example, there are some instrumentations that use absolute paths to match users own source files.

In #11, where I tightened up the configuration types, I moved the module matching to its own enum:

pub struct ModuleMatcher {
    pub name: String,
    pub version_range: Range,
    pub file_path: PathBuf,
}

We should probably change this to an enum to support other ways to match where to inject instrumentation code:

pub enum CodeMatcher {
    Dependency {
        name: String,
        version_range: Range,
        file_path: PathBuf,
    },
    AbsolutePaths {
        paths: Vec<PathBuf>,
    }, 
    // we could also support globs or other ways to match user code...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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