Skip to content

Conversation

@drewcorlin1
Copy link
Contributor

@drewcorlin1 drewcorlin1 commented Jan 12, 2025

Which problem is this PR solving?

Providing a way for users to auto instrument their bundled code. Diag channels based alternative to open-telemetry/opentelemetry-js-contrib#1856.

This should supersede (and is heavily inspired by) https://github.com/open-telemetry/opentelemetry-js/pull/4818/files

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Short description of the changes

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Tested with open-telemetry/opentelemetry-js-contrib#2640.

Steps to test

  1. From this repo npm run compile
  2. From this repo create a script experimental/packages/opentelemetry-instrumentation/scripts/dev-install.sh
#!/usr/bin/env bash

if [[ ! -e package.json ]]; then
  echo 'Must be run from the directory containing package.json'
  exit 1
fi

set -e

src_root="$(dirname $0)/.."

rsync --recursive --exclude '**/node_modules/' "$src_root/build/" "node_modules/@opentelemetry/instrumentation/build"
  1. From the root of opentelemetry-js-contrib run that script (eg ../opentelemetry-js/experimental/packages/opentelemetry-instrumentation/scripts/dev-install.sh)
  2. From opentelemetry-js-contrib run npm run compile
  3. From opentelemetry-js-contrib/packages/esbuild-plugin-node/ run npm run test

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@codecov
Copy link

codecov bot commented Jan 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.56%. Comparing base (6864c2f) to head (b8c98f1).
Report is 122 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5334   +/-   ##
=======================================
  Coverage   94.56%   94.56%           
=======================================
  Files         322      322           
  Lines        8132     8132           
  Branches     1715     1715           
=======================================
  Hits         7690     7690           
  Misses        442      442           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@drewcorlin1 drewcorlin1 changed the title Esbuild plugin diag channel feat: Esbuild plugin diag channel Jan 12, 2025
NodeJS 14 support will be dropped in 2.0 of the SDKs, which will
land before this is merged
);
return;
}
const names = [message.name, message.file].filter(Boolean) as string[];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trentm this differed from your original implementation. Idea here is to handle instrumentations that patch just the top level module (eg fastify) and instrumentations that patch specific files (eg graphQL)

@github-actions
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Mar 17, 2025
@github-actions
Copy link

This PR was closed because it has been stale for 14 days with no activity.

@github-actions github-actions bot closed this Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants