ergon-framework-python 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. ergon/__init__.py +1 -1
  2. ergon/bootstrap/src/__project__/_observability/docker-compose.telemetry.yml +123 -123
  3. ergon/bootstrap/src/__project__/_observability/grafana.yaml +16 -16
  4. ergon/bootstrap/src/__project__/_observability/loki.yaml +47 -47
  5. ergon/bootstrap/src/__project__/_observability/otel-collector-config.yaml +52 -52
  6. ergon/bootstrap/src/__project__/_observability/prometheus.yaml +10 -10
  7. ergon/bootstrap/src/__project__/_observability/tempo.yaml +23 -23
  8. ergon/connector/__init__.py +4 -0
  9. ergon/connector/ergon_platform/_client.py +23 -23
  10. ergon/connector/ergon_platform/_operations.py +264 -264
  11. ergon/connector/rabbitmq/__init__.py +4 -0
  12. ergon/connector/rabbitmq/async_connector.py +4 -1
  13. ergon/connector/rabbitmq/async_service.py +216 -53
  14. ergon/connector/rabbitmq/models.py +82 -3
  15. ergon/task/__init__.py +4 -0
  16. ergon/task/base.py +2 -0
  17. ergon/task/exceptions.py +7 -0
  18. ergon/task/helpers.py +33 -4
  19. ergon/task/liveness.py +41 -0
  20. ergon/task/mixins/consumer.py +145 -7
  21. ergon/task/runner.py +176 -5
  22. {ergon_framework_python-0.1.4.dist-info → ergon_framework_python-0.1.6.dist-info}/METADATA +454 -453
  23. {ergon_framework_python-0.1.4.dist-info → ergon_framework_python-0.1.6.dist-info}/RECORD +27 -26
  24. {ergon_framework_python-0.1.4.dist-info → ergon_framework_python-0.1.6.dist-info}/WHEEL +1 -1
  25. {ergon_framework_python-0.1.4.dist-info → ergon_framework_python-0.1.6.dist-info}/licenses/LICENSE +21 -21
  26. {ergon_framework_python-0.1.4.dist-info → ergon_framework_python-0.1.6.dist-info}/entry_points.txt +0 -0
  27. {ergon_framework_python-0.1.4.dist-info → ergon_framework_python-0.1.6.dist-info}/top_level.txt +0 -0
ergon/__init__.py CHANGED
@@ -10,4 +10,4 @@ __all__ = [
10
10
  "manager",
11
11
  ]
12
12
 
