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 tempo datasource support #335

Merged
merged 2 commits into from
Jan 2, 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/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
Loading