October 22nd, 2024
We are thrilled to announce the release of version 0.2.1 of our NPM package!
This version includes:
Deprecation of startOtel
Exporter protocol configuration support
Disabling instrumentations
Next.js performance and onboarding improvements
Vercel serverless environment support
startOtel
Previously, the SDK was initialized using:
import { startOtel } from '@infrastack/otel';
startOtel({ serviceName: 'my-service' });
However, we noticed this approach lacked flexibility. For example, if we wanted to introduce a new functionality foo
, any existing function or variable named foo
could create ambiguity. Therefore, SDK initialization has been updated to:
import { Infrastack } from "@infrastack/otel";
Infrastack.init({
serviceName: "YOUR_SERVICE_NAME",
});
In earlier versions, the SDK only used GRPC exporters. To provide more configuration options and overcome platform-specific issues, we now support HTTP protobuf. By default, the SDK will still use the GRPC exporter, but for Vercel-deployed Next.js applications or other users without GRPC support, HTTP can be configured using an enumerated option:
import { Infrastack, Protocol } from "@infrastack/otel";
Infrastack.init({
serviceName: "YOUR_SERVICE_NAME",
protocol: Protocol.HTTP
});
Please, refer to the documentation for more detailed information.
This update introduces the ability to disable specific instrumentations:
import { Infrastack, Instrumentation } from "@infrastack/otel";
Infrastack.init({
serviceName: "YOUR_SERVICE_NAME",
disabledInstrumentations: [Instrumentation.MYSQL, Instrumentation.HTTP]
});
Please, refer to the documentation for more detailed information.
Previously, onboarding for Next.js was cumbersome and prone to errors.
Earlier configuration (next.config.mjs
):
const nextConfig = {
experimental: {
instrumentationHook: true, // Enable instrumentation
serverComponentsExternalPackages: [
"@opentelemetry/auto-instrumentations-node",
"@opentelemetry/sdk-node",
],
},
};
export default nextConfig;
New configuration:
const nextConfig = {
experimental: {
instrumentationHook: true, // Enable instrumentation
},
};
export default nextConfig;
We have also reduced runtime errors from OpenTelemetry-related modules by selectively wrapping them and using a more refined approach. We removed reliance on @opentelemetry/auto-instrumentations-node
and @opentelemetry/sdk-node
in favor of a more direct integration.
We now fully support serverless applications deployed to Vercel under the Node.js runtime. Previously, some traces were not exported due to the lack of HTTP protobuf support and challenges with interpreting Vercel's Request Context. This update addresses those issues.
For a detailed guide on deploying Next.js applications to Vercel with OpenTelemetry, see our guide.
We believe this update addresses critical issues, and we will continue improving! đ
Need help or have suggestions? Reach out to us at [email protected] or visit our community forum.