11from app .app_instance import app
2- from app .models import (AlertManagerInput ,Output ,ElasticSearchInput ,LokiInput ,MimirInput ,MysqlInput )
2+ from app .models import (AlertManagerInput ,Output ,ElasticSearchInput ,LokiInput ,MimirInput ,MysqlInput ,PostgresInput ,
3+ PrometheusInput ,TempoInput )
34from app .template_generators .grafana_data_sources .alertmanager import alert_manager_template
45from app .template_generators .grafana_data_sources .elasticsearch import elasticsearch_template
56from app .template_generators .grafana_data_sources .loki import loki_template
67from app .template_generators .grafana_data_sources .mimir import mimir_template
78from app .template_generators .grafana_data_sources .mysql import mysql_template
9+ from app .template_generators .grafana_data_sources .postgresql import postgres_template
10+ from app .template_generators .grafana_data_sources .prometheus import pormetheus_template
11+ from app .template_generators .grafana_data_sources .tempo import tempo_template
812import shutil
913import os
1014
@@ -62,4 +66,38 @@ async def mysql_template_route(request:MysqlInput) -> Output:
6266
6367 mysql_template (request )
6468
69+ return Output (output = 'output' )
70+
71+ @app .post ("/api/grafana/postgres" )
72+ async def postgres_template_route (request :PostgresInput ) -> Output :
73+
74+ dir = 'app/media/MyGrafana'
75+ if os .path .exists (dir ):
76+ shutil .rmtree (dir )
77+
78+ postgres_template (request )
79+
80+ return Output (output = 'output' )
81+
82+ @app .post ("/api/grafana/prometheus" )
83+ async def prometheus_template_route (request :PrometheusInput ) -> Output :
84+
85+ dir = 'app/media/MyGrafana'
86+ if os .path .exists (dir ):
87+ shutil .rmtree (dir )
88+
89+ pormetheus_template (request )
90+
91+ return Output (output = 'output' )
92+
93+
94+ @app .post ("/api/grafana/tempo" )
95+ async def tempo_template_route (request :TempoInput ) -> Output :
96+
97+ dir = 'app/media/MyGrafana'
98+ if os .path .exists (dir ):
99+ shutil .rmtree (dir )
100+
101+ tempo_template (request )
102+
65103 return Output (output = 'output' )
0 commit comments