13
- __version__ = "0.1.3"
13
+ __version__ = "0.1.6"
@@ -1,124 +1,124 @@
1
- services:
2
-
3
- ############################################################
4
- # OpenTelemetry Collector
5
- ############################################################
6
- otel-collector:
7
- image: otel/opentelemetry-collector-contrib:0.114.0
8
- container_name: ergon-otel-collector
9
- restart: unless-stopped
10
- command: ["--config=/etc/otelcol/config.yaml"]
11
- volumes:
12
- - ./otel-collector-config.yaml:/etc/otelcol/config.yaml:ro
13
- ports:
14
- - "4317:4317" # OTLP gRPC
15
- - "4318:4318" # OTLP HTTP
16
- - "9464:9464" # Prometheus scrape (metrics)
17
- depends_on:
18
- - tempo
19
- - loki
20
- healthcheck:
21
- test: ["CMD", "wget", "--spider", "-q", "http://localhost:13133/"]
22
- interval: 10s
23
- timeout: 5s
24
- retries: 5
25
- networks:
26
- - ergon-telemetry
27
-
28
- ############################################################
29
- # Loki (Logs)
30
- ############################################################
31
- loki:
32
- image: grafana/loki:3.0.0
33
- container_name: ergon-loki
34
- restart: unless-stopped
35
- volumes:
36
- - ./loki.yaml:/etc/loki/config.yaml:ro
37
- - loki-data:/loki
38
- command: -config.file=/etc/loki/config.yaml
39
- ports:
40
- - "3100:3100"
41
- healthcheck:
42
- test: ["CMD", "wget", "--spider", "-q", "http://localhost:3100/ready"]
43
- interval: 10s
44
- timeout: 5s
45
- retries: 5
46
- networks:
47
- - ergon-telemetry
48
-
49
- ############################################################
50
- # Tempo (Traces)
51
- ############################################################
52
- tempo:
53
- image: grafana/tempo:2.4.1
54
- container_name: ergon-tempo
55
- restart: unless-stopped
56
- volumes:
57
- - ./tempo.yaml:/etc/tempo/config.yaml:ro
58
- - tempo-data:/var/tempo
59
- command: ["-config.file=/etc/tempo/config.yaml"]
60
- ports:
61
- - "3200:3200"
62
- healthcheck:
63
- test: ["CMD", "wget", "--spider", "-q", "http://localhost:3200/ready"]
64
- interval: 10s
65
- timeout: 5s
66
- retries: 5
67
- networks:
68
- - ergon-telemetry
69
-
70
- ############################################################
71
- # Prometheus (Metrics)
72
- ############################################################
73
- prometheus:
74
- image: prom/prometheus:latest
75
- container_name: ergon-prometheus
76
- restart: unless-stopped
77
- volumes:
78
- - ./prometheus.yaml:/etc/prometheus/prometheus.yml:ro
79
- - prom-data:/prometheus
80
- command:
81
- - "--config.file=/etc/prometheus/prometheus.yml"
82
- ports:
83
- - "9090:9090"
84
- depends_on:
85
- - otel-collector
86
- healthcheck:
87
- test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090/-/ready"]
88
- interval: 10s
89
- timeout: 5s
90
- retries: 5
91
- networks:
92
- - ergon-telemetry
93
-
94
- ############################################################
95
- # Grafana Dashboard UI
96
- ############################################################
97
- grafana:
98
- image: grafana/grafana:10.4.0
99
- container_name: ergon-grafana
100
- restart: unless-stopped
101
- volumes:
102
- - ./grafana.yaml:/etc/grafana/provisioning/datasources/datasources.yaml:ro
103
- - grafana-data:/var/lib/grafana
104
- ports:
105
- - "3000:3000"
106
- networks:
107
- - ergon-telemetry
108
-
109
-
110
- ############################################################
111
- # Volumes
112
- ############################################################
113
- volumes:
114
- loki-data:
115
- tempo-data:
116
- prom-data:
117
- grafana-data:
118
-
119
- ############################################################
120
- # Network
121
- ############################################################
122
- networks:
123
- ergon-telemetry:
1
+ services:
2
+
3
+ ############################################################
4
+ # OpenTelemetry Collector
5
+ ############################################################
6
+ otel-collector:
7
+ image: otel/opentelemetry-collector-contrib:0.114.0
8
+ container_name: ergon-otel-collector
9
+ restart: unless-stopped
10
+ command: ["--config=/etc/otelcol/config.yaml"]
11
+ volumes:
12
+ - ./otel-collector-config.yaml:/etc/otelcol/config.yaml:ro
13
+ ports:
14
+ - "4317:4317" # OTLP gRPC
15
+ - "4318:4318" # OTLP HTTP
16
+ - "9464:9464" # Prometheus scrape (metrics)
17
+ depends_on:
18
+ - tempo
19
+ - loki
20
+ healthcheck:
21
+ test: ["CMD", "wget", "--spider", "-q", "http://localhost:13133/"]
22
+ interval: 10s
23
+ timeout: 5s
24
+ retries: 5
25
+ networks:
26
+ - ergon-telemetry
27
+
28
+ ############################################################
29
+ # Loki (Logs)
30
+ ############################################################
31
+ loki:
32
+ image: grafana/loki:3.0.0
33
+ container_name: ergon-loki
34
+ restart: unless-stopped
35
+ volumes:
36
+ - ./loki.yaml:/etc/loki/config.yaml:ro
37
+ - loki-data:/loki
38
+ command: -config.file=/etc/loki/config.yaml
39
+ ports:
40
+ - "3100:3100"
41
+ healthcheck:
42
+ test: ["CMD", "wget", "--spider", "-q", "http://localhost:3100/ready"]
43
+ interval: 10s
44
+ timeout: 5s
45
+ retries: 5
46
+ networks:
47
+ - ergon-telemetry
48
+
49
+ ############################################################
50
+ # Tempo (Traces)
51
+ ############################################################
52
+ tempo:
53
+ image: grafana/tempo:2.4.1
54
+ container_name: ergon-tempo
55
+ restart: unless-stopped
56
+ volumes:
57
+ - ./tempo.yaml:/etc/tempo/config.yaml:ro
58
+ - tempo-data:/var/tempo
59
+ command: ["-config.file=/etc/tempo/config.yaml"]
60
+ ports:
61
+ - "3200:3200"
62
+ healthcheck:
63
+ test: ["CMD", "wget", "--spider", "-q", "http://localhost:3200/ready"]
64
+ interval: 10s
65
+ timeout: 5s
66
+ retries: 5
67
+ networks:
68
+ - ergon-telemetry
69
+
70
+ ############################################################
71
+ # Prometheus (Metrics)
72
+ ############################################################
73
+ prometheus:
74
+ image: prom/prometheus:latest
75
+ container_name: ergon-prometheus
76
+ restart: unless-stopped
77
+ volumes:
78
+ - ./prometheus.yaml:/etc/prometheus/prometheus.yml:ro
79
+ - prom-data:/prometheus
80
+ command:
81
+ - "--config.file=/etc/prometheus/prometheus.yml"
82
+ ports:
83
+ - "9090:9090"
84
+ depends_on:
85
+ - otel-collector
86
+ healthcheck:
87
+ test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090/-/ready"]
88
+ interval: 10s
89
+ timeout: 5s
90
+ retries: 5
91
+ networks:
92
+ - ergon-telemetry
93
+
94
+ ############################################################
95
+ # Grafana Dashboard UI
96
+ ############################################################
97
+ grafana:
98
+ image: grafana/grafana:10.4.0
99
+ container_name: ergon-grafana
100
+ restart: unless-stopped
101
+ volumes:
102
+ - ./grafana.yaml:/etc/grafana/provisioning/datasources/datasources.yaml:ro
103
+ - grafana-data:/var/lib/grafana
104
+ ports:
105
+ - "3000:3000"
106
+ networks:
107
+ - ergon-telemetry
108
+
109
+
110
+ ############################################################
111
+ # Volumes
112
+ ############################################################
113
+ volumes:
114
+ loki-data:
115
+ tempo-data:
116
+ prom-data:
117
+ grafana-data:
118
+
119
+ ############################################################
120
+ # Network
121
+ ############################################################
122
+ networks:
123
+ ergon-telemetry:
124
124
  driver: bridge
