Socket
Socket
Sign inDemoInstall

@opentelemetry/instrumentation-document-load

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-document-load

OpenTelemetry instrumentation for document load operations in browser applications


Version published
Weekly downloads
114K
decreased by-13.95%
Maintainers
3
Weekly downloads
 
Created

What is @opentelemetry/instrumentation-document-load?

@opentelemetry/instrumentation-document-load is an npm package that provides automatic instrumentation for document load events in web applications. It helps in capturing and reporting performance metrics related to the loading of web pages, which can be useful for monitoring and optimizing the performance of web applications.

What are @opentelemetry/instrumentation-document-load's main functionalities?

Automatic Instrumentation of Document Load

This feature allows you to automatically instrument document load events. The code sample demonstrates how to set up the instrumentation using the `DocumentLoadInstrumentation` class and `registerInstrumentations` function.

const { DocumentLoadInstrumentation } = require('@opentelemetry/instrumentation-document-load');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');

registerInstrumentations({
  instrumentations: [
    new DocumentLoadInstrumentation(),
  ],
});

Custom Span Attributes

This feature allows you to add custom attributes to the spans created during document load events. The code sample shows how to use the `applyCustomAttributesOnSpan` option to set a custom attribute on the span.

const { DocumentLoadInstrumentation } = require('@opentelemetry/instrumentation-document-load');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');

const documentLoadInstrumentation = new DocumentLoadInstrumentation({
  applyCustomAttributesOnSpan: (span) => {
    span.setAttribute('custom_attribute', 'value');
  },
});

registerInstrumentations({
  instrumentations: [documentLoadInstrumentation],
});

Other packages similar to @opentelemetry/instrumentation-document-load

Keywords

FAQs

Package last updated on 06 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc