Coder Social home page Coder Social logo

honeycomb-web-injector's Introduction

OpenTelemetry Injector Chrome Extension

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.

Features

  • 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

Setup

Prerequisites

  • Node.js and npm installed on your system
  • Chrome browser

Installation

  1. Clone the Repository

    git clone https://github.com/McSick/honeycomb-web-injector.git
    cd honeycomb-web-injector
  2. Load the Extension into Chrome

    1. Open Chrome and navigate to chrome://extensions/
    2. Enable "Developer mode" using the toggle switch in the top right corner
    3. Click "Load unpacked" and select the directory of your extension

Building if making changes

  1. 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
  2. Build the Project

    npx webpack
  3. Load the Extension into Chrome

    1. Open Chrome and navigate to chrome://extensions/
    2. Enable "Developer mode" using the toggle switch in the top right corner
    3. Click "Load unpacked" and select the directory of your extension

Usage

  1. Open the Options Page

    Click on the extension icon in the Chrome toolbar, and then click on "Options".

  2. 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.
  3. 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.

Development

File Structure

  • 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 the startTracing function.
  • webpack.config.js: Webpack configuration for bundling the tracing.js.

Build Commands

  • Install Dependencies: npm install
  • Build the Project: npx webpack

Adding a New Feature

  1. Modify the relevant files in the src directory.
  2. Rebuild the project using npx webpack.
  3. Reload the extension in Chrome to apply the changes.

Troubleshooting

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

Contributing

If you would like to contribute to this project, please fork the repository and submit a pull request with your changes.

honeycomb-web-injector's People

Contributors

mcsick avatar

Stargazers

Kyle Moonwright avatar Howard Yoo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.