This Chrome extension injects the Honeycomb OpenTelemetry web SDK into specified pages based on a user-defined pattern. It includes options to enable or disable the injection and to configure the necessary API key and service name.
- Injects Honeycomb OpenTelemetry SDK into pages that match a user-defined pattern
- Allows users to configure API key and service name for the SDK
- Toggle to enable or disable the injection
- Node.js and npm installed on your system
- Chrome browser
-
Clone the Repository
git clone https://github.com/McSick/honeycomb-web-injector.git cd honeycomb-web-injector
-
Load the Extension into Chrome
- Open Chrome and navigate to
chrome://extensions/
- Enable "Developer mode" using the toggle switch in the top right corner
- Click "Load unpacked" and select the directory of your extension
- Open Chrome and navigate to
-
Install Dependencies
npm install --save @honeycombio/opentelemetry-web @opentelemetry/auto-instrumentations-web npm install --save-dev webpack webpack-cli babel-loader @babel/core @babel/preset-env
-
Build the Project
npx webpack
-
Load the Extension into Chrome
- Open Chrome and navigate to
chrome://extensions/
- Enable "Developer mode" using the toggle switch in the top right corner
- Click "Load unpacked" and select the directory of your extension
- Open Chrome and navigate to
-
Open the Options Page
Click on the extension icon in the Chrome toolbar, and then click on "Options".
-
Configure the Extension
- URL Pattern: Enter the URL pattern to match the pages where the SDK should be injected.
- API Key: Enter your Honeycomb Ingest API key.
- Service Name: Enter the name of your service.
- Enable Injection: Toggle to enable or disable the script injection.
-
Save the Configuration
After entering the required information, click "Save". The extension will now inject the SDK into the pages that match the specified pattern, provided the injection is enabled.
manifest.json
: Defines the extension’s properties and permissions.background.js
: Handles the background processes and injects content scripts.content.js
: Injects the SDK bundle and communicates with the page.options.html
: The options page for configuring the extension.options.js
: Handles the logic for the options page.src/tracing.js
: Contains the tracing logic and exposes thestartTracing
function.webpack.config.js
: Webpack configuration for bundling thetracing.js
.
- Install Dependencies:
npm install
- Build the Project:
npx webpack
- Modify the relevant files in the
src
directory. - Rebuild the project using
npx webpack
. - Reload the extension in Chrome to apply the changes.
- Ensure that all required fields in the options page are correctly filled.
- Check the Chrome Developer Tools console for any error messages or logs.
- Ensure that the pattern matches the URL of the pages where you want to inject the SDK.
If you would like to contribute to this project, please fork the repository and submit a pull request with your changes.