@@ -1,17 +1,17 @@
1
- apiVersion: 1
2
-
3
- datasources:
4
- - name: Loki
5
- type: loki
6
- access: proxy
7
- url: http://loki:3100
8
-
9
- - name: Tempo
10
- type: tempo
11
- access: proxy
12
- url: http://tempo:3200
13
-
14
- - name: Prometheus
15
- type: prometheus
16
- access: proxy
1
+ apiVersion: 1
2
+
3
+ datasources:
4
+ - name: Loki
5
+ type: loki
6
+ access: proxy
7
+ url: http://loki:3100
8
+
9
+ - name: Tempo
10
+ type: tempo
11
+ access: proxy
12
+ url: http://tempo:3200
13
+
14
+ - name: Prometheus
15
+ type: prometheus
16
+ access: proxy
17
17
  url: http://prometheus:9090
@@ -1,48 +1,48 @@
1
- auth_enabled: false
2
-
3
- server:
4
- http_listen_port: 3100
5
- grpc_listen_port: 9096
6
-
7
- common:
8
- instance_addr: 127.0.0.1
9
- path_prefix: /loki
10
- storage:
11
- filesystem:
12
- chunks_directory: /loki/chunks
13
- rules_directory: /loki/rules
14
- replication_factor: 1
15
- ring:
16
- kvstore:
17
- store: inmemory
18
-
19
- query_range:
20
- results_cache:
21
- cache:
22
- embedded_cache:
23
- enabled: true
24
- max_size_mb: 100
25
-
26
- schema_config:
27
- configs:
28
- - from: "2024-01-01"
29
- store: tsdb
30
- object_store: filesystem
31
- schema: v13
32
- index:
33
- prefix: index_
34
- period: 24h
35
-
36
- pattern_ingester:
37
- enabled: true
38
-
39
- compactor:
40
- working_directory: /loki/boltdb-shipper-compactor
41
- # shared_store: filesystem <-- REMOVED (Invalid in Loki 3.0)
42
- delete_request_store: filesystem # <-- ADDED (Required for retention)
43
- retention_enabled: true
44
-
45
- limits_config:
46
- retention_period: 24h
47
- allow_structured_metadata: true
1
+ auth_enabled: false
2
+
3
+ server:
4
+ http_listen_port: 3100
5
+ grpc_listen_port: 9096
6
+
7
+ common:
8
+ instance_addr: 127.0.0.1
9
+ path_prefix: /loki
10
+ storage:
11
+ filesystem:
12
+ chunks_directory: /loki/chunks
13
+ rules_directory: /loki/rules
14
+ replication_factor: 1
15
+ ring:
16
+ kvstore:
17
+ store: inmemory
18
+
19
+ query_range:
20
+ results_cache:
21
+ cache:
22
+ embedded_cache:
23
+ enabled: true
24
+ max_size_mb: 100
25
+
26
+ schema_config:
27
+ configs:
28
+ - from: "2024-01-01"
29
+ store: tsdb
30
+ object_store: filesystem
31
+ schema: v13
32
+ index:
33
+ prefix: index_
34
+ period: 24h
35
+
36
+ pattern_ingester:
37
+ enabled: true
38
+
39
+ compactor:
40
+ working_directory: /loki/boltdb-shipper-compactor
41
+ # shared_store: filesystem <-- REMOVED (Invalid in Loki 3.0)
42
+ delete_request_store: filesystem # <-- ADDED (Required for retention)
43
+ retention_enabled: true
44
+
45
+ limits_config:
46
+ retention_period: 24h
47
+ allow_structured_metadata: true
48
48
  max_query_length: 720h
