Skip to content

Commit 9193a8b

Browse files
committed
Enable retrieval of loki data
1 parent adc0242 commit 9193a8b

2 files changed

Lines changed: 15 additions & 14 deletions

File tree

roles/telemetry_chargeback/tasks/gen_synth_loki_data.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
changed_when: cloudkitty_synth_totals_file_output.rc == 0
3737
any_errors_fatal: true
3838

39-
## validating changes
39+
# Load synthetic metrics summary for validation
4040
- name: "Load synthetic metrics summary for {{ scenario_name }}"
4141
ansible.builtin.include_vars:
4242
file: "{{ cloudkitty_synth_totals_file }}"
4343
name: synth_data_rates
44+
when: cloudkitty_synth_totals_file_output is defined
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
---
22
# Ingest data generated by gen_synth_loki_data.yml to Loki
33

4-
- name: "Push data to Loki {{ scenario_name }}"
4+
- name: "Ingest data log to Loki via API"
55
block:
6-
- name: "POST data to Loki"
6+
7+
- name: "Push data to Loki"
78
ansible.builtin.uri:
8-
# loki_push_url is configured in setup_loki_env.yml
9+
## loki_push_url will be used in future role developement
910
url: "{{ loki_push_url }}"
1011
method: POST
1112
src: "{{ cloudkitty_data_file }}"
1213
body_format: json
1314
client_cert: "{{ cert_dir }}/tls.crt"
1415
client_key: "{{ cert_dir }}/tls.key"
15-
ca_path: "{{ cert_dir }}/ca.crt"
1616
validate_certs: false
1717
status_code: 204
1818
return_content: true
1919
register: loki_response
20+
ignore_errors: false
21+
failed_when: loki_response.status != 204
2022

21-
- name: "Ingest Status Message"
23+
# Success
24+
- name: "Confirm ingestion success"
2225
ansible.builtin.debug:
23-
msg: "Ingestion Successful for {{ scenario_name }}"
26+
msg: "Ingestion Successful!"
2427

2528
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') }}"
29+
# Rescue block
30+
- name: "Debug failure"
31+
ansible.builtin.debug:
32+
msg: "Ingest failed. Loki Status: {{ loki_response.status | default('N/A') }}"

0 commit comments

Comments
 (0)