nodejs / nodejs/orchestrion-js

Allow injecting into non-dependency code

Open
#14 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
24
Forks
11
PR merge metrics
No merged PRs in 30d

Description

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...
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/config.rs around lines 60-63 and review the ModuleMatcher changes from #11. Trace where module matching determines injection targets, then define how dependency and absolute-path matching should be represented and handled. Done means non-dependency source files can be selected for instrumentation without breaking existing dependency matching.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.