
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@ogcio/fastify-o11y
Advanced tools
This Fastify plugin enhances observability by:
x-trace-id header to responses using OpenTelemetry tracing.Ensure you have Fastify and @ogcio/o11y-sdk-node installed in your project with version >= 0.1.0-beta.8
npm install fastify @ogcio/o11y-sdk-node @ogcio/fastify-o11y
Import and register the plugin in your Fastify server:
import fastify from "fastify";
import observabilityPlugin from "@ogcio/fastify-o11y";
const app = fastify();
app.register(observabilityPlugin);
app.get("/", async () => {
return { message: "Hello, world!" };
});
app.listen({ port: 3000 }, () => {
console.log("Server running on http://localhost:3000");
});
This plugin adds the x-trace-id header to responses, extracted from the active OpenTelemetry span.
The plugin uses getMetric to track HTTP response counts, recording status codes:
const httpResponsesCounter = getMetric<"counter", { status_code: number }>(
"counter",
{
meterName: "http.server.responses",
metricName: "http.server.responses",
}
);
Each request updates the counter in the onResponse hook:
server.addHook("onResponse", (_request, reply, done) => {
try {
httpResponsesCounter.add(1, { status_code: reply.statusCode });
} finally {
done();
}
});
The plugin traces errors by default using an onError hook:
Disable through the plugin config by explicitly setting traceErrors to false:
app.register(observabilityPlugin, { traceErrors: false });
onRequest Hook: Extracts the trace ID and attaches it to the response headers.onResponse Hook: Increments the HTTP response counter with the response status code.onError Hook: Extracts error info from FastifyError and injects them in current active span as spanAttributes, events, and exception.FAQs
Custom fastify plugin for OGCIO Observability
We found that @ogcio/fastify-o11y 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.