-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
971 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import dash | ||
from dash import dcc, html | ||
|
||
# | ||
# load_dotenv() | ||
# | ||
# | ||
# def get_db_connection(): | ||
# connection = psycopg2.connect( | ||
# dbname=os.getenv('DB_NAME', 'k6_dashboard'), | ||
# user=os.getenv('DB_USER', 'k6_dashboard'), | ||
# password=os.getenv('DB_PASSWORD', 'KrPPCHdYSXz6wMct5tUK'), | ||
# host=os.getenv('DB_HOST', 'localhost') | ||
# ) | ||
# return connection | ||
# | ||
# | ||
# def fetch_data(query, params=None): | ||
# connection = get_db_connection() | ||
# cursor = connection.cursor() | ||
# if params: | ||
# cursor.execute(query, params) | ||
# else: | ||
# cursor.execute(query) | ||
# result = cursor.fetchall() | ||
# cursor.close() | ||
# connection.close() | ||
# return result | ||
# | ||
# | ||
# # Fetch unique test run IDs for dropdown options | ||
# test_run_ids_query = "SELECT DISTINCT tags->>'testid' AS testid FROM samples WHERE metric = 'response_time';" | ||
# test_run_ids = fetch_data(test_run_ids_query) | ||
# test_run_id_options = [{'label': id[0], 'value': id[0]} for id in test_run_ids] | ||
# | ||
# app = dash.Dash('K6 Dashboard') | ||
# | ||
# app.layout = html.Div([ | ||
# html.H1('Response Time Visualization'), | ||
# dcc.Dropdown( | ||
# id='test-run-dropdown', | ||
# options=test_run_id_options, | ||
# value=test_run_id_options[0]['value'] if test_run_id_options else None | ||
# ), | ||
# dcc.Graph(id='response-time-graph') | ||
# ]) | ||
# | ||
# test_run_query = """ | ||
# SELECT ts, AVG(value) AS avg_response_time | ||
# FROM samples | ||
# WHERE metric = 'response_time' AND tags->>'testid' = %s | ||
# GROUP BY ts | ||
# ORDER BY ts; | ||
# """ | ||
# | ||
# | ||
# # @app.callback( | ||
# # Output('response-time-graph', 'figure'), | ||
# # [Input('test-run-dropdown', 'value')] | ||
# # ) | ||
# # def update_graph(selected_test_run_id): | ||
# # print(f"Fetching data for test run ID: {selected_test_run_id}") | ||
# # | ||
# # data = fetch_data(test_run_query, (selected_test_run_id,)) | ||
# # | ||
# # # Convert query results to a DataFrame | ||
# # agg_df = pd.DataFrame(data, columns=['ts', 'avg_response_time']) | ||
# # | ||
# # print(f"Data fetched successfully. Rows: {len(agg_df)}") | ||
# # | ||
# # # Create a Plotly graph object for the average response times | ||
# # figure = go.Figure( | ||
# # data=[ | ||
# # go.Scatter(x=agg_df['ts'], y=agg_df['avg_response_time'], mode='lines+markers', name='Avg Response Time')], | ||
# # layout=go.Layout(title='Average Response Time by Timestamp', xaxis_title='Timestamp', yaxis_title='Average Response Time') | ||
# # ) | ||
# # | ||
# # return figure | ||
# | ||
# | ||
# if __name__ == '__main__': | ||
# app.run_server(debug=True) | ||
|
||
app = dash.Dash(__name__) | ||
|
||
app.layout = html.Div([ | ||
html.H1('Hello Dash'), | ||
dcc.Graph( | ||
id='example-graph', | ||
figure={ | ||
'data': [ | ||
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'}, | ||
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'}, | ||
], | ||
'layout': { | ||
'title': 'Dash Data Visualization' | ||
} | ||
} | ||
) | ||
]) | ||
|
||
if __name__ == '__main__': | ||
app.run_server(debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
plugins { | ||
id "base" | ||
} | ||
|
||
|
||
group = "io.github.bbortt.k6.dashboard" | ||
|
||
|
||
dependencies { | ||
} |
Oops, something went wrong.