
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@opens/observability
Advanced tools
@opens/observability
is a lightweight wrapper over popular instrumentation agents like Elasticsearch APM and OpenTelemetry. It provides a unified API to set up and use tracing, making it easier to integrate observability into your application.
npm install elastic-apm-node @opens/observability
You need to configure the observer before using it.
import { observer, TRACE_PROVIDER, LOG_LEVEL_TYPES } from "@opens/observability";
observer.setup({
provider: TRACE_PROVIDER.APM, // Use TRACE_PROVIDER.OTEL for OpenTelemetry
logLevel: LOG_LEVEL_TYPES.INFO, // Set log level (DEBUG, INFO, WARN, ERROR) - Optional
config: {
serviceName: "my-service",
serverUrl: "http://localhost:8200", // Elastic APM Server URL,
secretToken: '<secretToken from your Elastic Stack deployment>',
environment: '...', // https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html#environment
},
});
Wrap a function with tracing using instrumentFunc
.
const tracedFunction = observer.tracer.instrumentFunc(
{ name: "fetchData", type: "custom" },
async () => {
console.log("Fetching data...");
return "Data retrieved";
}
);
tracedFunction().then(console.log);
TRACE_PROVIDER
TRACE_PROVIDER.APM
→ Uses Elastic APM for tracing.TRACE_PROVIDER.OTEL
→ Uses OpenTelemetry for tracing.LOG_LEVEL_TYPES
DEBUG
INFO
WARN
ERROR
You can pass a configuration object when setting up the tracer. The configuration varies depending on the provider:
{
serviceName: "my-service",
secretToken: "my-secret",
serverUrl: "http://localhost:8200",
}
{
resource: { serviceName: "my-otel-service" }
}
MIT
FAQs
A package for tracing node applications
We found that @opens/observability demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.