Handling organization_id
Multi-tenant API service sxample
Let's explore common scenarios using a real-world example of a multi-tenant API service. In this example, you're running an API that serves multiple organizations, and you want to monitor various metrics. Some metrics are naturally split by organization (like latency and request volume), while others are collected globally (like error rates).
The organization_id
in these examples could represent different identifiers depending on your use case:
customer_id
: When serving multiple end customers (e.g., SaaS platform)Email service monitoring delivery rates per business account
DEX monitoring liquidity provider positions
NFT marketplace tracking collection trading volume
vendor_id
: When aggregating metrics across different suppliers or partnersMarketplace measuring seller performance metrics
RPC node provider tracking request volumes
Oracle service monitoring price feed updates
service_id
: When monitoring multiple internal services or microservicesE-commerce tracking checkout service reliability
Bridge monitoring cross-chain transfers
Smart contract monitoring function calls
integration_id
: When tracking metrics for different third-party integrationsPayment platform monitoring gateway success rates
Multi-chain wallet tracking transaction status
DEX aggregator monitoring swap routes
Scenario 1: Organization-Specific Metrics (Per-Organization Latency)
Context: Your API tracks request latency per organization, which is essential for:
Monitoring individual organization experience
Meeting specific SLAs per organization
Identifying organization-specific performance issues
Use Case Examples:
SaaS Platform: Track response times for each customer's API usage
Marketplace: Monitor transaction processing times for different vendors
Microservices: Measure inter-service communication latency
Integration Platform: Track external API call latencies per integration
Scenario 2: Service-Wide Metrics (Global Error Rates)
Context: Your API tracks error counts globally due to:
Infrastructure limitations
Metric collection setup
No business need to track errors per organization
In this case:
Error metrics don't have organization identification
Using
fallback_org_id
assigns all error rates to a default organizationUseful for service-wide SLAs or general monitoring
All organizations reference the same error rate metrics
Scenario 3: Mixed Metrics (Combined Approach)
Best Practices for Mixed Environments
Consistent Labeling:
Clear Separation:
Meaningful Fallback IDs:
Remember:
Choose the appropriate organization identifier based on your use case
Not all metrics need to be split by organization
Use fallback IDs thoughtfully and consistently
Document your choices for future reference
Consider future changes in metric collection
Balance granularity with system complexity
Last updated