@@ -1,53 +1,53 @@
1
- receivers:
2
- otlp:
3
- protocols:
4
- http:
5
- endpoint: 0.0.0.0:4318
6
- grpc:
7
- endpoint: 0.0.0.0:4317
8
-
9
- exporters:
10
- loki:
11
- endpoint: http://loki:3100/loki/api/v1/push
12
- labels:
13
- resource:
14
- service.name: "service_name"
15
- service.version: "service_version"
16
- ergon.task.name: "task_name"
17
- ergon.task.execution.host.name: "host_name"
18
- attributes:
19
- level: "level"
20
-
21
- default_labels_enabled:
22
- exporter: false
23
- resource: false
24
- attributes: false
25
- scope: false
26
-
27
- otlphttp/tempo:
28
- endpoint: http://tempo:4318
29
- tls:
30
- insecure: true
31
-
32
- prometheus:
33
- endpoint: "0.0.0.0:9464"
34
-
35
- processors:
36
- batch: {}
37
-
38
- service:
39
- pipelines:
40
- logs:
41
- receivers: [otlp]
42
- processors: [batch] # ← Changed: removed "resource"
43
- exporters: [loki]
44
-
45
- traces:
46
- receivers: [otlp]
47
- processors: [batch] # ← Changed: removed "resource"
48
- exporters: [otlphttp/tempo]
49
-
50
- metrics:
51
- receivers: [otlp]
52
- processors: [batch]
1
+ receivers:
2
+ otlp:
3
+ protocols:
4
+ http:
5
+ endpoint: 0.0.0.0:4318
6
+ grpc:
7
+ endpoint: 0.0.0.0:4317
8
+
9
+ exporters:
10
+ loki:
11
+ endpoint: http://loki:3100/loki/api/v1/push
12
+ labels:
13
+ resource:
14
+ service.name: "service_name"
15
+ service.version: "service_version"
16
+ ergon.task.name: "task_name"
17
+ ergon.task.execution.host.name: "host_name"
18
+ attributes:
19
+ level: "level"
20
+
21
+ default_labels_enabled:
22
+ exporter: false
23
+ resource: false
24
+ attributes: false
25
+ scope: false
26
+
27
+ otlphttp/tempo:
28
+ endpoint: http://tempo:4318
29
+ tls:
30
+ insecure: true
31
+
32
+ prometheus:
33
+ endpoint: "0.0.0.0:9464"
34
+
35
+ processors:
36
+ batch: {}
37
+
38
+ service:
39
+ pipelines:
40
+ logs:
41
+ receivers: [otlp]
42
+ processors: [batch] # ← Changed: removed "resource"
43
+ exporters: [loki]
44
+
45
+ traces:
46
+ receivers: [otlp]
47
+ processors: [batch] # ← Changed: removed "resource"
48
+ exporters: [otlphttp/tempo]
49
+
50
+ metrics:
51
+ receivers: [otlp]
52
+ processors: [batch]
53
53
  exporters: [prometheus]
