Skip to content

Commit 75ea31c

Browse files
committed
Improve fask failure detection for ingest and retrieve
task files
1 parent 6d8b926 commit 75ea31c

4 files changed

Lines changed: 28 additions & 100 deletions

File tree

roles/telemetry_chargeback/tasks/gen_synth_loki_data.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,3 @@
3535
when: not file_preexists.stat.exists | bool
3636
changed_when: cloudkitty_synth_totals_file_output.rc == 0
3737
any_errors_fatal: true
38-
39-
## validating changes
40-
- name: "Load synthetic metrics summary for {{ scenario_name }}"
41-
ansible.builtin.include_vars:
42-
file: "{{ cloudkitty_synth_totals_file }}"
43-
name: synth_data_rates
Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
---
22
# Ingest data generated by gen_synth_loki_data.yml to Loki
33

4-
- name: "TEST Push data to Loki"
5-
ansible.builtin.uri:
6-
## loki_push_url will be used in future role developement
7-
url: "{{ loki_push_url }}"
8-
method: POST
9-
src: "{{ cloudkitty_data_file }}"
10-
body_format: json
11-
client_cert: "{{ cert_dir }}/tls.crt"
12-
client_key: "{{ cert_dir }}/tls.key"
13-
validate_certs: false
14-
status_code: 204
15-
return_content: true
16-
register: loki_response
17-
ignore_errors: true
18-
failed_when: loki_response.status != 204
4+
- name: "Push data to Loki {{ scenario_name }}"
5+
block:
6+
- name: "POST data to Loki"
7+
ansible.builtin.uri:
8+
# loki_push_url is configured in setup_loki_env.yml
9+
url: "{{ loki_push_url }}"
10+
method: POST
11+
src: "{{ cloudkitty_data_file }}"
12+
body_format: json
13+
client_cert: "{{ cert_dir }}/tls.crt"
14+
client_key: "{{ cert_dir }}/tls.key"
15+
ca_path: "{{ cert_dir }}/ca.crt"
16+
validate_certs: false
17+
status_code: 204
18+
return_content: true
19+
register: loki_response
1920

20-
- name: "Ingest Status Message"
21-
ansible.builtin.debug:
22-
msg: "Ingestion Successful"
23-
when: loki_response.status | default(0) == 204
21+
- name: "Ingest Status Message"
22+
ansible.builtin.debug:
23+
msg: "Ingestion Successful for {{ scenario_name }}"
24+
25+
rescue:
26+
- name: "IngestionFailed"
27+
ansible.builtin.fail:
28+
msg:
29+
- "Scenario: {{ scenario_name }}"
30+
- "Status: {{ loki_response.status | default('Unknown') }}"
31+
- "Body: {{ loki_response.content | default('No Content') }}"
32+
- "Message: {{ loki_response.msg | default('Request failed') }}"

roles/telemetry_chargeback/tasks/load_loki_data.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44

55
- name: "Flush data to Loki storage for {{ scenario_name }}"
66
ansible.builtin.include_tasks: flush_loki_data.yml
7-
8-
- name: "Retrieve data log from Loki for {{ scenario_name }}"
9-
ansible.builtin.include_tasks: retrieve_loki_data.yml

roles/telemetry_chargeback/tasks/retrieve_loki_data.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)