Skip to content

Commit

Permalink
Add tempo datasource support
Browse files Browse the repository at this point in the history
  • Loading branch information
SHURAVIN Anatoly authored and Nemental committed Jan 2, 2024
1 parent c57b9cd commit 757d7ae
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/335-add-datasource-type-tempo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- Add support for Grafana Tempo datasource type (https://grafana.com/docs/grafana/latest/datasources/tempo/)
4 changes: 3 additions & 1 deletion plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- camptocamp-prometheus-alertmanager-datasource
- loki
- redis-datasource
- tempo
type: str
ds_url:
description:
Expand Down Expand Up @@ -742,7 +743,8 @@ def setup_module_object():
'camptocamp-prometheus-alertmanager-datasource',
'sni-thruk-datasource',
'redis-datasource',
'loki']),
'loki',
'tempo']),
ds_url=dict(type='str'),
access=dict(default='proxy', choices=['proxy', 'direct']),
database=dict(type='str', default=""),
Expand Down
78 changes: 78 additions & 0 deletions tests/integration/targets/grafana_datasource/tasks/tempo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
- name: Create tempo datasource
register: result
grafana_datasource:
name: datasource-tempo
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: '1'
ds_type: tempo
ds_url: tempo.company.com:3100

- debug:
var: result

- assert:
that:
- result.changed
- "result.msg == 'Datasource datasource-tempo created'"

- name: Check tempo datasource creation idempotency
register: result
grafana_datasource:
name: datasource-tempo
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: '1'
ds_type: tempo
ds_url: tempo.company.com:3100

- debug:
var: result

- assert:
that:
- not result.changed
- result.datasource.basicAuth == false
- result.datasource.isDefault == false
- result.datasource.jsonData.tlsAuth == false
- result.datasource.jsonData.tlsAuthWithCACert == false
- result.datasource.secureJsonFields.httpHeaderValue1 == true
- result.datasource.name == 'datasource-tempo'
- result.datasource.orgId == 1
- result.datasource.type == 'tempo'
- result.datasource.url == 'tempo.company.com:3100'
- result.datasource.withCredentials == false

- name: Delete tempo datasource
register: result
grafana_datasource:
name: datasource-tempo
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
state: absent

- debug:
var: result

- assert:
that:
- result.changed

- name: Delete tempo datasource
register: result
grafana_datasource:
name: datasource-tempo
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
state: absent

- debug:
var: result

- assert:
that:
- not result.changed

0 comments on commit 757d7ae

Please sign in to comment.