Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Quickwit datasource #308

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/308_datasource_quickwit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- Add Quickwit search engine datasource (https://quickwit.io).
2 changes: 2 additions & 0 deletions plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
- loki
- redis-datasource
- tempo
- quickwit-quickwit-datasource
type: str
ds_url:
description:
Expand Down Expand Up @@ -790,6 +791,7 @@ def setup_module_object():
"redis-datasource",
"loki",
"tempo",
"quickwit-quickwit-datasource",
]
),
ds_url=dict(type="str"),
Expand Down
137 changes: 137 additions & 0 deletions tests/integration/targets/grafana_datasource/tasks/quickwit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
- name: Create Quickwit datasource
register: result
community.grafana.grafana_datasource:
name: Quickwit
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: "1"
ds_type: quickwit-quickwit-datasource
ds_url: http://localhost:7280/api/v1
additional_json_data:
index: hdfs-logs
timeField: timestamp
timeOutputFormat: unix_timestamp_secs
logMessageField: body
logLevelField: severity_text

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- result.changed
- result.datasource.access == 'proxy'
- not result.datasource.isDefault
- result.datasource.database == ''
- result.datasource.name == 'Quickwit'
- result.datasource.orgId == 1
- result.datasource.type == 'quickwit-quickwit-datasource'
- result.datasource.url == 'http://localhost:7280/api/v1'
- result.msg == 'Datasource Quickwit created'
- result.datasource.jsonData.index == 'hdfs-logs'
- result.datasource.jsonData.timeField == 'timestamp'
- result.datasource.jsonData.timeOutputFormat == 'unix_timestamp_secs'
- result.datasource.jsonData.logMessageField == 'body'
- result.datasource.jsonData.logLevelField == 'severity_text'

- name: Check Quickwit datasource creation (idempotency)
register: result
community.grafana.grafana_datasource:
name: Quickwit
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: "1"
ds_type: quickwit-quickwit-datasource
ds_url: http://localhost:7280/api/v1
additional_json_data:
index: hdfs-logs
timeField: timestamp
timeOutputFormat: unix_timestamp_secs
logMessageField: body
logLevelField: severity_text

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- not result.changed
- result.datasource.access == 'proxy'
- not result.datasource.isDefault
- result.datasource.database == ''
- result.datasource.name == 'Quickwit'
- result.datasource.orgId == 1
- result.datasource.type == 'quickwit-quickwit-datasource'
- result.datasource.url == 'http://localhost:7280/api/v1'
- result.msg == 'Datasource Quickwit created'
- result.datasource.jsonData.index == 'hdfs-logs'
- result.datasource.jsonData.timeField == 'timestamp'
- result.datasource.jsonData.timeOutputFormat == 'unix_timestamp_secs'
- result.datasource.jsonData.logMessageField == 'body'
- result.datasource.jsonData.logLevelField == 'severity_text'

- name: Update Quickwit datasource
register: result
community.grafana.grafana_datasource:
name: Quickwit
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: "1"
ds_type: quickwit-quickwit-datasource
ds_url: http://quickwit-url:7280/api/v1
additional_json_data:
index: hdfs-logs
timeField: timestamp
timeOutputFormat: unix_timestamp_millis
logMessageField: body
logLevelField: severity_text

- ansible.builtin.debug:
var: result

- ansible.builtin.assert:
that:
- result.changed
- result.datasource.access == 'proxy'
- not result.datasource.isDefault
- result.datasource.database == ''
- result.datasource.name == 'Quickwit'
- result.datasource.orgId == 1
- result.datasource.type == 'quickwit-quickwit-datasource'
- result.datasource.url == 'http://quickwit-url:7280/api/v1'
- result.msg == 'Datasource Quickwit created'
- result.datasource.jsonData.index == 'hdfs-logs'
- result.datasource.jsonData.timeField == 'timestamp'
- result.datasource.jsonData.timeOutputFormat == 'unix_timestamp_millis'
- result.datasource.jsonData.logMessageField == 'body'
- result.datasource.jsonData.logLevelField == 'severity_text'

- name: Delete Quickwit datasource
register: result
community.grafana.grafana_datasource:
name: Quickwit
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
state: absent

- ansible.builtin.assert:
that:
- result.changed

- name: Delete Quickwit datasource (idempotency)
register: result
community.grafana.grafana_datasource:
name: Quickwit
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
state: absent

- ansible.builtin.assert:
that:
- not result.changed
Loading