ccproxy.observability.pushgateway¶
ccproxy.observability.pushgateway
¶
Prometheus Pushgateway integration for batch metrics.
CircuitBreaker
¶
Simple circuit breaker for pushgateway operations.
Source code in ccproxy/observability/pushgateway.py
can_execute
¶
Check if operation can be executed.
Source code in ccproxy/observability/pushgateway.py
record_success
¶
record_failure
¶
Record failed operation.
Source code in ccproxy/observability/pushgateway.py
PushgatewayClient
¶
Prometheus Pushgateway client using official prometheus_client methods.
Supports standard pushgateway operations: - push_to_gateway(): Replace all metrics for job/instance - pushadd_to_gateway(): Add metrics to existing job/instance - delete_from_gateway(): Delete metrics for job/instance
Also supports VictoriaMetrics remote write protocol for compatibility.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings
|
ObservabilitySettings
|
Observability configuration settings |
required |
Source code in ccproxy/observability/pushgateway.py
push_metrics
¶
Push metrics to Pushgateway using official prometheus_client methods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
registry
|
CollectorRegistry
|
Prometheus metrics registry to push |
required |
method
|
str
|
Push method - "push" (replace), "pushadd" (add), or "delete" |
'push'
|
Returns:
Type | Description |
---|---|
bool
|
True if push succeeded, False otherwise |
Source code in ccproxy/observability/pushgateway.py
push_add_metrics
¶
Add metrics to existing job/instance (pushadd operation).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
registry
|
CollectorRegistry
|
Prometheus metrics registry to add |
required |
Returns:
Type | Description |
---|---|
bool
|
True if push succeeded, False otherwise |
Source code in ccproxy/observability/pushgateway.py
delete_metrics
¶
Delete all metrics for the configured job.
Returns:
Type | Description |
---|---|
bool
|
True if delete succeeded, False otherwise |
Source code in ccproxy/observability/pushgateway.py
get_pushgateway_client
¶
Get or create global pushgateway client instance.
Source code in ccproxy/observability/pushgateway.py
reset_pushgateway_client
¶
Reset global pushgateway client instance (mainly for testing).