Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@opentelemetry/instrumentation-long-task
Advanced tools
OpenTelemetry long task API automatic instrumentation package.
This instrumentation creates spans from tasks that take more than 50 milliseconds using the Long Task API.
All of the data reported via PerformanceLongTaskTiming
is included as span attributes.
Compatible with OpenTelemetry JS API and SDK 1.0+
.
npm install --save @opentelemetry/instrumentation-long-task
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import { LongTaskInstrumentation } from '@opentelemetry/instrumentation-long-task';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
const provider = new WebTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
registerInstrumentations({
tracerProvider: provider,
instrumentations: [
new LongTaskInstrumentation({
// see under for available configuration
}),
],
});
Options | Type | Description |
---|---|---|
observerCallback | ObserverCallback | Callback executed on observed longtask , allowing additional attributes to be attached to the span. |
The observerCallback
function is passed the created span and the longtask
PerformanceEntry
,
allowing the user to add custom attributes to the span with any logic.
For example, a webapp with client-side routing can add contextual information on the current page,
even if the tracer was instantiated before navigation.
Usage Example:
longtaskInstrumentationConfig = {
observerCallback: (span, longtaskEvent) => {
span.setAttribute('location.pathname', window.location.pathname)
}
}
Apache 2.0 - See LICENSE for more information.
FAQs
OpenTelemetry instrumentation for long task Web API
The npm package @opentelemetry/instrumentation-long-task receives a total of 9,765 weekly downloads. As such, @opentelemetry/instrumentation-long-task popularity was classified as popular.
We found that @opentelemetry/instrumentation-long-task demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.