2025-07-18 12:34:28 +02:00
|
|
|
"""
|
|
|
|
|
Shared monitoring package for microservices
|
2026-01-09 23:14:12 +01:00
|
|
|
|
|
|
|
|
Provides unified OpenTelemetry-based observability:
|
|
|
|
|
- Traces: Distributed tracing
|
|
|
|
|
- Metrics: System and application metrics
|
|
|
|
|
- Logs: Structured logging
|
|
|
|
|
|
|
|
|
|
All signals exported to SigNoz via OTLP.
|
2025-07-18 12:34:28 +02:00
|
|
|
"""
|
|
|
|
|
|
2026-01-09 23:14:12 +01:00
|
|
|
# Core setup - START HERE
|
2025-07-18 12:34:28 +02:00
|
|
|
from .logging import setup_logging
|
2026-01-09 23:14:12 +01:00
|
|
|
from .telemetry import (
|
|
|
|
|
setup_telemetry,
|
|
|
|
|
setup_telemetry_simple,
|
|
|
|
|
get_telemetry_status,
|
|
|
|
|
TelemetryProviders
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Configuration
|
|
|
|
|
from .otel_config import OTelConfig, OTelEndpoints
|
|
|
|
|
|
|
|
|
|
# Individual signal setup (used by telemetry.py)
|
|
|
|
|
from .tracing import (
|
|
|
|
|
setup_tracing,
|
|
|
|
|
get_current_trace_id,
|
|
|
|
|
get_current_span_id,
|
|
|
|
|
add_trace_attributes,
|
|
|
|
|
add_trace_event,
|
|
|
|
|
record_exception
|
2025-09-29 13:13:12 +02:00
|
|
|
)
|
2026-01-08 19:25:52 +01:00
|
|
|
from .logs_exporter import (
|
|
|
|
|
setup_otel_logging,
|
|
|
|
|
add_log_context,
|
|
|
|
|
get_current_trace_context,
|
|
|
|
|
StructlogOTELProcessor
|
|
|
|
|
)
|
|
|
|
|
from .metrics_exporter import (
|
|
|
|
|
setup_otel_metrics,
|
|
|
|
|
OTelMetricsCollector,
|
|
|
|
|
create_dual_metrics_collector
|
|
|
|
|
)
|
|
|
|
|
from .system_metrics import (
|
|
|
|
|
SystemMetricsCollector,
|
|
|
|
|
ApplicationMetricsCollector,
|
|
|
|
|
setup_all_metrics
|
|
|
|
|
)
|
2025-07-18 12:34:28 +02:00
|
|
|
|
2026-01-09 23:14:12 +01:00
|
|
|
# Health checks
|
|
|
|
|
from .health_checks import (
|
|
|
|
|
HealthCheckManager,
|
|
|
|
|
FastAPIHealthChecker,
|
|
|
|
|
create_health_manager,
|
|
|
|
|
setup_fastapi_health_checks
|
|
|
|
|
)
|
|
|
|
|
|
2025-07-18 12:34:28 +02:00
|
|
|
__all__ = [
|
2026-01-09 23:14:12 +01:00
|
|
|
# CORE - Start with these
|
2025-07-18 12:34:28 +02:00
|
|
|
'setup_logging',
|
2026-01-09 23:14:12 +01:00
|
|
|
'setup_telemetry',
|
|
|
|
|
'setup_telemetry_simple',
|
|
|
|
|
'get_telemetry_status',
|
|
|
|
|
'TelemetryProviders',
|
|
|
|
|
|
|
|
|
|
# Configuration
|
|
|
|
|
'OTelConfig',
|
|
|
|
|
'OTelEndpoints',
|
|
|
|
|
|
|
|
|
|
# Tracing
|
|
|
|
|
'setup_tracing',
|
|
|
|
|
'get_current_trace_id',
|
|
|
|
|
'get_current_span_id',
|
|
|
|
|
'add_trace_attributes',
|
|
|
|
|
'add_trace_event',
|
|
|
|
|
'record_exception',
|
|
|
|
|
|
|
|
|
|
# Logs
|
2026-01-08 19:25:52 +01:00
|
|
|
'setup_otel_logging',
|
|
|
|
|
'add_log_context',
|
|
|
|
|
'get_current_trace_context',
|
|
|
|
|
'StructlogOTELProcessor',
|
2026-01-09 23:14:12 +01:00
|
|
|
|
|
|
|
|
# Metrics
|
2026-01-08 19:25:52 +01:00
|
|
|
'setup_otel_metrics',
|
|
|
|
|
'OTelMetricsCollector',
|
|
|
|
|
'create_dual_metrics_collector',
|
|
|
|
|
'SystemMetricsCollector',
|
|
|
|
|
'ApplicationMetricsCollector',
|
2026-01-09 23:14:12 +01:00
|
|
|
'setup_all_metrics',
|
|
|
|
|
|
|
|
|
|
# Health checks
|
|
|
|
|
'HealthCheckManager',
|
|
|
|
|
'FastAPIHealthChecker',
|
|
|
|
|
'create_health_manager',
|
|
|
|
|
'setup_fastapi_health_checks',
|
2025-07-18 12:34:28 +02:00
|
|
|
]
|