Native Database Observability with OpenTelemetry
HeliosDB Full plans native OpenTelemetry observability for teams that trace requests end to end: query-level spans, metrics and logs exported to an OpenTelemetry collector. OpenTelemetry export is on the roadmap and not in the current release; today the HTTP gateway answers health, readiness and status probes that need no API key, for container health checks and load balancers.
Planned: OpenTelemetry trace and metric export is on the roadmap. Read the documentation.
Executive Summary
HeliosDB provides native, zero-configuration database observability through deep OpenTelemetry integration.
Problem Being Solved
The Core Challenge
Database visibility is a critical blind spot in modern observability:
- No Query-Level Traces: Can't correlate slow queries to application requests
- Missing Context: Query plans, lock waits, I/O patterns invisible
- Separate Tools: Database monitoring disconnected from application monitoring
- Alert Fatigue: Generic thresholds cause false positives/negatives
Why This Problem Persists
Database observability requires internal instrumentation:
- External tools can only measure connection-level latency
- Query execution details require database engine integration
- Distributed tracing context must flow through database
- Metrics require deep knowledge of database internals
Most databases were built before observability standards existed.
HeliosDB's Unique Solution
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ HeliosDB Native Observability Stack │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────────┐│
│ │ Application Layer ││
│ │ Request → Trace ID: abc123 → Database Call ││
│ └─────────────────────────────────────────────────────────────┘│
│ │ │
│ ▼ W3C Trace Context │
│ ┌─────────────────────────────────────────────────────────────┐│
│ │ HeliosDB Query Processor ││
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ││
│ │ │ Parse Span │→ │ Plan Span │→ │ Execute Span│ ││
│ │ │ - SQL text │ │ - Plan tree │ │ - Rows │ ││
│ │ │ - Parameters│ │ - Cost est │ │ - I/O │ ││
│ │ │ - Parse time│ │ - Plan time │ │ - Exec time │ ││
│ │ └─────────────┘ └─────────────┘ └─────────────┘ ││
│ └─────────────────────────────────────────────────────────────┘│
│ │ │
│ ┌──────────────────┼──────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Traces │ │ Metrics │ │ Logs │ │
│ │ (OTLP) │ │ (Prometheus) │ │ (OTLP) │ │
│ │ │ │ │ │ │ │
│ │ - Query spans │ │ - QPS │ │ - Slow queries │ │
│ │ - Lock spans │ │ - Latency p50/99│ │ - Errors │ │
│ │ - I/O spans │ │ - Connections │ │ - Deadlocks │ │
│ │ - Plan spans │ │ - Cache hits │ │ - Plan changes │ │
│ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │
│ │ │ │ │
│ └───────────────────┼───────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────┐│
│ │ Observability Backends ││
│ │ Jaeger | Tempo | Datadog | New Relic | Grafana | Splunk ││
│ └─────────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────────┘
Key Capabilities
- Zero-Config OpenTelemetry: Traces/metrics/logs out of the box
- Trace Context Propagation: W3C traceparent flows through queries
- Query-Level Detail: Spans for parse, plan, execute, lock, I/O
- Query Plan in Traces: See execution plan alongside timing
- Prometheus Metrics: Native scrape endpoint
- Intelligent Alerting: Anomaly-based, not threshold-based
Concrete Business Examples
Example 1: E-Commerce - Black Friday Performance Debugging
Scenario: E-commerce platform experiencing intermittent slowdowns during Black Friday.
Problem: Cannot identify which queries or what in the database is causing slowdowns.
-- Enable observability (already on by default)
SELECT helios_observability_config();
-- component | status | endpoint
-- traces | enabled | otlp://localhost:4317
-- metrics | enabled | :9090/metrics
-- logs | enabled | otlp://localhost:4317
-- Application makes request with trace context
-- HTTP Header: traceparent: 00-abc123def456-span789-01
-- Query automatically inherits trace context
SELECT p.*, i.quantity
FROM products p
JOIN inventory i ON p.id = i.product_id
WHERE p.id = $1;
-- In Jaeger/Tempo, the trace shows:
--
-- │ └── plan: Nested Loop Join
-- │ └── waiting_for: tx_567890
-- │ └── lock_type: row_exclusive
-- │ └── table: inventory
-- └── rows_returned: 1
-- └── buffer_hits: 45
-- └── buffer_reads: 0
-- Root cause identified: Lock contention on inventory table!
-- Query lock contention metrics
SELECT * FROM helios_metrics_lock_contention()
WHERE table_name = 'inventory'
AND time > NOW() - INTERVAL '1 hour';
-- time | avg_wait_ms | p99_wait_ms | blocked_queries
-- 2024-11-29 10:00:00 | 45 | 1850 | 234
-- 2024-11-29 10:01:00 | 52 | 2100 | 287
-- Pattern: Inventory updates blocking reads
Example 2: SaaS Platform - Slow Query Identification
Scenario: SaaS platform with 1000 customers. Some tenants complaining about slowness. No visibility into which queries are slow.
Problem: Cannot identify slow queries by tenant or correlate to customer complaints.
-- Configure tenant-aware observability
SELECT helios_configure_observability('{
"trace_attributes": {
"tenant_id": "current_setting(''app.tenant_id'')",
"user_id": "current_setting(''app.user_id'')"
},
"metrics_labels": ["tenant_id", "query_type"],
"slow_query_threshold_ms": 100
}');
-- Grafana dashboard query: Latency by tenant
SELECT
labels->>'tenant_id' as tenant,
histogram_quantile(0.99, rate(helios_query_duration_seconds_bucket[5m])) as p99_latency
FROM helios_metrics
WHERE metric_name = 'helios_query_duration_seconds'
GROUP BY tenant
ORDER BY p99_latency DESC
LIMIT 10;
-- tenant | p99_latency
-- tenant_acme | 2.34s
-- tenant_globex | 1.87s
-- tenant_initech | 0.45s
-- tenant_umbrella| 0.12s
-- ...
-- Drill down: What queries are slow for tenant_acme?
SELECT * FROM helios_slow_query_log
WHERE attributes->>'tenant_id' = 'tenant_acme'
AND timestamp > NOW() - INTERVAL '1 hour'
ORDER BY duration_ms DESC
LIMIT 5;
-- query_hash | query_text | duration_ms | plan
-- q_789 | SELECT * FROM reports WHERE... | 2340 | Seq Scan (missing index!)
-- q_456 | SELECT COUNT(*) FROM events WHERE...| 1870 | Seq Scan (3M rows)
-- q_123 | SELECT * FROM users JOIN... | 450 | Hash Join (OK)
-- Trace for specific slow query
SELECT * FROM helios_query_trace('q_789')
WHERE timestamp > NOW() - INTERVAL '1 hour';
-- Results show:
-- span_name | duration_ms | details
-- query | 2340 | SELECT * FROM reports WHERE tenant_id = 'acme'...
-- parse | 0.3 | -
-- execute | 2338 | rows_scanned: 3,247,892, rows_returned: 47
-- io_read | 2100 | pages_read: 89,234
-- Root cause: Missing index on reports(tenant_id)
CREATE INDEX idx_reports_tenant ON reports(tenant_id);
-- Verify fix
SELECT * FROM helios_query_trace('q_789')
WHERE timestamp > NOW() - INTERVAL '5 minutes';
-- New trace shows:
-- span_name | duration_ms | details
-- query | 12 | SELECT * FROM reports WHERE tenant_id = 'acme'...
-- execute | 11 | rows_scanned: 47, rows_returned: 47 (Index Scan)
Example 3: Financial Services - Compliance Audit Trail
Scenario: Bank requiring complete audit trail of all database access for regulatory compliance.
Problem: Need to prove who accessed what data, when, and link to business transactions.
-- Configure compliance-grade observability
SELECT helios_configure_compliance_observability('{
"audit_level": "full",
"trace_retention_days": 2555, -- 7 years for SOX
"include_query_parameters": true,
"mask_pii_in_traces": true,
"correlation_fields": ["transaction_id", "user_id", "account_id"],
"tamper_evident_logs": true
}');
-- Every query automatically traced with compliance metadata
-- Example: Customer balance inquiry
BEGIN;
SET app.transaction_id = 'txn_20250115_001';
SET app.user_id = 'teller_jane';
SET app.business_purpose = 'customer_inquiry';
SELECT account_id, balance, last_transaction_date
FROM accounts
WHERE customer_id = $1;
COMMIT;
-- Compliance audit query: Who accessed customer 12345's data?
SELECT
trace_id,
timestamp,
attributes->>'user_id' as user,
attributes->>'business_purpose' as purpose,
query_text,
duration_ms
FROM helios_audit_traces
WHERE query_text LIKE '%customer_id%'
AND attributes->>'account_id' = '12345'
AND timestamp BETWEEN '2024-01-01' AND '2024-12-31';
-- trace_id | timestamp | user | purpose | query_text
-- abc123 | 2024-03-15 09:23:45 | teller_jane | customer_inquiry | SELECT account_id, balance...
-- def456 | 2024-06-22 14:12:33 | analyst_bob | fraud_review | SELECT * FROM accounts WHERE...
-- ghi789 | 2024-11-01 11:45:00 | system | statement_gen | SELECT transactions WHERE...
-- Verify trace integrity (tamper-evident)
SELECT helios_verify_audit_integrity('2024-01-01', '2024-12-31');
-- period | traces_count | integrity_verified | chain_valid
-- 2024-01-01/2024-12-31| 45,892,347 | true | true
-- All audit traces cryptographically verified
Example 4: DevOps - Automated Performance Regression Detection
Scenario: Development team deploying multiple times per day. Need to catch performance regressions before customers notice.
Problem: No automated way to detect if a deployment causes query performance degradation.
-- Configure performance baseline tracking
SELECT helios_configure_performance_baselines('{
"baseline_window": "7 days",
"comparison_method": "percentile",
"alert_thresholds": {
"p50_increase": 1.5,
"p99_increase": 2.0,
"error_rate_increase": 1.1
},
"deployment_webhook": "https://deploy.company.com/api/events"
}');
-- Automatic baseline comparison after deployment
-- (Triggered by deployment webhook)
SELECT * FROM helios_performance_comparison(
deployment_id => 'deploy_v2.3.1',
comparison_window => '30 minutes'
);
-- query_pattern | baseline_p99 | current_p99 | change | status
-- Automatic alert sent to Slack/PagerDuty:
-- " Performance Regression Detected
-- Trace: https://grafana.company.com/traces/xyz789"
-- Drill into regression
SELECT * FROM helios_query_plan_diff(
query_pattern => 'SELECT * FROM products WHERE category_id = $1',
before_deployment => 'deploy_v2.3.0',
after_deployment => 'deploy_v2.3.1'
);
-- component | before | after | impact
-- plan_type | Index Scan | Seq Scan | HIGH
-- index_used | idx_products_cat | (none) | HIGH
-- rows_scanned | ~100 | ~500,000 | HIGH
-- reason | - | Index dropped in migration
-- Root cause: Migration accidentally dropped index
Example 5: Multi-Region - Global Performance Monitoring
Scenario: Global application with databases in 5 regions. Need unified observability across all regions.
Problem: Separate monitoring per region. Cannot compare cross-region performance or identify global patterns.
-- Configure multi-region observability federation
SELECT helios_configure_global_observability('{
"regions": ["us-east", "us-west", "eu-west", "ap-south", "ap-east"],
"federation_endpoint": "https://grafana.global.company.com",
"metrics_aggregation": "prometheus_federation",
"trace_correlation": "cross_region"
}');
-- Global performance dashboard (Grafana)
-- Query: P99 latency by region
SELECT
region,
histogram_quantile(0.99, sum(rate(helios_query_duration_seconds_bucket[5m])) by (region, le)) as p99
FROM helios_federated_metrics
GROUP BY region;
-- region | p99
-- Investigate ap-south latency
SELECT * FROM helios_region_comparison('ap-south', 'us-east');
-- metric | ap-south | us-east | difference
-- memory_pressure | low | low | -
-- Root cause: Storage performance issue in ap-south
-- Action: Migrate to faster storage tier
-- Cross-region trace correlation
-- User in EU accesses data replicated from US
SELECT * FROM helios_cross_region_trace('trace_xyz789');
-- span_name | region | duration_ms
-- api_request | eu-west | 245
-- db_query | eu-west | 12
-- remote_data_fetch | us-east | 180
-- cross_region_query | us-east | 175
-- execute | us-east | 170
Technical Differentiators
- Native OpenTelemetry: Built into query execution, not added on
- W3C Trace Context: Full distributed tracing support
- Query Plan in Traces: See why queries are slow
- Lock/I/O Attribution: Per-query resource accounting
- Prometheus Metrics: Native scrape endpoint
- Zero Configuration: Works out of the box
Performance depends on workload and hardware. Published figures are measured on representative fixtures; see the benchmarks page and reproduce them on your own workload.