@@ -1,11 +1,11 @@
1
- global:
2
- scrape_interval: 5s
3
-
4
- scrape_configs:
5
- - job_name: "otel-collector"
6
- static_configs:
7
- - targets: ["otel-collector:9464"]
8
-
9
- - job_name: "ergon_tasks"
10
- static_configs:
1
+ global:
2
+ scrape_interval: 5s
3
+
4
+ scrape_configs:
5
+ - job_name: "otel-collector"
6
+ static_configs:
7
+ - targets: ["otel-collector:9464"]
8
+
9
+ - job_name: "ergon_tasks"
10
+ static_configs:
11
11
  - targets: ["otel-collector:9464"]
@@ -1,24 +1,24 @@
1
- server:
2
- http_listen_port: 3200
3
- grpc_listen_port: 9095
4
-
5
- distributor:
6
- receivers:
7
- otlp:
8
- protocols:
9
- grpc:
10
- http:
11
-
12
- ingester:
13
- max_block_bytes: 100_000_000
14
- max_block_duration: 5m
15
-
16
- compactor:
17
- compaction:
18
- block_retention: 24h
19
-
20
- storage:
21
- trace:
22
- backend: local
23
- local:
1
+ server:
2
+ http_listen_port: 3200
3
+ grpc_listen_port: 9095
4
+
5
+ distributor:
6
+ receivers:
7
+ otlp:
8
+ protocols:
9
+ grpc:
10
+ http:
11
+
12
+ ingester:
13
+ max_block_bytes: 100_000_000
14
+ max_block_duration: 5m
15
+
16
+ compactor:
17
+ compaction:
18
+ block_retention: 24h
19
+
20
+ storage:
21
+ trace:
22
+ backend: local
23
+ local:
24
24
  path: /var/tempo/traces
@@ -37,7 +37,9 @@ from .rabbitmq import (
37
37
  AsyncRabbitmqClient,
38
38
  AsyncRabbitMQConnector,
39
39
  AsyncRabbitmqConsumerConfig,
40
+ AsyncRabbitmqExchangeBinding,
40
41
  AsyncRabbitmqProducerConfig,
42
+ AsyncRabbitmqQueueSubscription,
41
43
  AsyncRabbitMQService,
42
44
  RabbitmqClient,
43
45
  RabbitMQConnector,
@@ -72,7 +74,9 @@ __all__ = [
72
74
  "AsyncRabbitMQService",
73
75
  "AsyncRabbitmqClient",
74
76
  "AsyncRabbitmqConsumerConfig",
77
+ "AsyncRabbitmqExchangeBinding",
75
78
  "AsyncRabbitmqProducerConfig",
79
+ "AsyncRabbitmqQueueSubscription",
76
80
  "AsyncSQSConnector",
77
81
  "AsyncSQSService",
78
82
  "Connector",
@@ -1,23 +1,23 @@
1
- from .models import ErgonPlatformClient
2
-
3
- _ERGON_PLATFORM_IMPORT_ERROR = "Install the ergon-platform-sdk package in the same environment"
4
-
5
-
6
- def _get_ergon_client():
7
- try:
8
- from ergon_platform import ErgonClient # type: ignore[reportMissingImports]
9
- except ImportError as exc:
10
- raise ImportError(_ERGON_PLATFORM_IMPORT_ERROR) from exc
11
- return ErgonClient
12
-
13
-
14
- def create_ergon_client(config: ErgonPlatformClient):
15
- ErgonClient = _get_ergon_client()
16
- return ErgonClient(
17
- client_id=config.client_id,
18
- client_secret=config.client_secret,
19
- base_url=config.base_url,
20
- company_id=config.company_id,
21
- timeout=config.timeout,
22
- max_retries=config.max_retries,
23
- )
1
+ from .models import ErgonPlatformClient
2
+
3
+ _ERGON_PLATFORM_IMPORT_ERROR = "Install the ergon-platform-sdk package in the same environment"
4
+
5
+
6
+ def _get_ergon_client():
7
+ try:
8
+ from ergon_platform import ErgonClient # type: ignore[reportMissingImports]
9
+ except ImportError as exc:
10
+ raise ImportError(_ERGON_PLATFORM_IMPORT_ERROR) from exc
11
+ return ErgonClient
12
+
13
+
14
+ def create_ergon_client(config: ErgonPlatformClient):
15
+ ErgonClient = _get_ergon_client()
16
+ return ErgonClient(
17
+ client_id=config.client_id,
18
+ client_secret=config.client_secret,
19
+ base_url=config.base_url,
20
+ company_id=config.company_id,
21
+ timeout=config.timeout,
22
+ max_retries=config.max_retries,
23
+ )