Getting Started
Add SDK observability to your SDK in about 15 minutes. By the end of this guide you will have initialization rates, method call counts, and error frequencies flowing into your SDK Garden dashboard.
What you need
- An SDK Garden account at app.sdkgarden.com
- An API key from Settings → API Keys
- Your published SDK (JavaScript/TypeScript or Python)
Step 1 — Create an account and get an API key
- Sign up at app.sdkgarden.com.
- After signup your first SDK is created automatically.
- Go to Settings → API Keys and copy your key — it starts with
sgk_.
Keep the key handy; you will paste it into the SDK initializer in the next step.
Step 2 — Install the client library
- JavaScript / TypeScript
- Python
npm install sdk-garden-js
The package ships both ESM (.mjs) and CommonJS (.js) builds with full TypeScript type declarations. No peer dependencies are required.
pip install sdk-garden-python
The package is pure Python, stdlib-only, and has zero runtime dependencies.
Step 3 — Initialize the client inside your SDK
Add the initializer to the entry point of your SDK — the file users import when they install your package. Call it once at startup, not on every method call.
- JavaScript / TypeScript
- Python
import SdkGarden from 'sdk-garden-js';
// Call once when your SDK loads
SdkGarden.init({
apiKey: 'sgk_YOUR_KEY_HERE',
sdkName: 'my-payments-sdk', // the name of YOUR sdk
sdkVersion: '1.2.3', // YOUR sdk's current version
});
from sdk_garden import SdkGarden
# Call once when your SDK loads
sg = SdkGarden(
api_key='sgk_YOUR_KEY_HERE',
sdk_name='my-payments-sdk', # the name of YOUR sdk
sdk_version='1.2.3', # YOUR sdk's current version
).start()
sdk_initialized is automatically enqueued on init and will appear in your dashboard within a few seconds of your first user running the SDK.
Step 4 — Wrap key methods with telemetry
trackMethod / track_method is the fastest way to get method-level analytics. It records every call, its duration, and whether it succeeded or raised an error — with zero changes to your method's signature or behavior.
- JavaScript / TypeScript
- Python
class PaymentsSDK {
@SdkGarden.trackMethod('processPayment')
processPayment(amount: number): Receipt {
// your existing implementation — no changes needed here
}
}
For standalone functions, use the wrapper form instead:
function processPayment(amount: number): Receipt { ... }
export const tracked = SdkGarden.trackMethod('processPayment', processPayment);
# Use as a decorator on any method
@sg.track_method('process_payment')
def process_payment(amount: float) -> dict:
...
Works on class methods too:
class PaymentsClient:
@sg.track_method('charge')
def charge(self, amount: float) -> dict:
...
Each wrapped method automatically emits:
method_called— on every invocationmethod_success— when it returns successfully, including durationsdk_error— when it raises an exception (the exception is re-raised to your caller)
Step 5 — Track errors from try/catch blocks
For errors caught in your own try/catch blocks, call trackError directly:
- JavaScript / TypeScript
- Python
try {
await connectToService(config);
} catch (err) {
SdkGarden.trackError(err as Error, { context: 'connection-setup' });
throw err; // re-raise — SDK Garden never swallows your errors
}
try:
connect_to_service(config)
except Exception as e:
sg.track_error(e, {'context': 'connection-setup'})
raise # re-raise — SDK Garden never swallows your errors
Error messages are automatically scrubbed for email addresses before being sent. See Event Schema for the full payload.
Step 6 — Verify events are arriving
- Open your SDK Garden dashboard at app.sdkgarden.com.
- Run your SDK locally (or run its test suite without
disabled: true). - Within a few seconds the Funnel panel should show an
sdk_initializedevent.
If nothing appears after 30 seconds, enable debug logging:
- JavaScript / TypeScript
- Python
SdkGarden.init({ apiKey: '...', sdkName: '...', sdkVersion: '...', debug: true });
// Console will print: [SDK Garden] Initialised { ... }
// Console will print: [SDK Garden] Flushing events 1
sg = SdkGarden(api_key='...', sdk_name='...', sdk_version='...', debug=True).start()
# Stdout will print: [SDK Garden] flushing 1 events
Disabling in test environments
Pass disabled: true / disabled=True to suppress all events and network calls during testing:
- JavaScript / TypeScript
- Python
SdkGarden.init({
apiKey: 'sgk_test',
sdkName: 'my-sdk',
sdkVersion: '0.0.0',
disabled: process.env.NODE_ENV === 'test',
});
import os
sg = SdkGarden(
api_key='sgk_test',
sdk_name='my-sdk',
sdk_version='0.0.0',
disabled=os.environ.get('ENV') == 'test',
).start()
When disabled, no thread is spawned (Python) and no flush interval is started (JavaScript). All methods become no-ops.
Next steps
- JavaScript SDK Reference — full API reference with all configuration options
- Python SDK Reference — full API reference for the Python client
- Event Schema — exact JSON payload for every event type