Skip to main content

Overview

@kubiks/otel-autumn provides comprehensive OpenTelemetry instrumentation for the Autumn billing SDK. Capture spans for every billing operation including feature checks, usage tracking, checkout flows, product attachments, and cancellations with detailed metadata.
Autumn Trace Visualization
Visualize your billing operations with detailed span information including operation type, customer IDs, feature IDs, and billing metadata.

Installation

Peer Dependencies: @opentelemetry/api >= 1.9.0, autumn-js >= 0.1.0

Quick Start

instrumentAutumn wraps your Autumn client instance—no configuration changes needed. Every SDK call creates a client span with detailed billing attributes.

Traced Operations

This instrumentation wraps the core Autumn billing methods:

check

Feature access and product status checks

track

Usage event tracking

checkout

Checkout session creation

attach

Product attachment to customers

cancel

Product cancellation
Each operation creates a dedicated span with operation-specific attributes.

Span Attributes

Common Attributes (All Operations)

Check Operation

Track Operation

Checkout Operation

Attach Operation

Cancel Operation

Configuration

You can optionally configure the instrumentation:
By default, sensitive customer data is not captured. Enable captureCustomerData only if your observability platform is secure and compliant.

Usage Examples

Feature Access Control

Usage Tracking

Checkout Flow

Product Management

Complete Integration Example

Here’s a complete example integrating Autumn with a Next.js application:
lib/autumn.ts
app/api/features/check/route.ts
app/api/usage/track/route.ts

Best Practices

Always use idempotency keys when tracking usage to prevent double-counting:
Check feature access before performing operations:
Handle both checkout URLs and direct product attachments:
Only enable additional data capture in secure environments:

Troubleshooting

Make sure OpenTelemetry is properly configured in your application:
Ensure you’re using the latest version of the package:
The instrumentation adds minimal overhead. If you experience issues:
  • Verify your OpenTelemetry exporter is configured correctly
  • Check if you’re using sampling to reduce data volume
  • Consider using batch span processors

Resources

Autumn Documentation

Learn more about Autumn billing

GitHub Repository

View source code and examples

npm Package

View package on npm

Report Issues

Found a bug? Let us know!

License

MIT