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

Fix/dashboard #227

Merged
merged 49 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7c8e5ca
update dashboard workflow
ruthenian8 Sep 5, 2023
bbd2b3d
run on workflow_dispatch
ruthenian8 Sep 6, 2023
6712898
trigger on PR to dev for debugging
ruthenian8 Sep 7, 2023
941a581
update build push action
ruthenian8 Sep 7, 2023
5d7c753
update context && file
ruthenian8 Sep 7, 2023
eaf772a
remove trigger on PR
ruthenian8 Sep 7, 2023
27170ea
add sample data provider
ruthenian8 Sep 12, 2023
0531c49
Update dashboard, finalize data provider
ruthenian8 Sep 14, 2023
97b67c3
Add extractors for requests and responses as default instrumentors
ruthenian8 Sep 15, 2023
c180182
add 'get_last_request', 'get_last_response'; add charts for requests …
ruthenian8 Sep 15, 2023
92318cd
Update sections in superset_guide; update extractor functions tutor
ruthenian8 Sep 18, 2023
e45c298
doc build fix: Change functions to func names in __all__
ruthenian8 Sep 18, 2023
ac00230
Apply suggestions by RLKRO from code review
ruthenian8 Sep 20, 2023
1d5a92a
intermediary update; update data provider tutor; update charts;
ruthenian8 Sep 20, 2023
ce2f1d7
Apply suggestions from code review by RLKRO
ruthenian8 Sep 20, 2023
ee86703
Upload annotations.png via GUI
ruthenian8 Sep 20, 2023
721593e
Update requests & responses charts; update superset_guide
ruthenian8 Sep 20, 2023
fd05a11
expand the Superset guide with chart creation instructions;Add links …
ruthenian8 Sep 21, 2023
675e71b
update graph plot; update dataset to get flow lag; update data provider
ruthenian8 Sep 21, 2023
6af9a9f
update guide; move sample data collector to /utils
ruthenian8 Sep 22, 2023
532597e
update links to avoid sphinx warnings
ruthenian8 Sep 22, 2023
ee61909
merge dev
ruthenian8 Sep 26, 2023
6ace191
update dashboard description; update tutorials
ruthenian8 Sep 26, 2023
c6f1259
update superset guide
ruthenian8 Sep 26, 2023
6646577
Merge branch 'dev' into fix/dashboard
ruthenian8 Sep 26, 2023
17225e1
update label extractor; add infile parameter to main; remove link to …
ruthenian8 Sep 26, 2023
d355290
update tests
ruthenian8 Sep 26, 2023
eddc688
update format
ruthenian8 Sep 26, 2023
3c15511
minor doc improvements
RLKRo Oct 5, 2023
457a50c
update dashboard datasource config
ruthenian8 Oct 6, 2023
a470da3
add dff_stats dataset; link charts to dff_stats dataset
ruthenian8 Oct 10, 2023
49d2e8a
update tests and documentation to reflect config changes
ruthenian8 Oct 10, 2023
ed2db47
update formatting
ruthenian8 Oct 10, 2023
d9265ca
add the test configuration file
ruthenian8 Oct 10, 2023
0809a48
merge remote dev; resolve conflicts
ruthenian8 Oct 18, 2023
af92f36
move get_current_label to after_handler in sample_data_provider.py
RLKRo Oct 19, 2023
9ae731e
update sql with if statements
ruthenian8 Oct 20, 2023
cd0fc8e
specify healthcheck for clickhouse and wait for healthcheck with otlp…
ruthenian8 Oct 20, 2023
c53ab31
add dashboard-metadata docker image; adjust to run on port 5433
ruthenian8 Oct 20, 2023
32ce2ec
Update .github/workflows/update_dashboard.yml
ruthenian8 Oct 24, 2023
9bfaeac
Update dff/stats/cli.py
ruthenian8 Oct 24, 2023
d73b8d4
remove query statements from dashboard files; remove filter values fr…
ruthenian8 Oct 24, 2023
e8e725d
wait for pg database; sleep to avoid process conflict
ruthenian8 Oct 25, 2023
ec7cf06
Apply suggestions by @RLKRo
ruthenian8 Oct 26, 2023
fb3cf72
Update config files; Update sql expressions in CLI; update healthchec…
ruthenian8 Oct 26, 2023
fa5d550
convert request_id to int in final_nodes
RLKRo Oct 26, 2023
3fad9d6
remove sql in final_nodes
RLKRo Oct 26, 2023
464a2bd
update history filter to numerical range type & change datasource to …
RLKRo Oct 26, 2023
c329025
remove utils include from manifest
RLKRo Oct 26, 2023
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
ruthenian8 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ viz_type: dist_bar
params:
datasource: 2__table
viz_type: dist_bar
slice_id: 16
slice_id: 6
granularity_sqla: start_time
time_range: No filter
metrics:
Expand Down Expand Up @@ -34,11 +34,11 @@ params:
sqlExpression: JSON_VALUE(data, '$.current_topic') <> ''
subject: null
groupby:
- expressionType: SQL
label: My column
sqlExpression: JSON_VALUE(data, '$.current_topic')
columns:
- request_id
columns:
- label: My column
sqlExpression: JSON_VALUE(data, '$.current_topic')
expressionType: SQL
row_limit: 10000
order_desc: true
color_scheme: echarts4Colors
Expand All @@ -47,24 +47,24 @@ params:
bar_stacked: true
order_bars: false
y_axis_format: SMART_NUMBER
y_axis_label: Counts
y_axis_label: Topic counts
y_axis_bounds:
- null
- null
x_axis_label: Topic slot values
x_axis_label: Dialog turn
bottom_margin: auto
x_ticks_layout: auto
extra_form_data: {}
dashboards:
- 1
query_context: '{"datasource":{"id":2,"type":"table"},"force":false,"queries":[{"time_range":"No
filter","granularity":"start_time","filters":[{"col":"data_key","op":"==","val":"get_slots"}],"extras":{"having":"","where":"(JSON_VALUE(data,
''$.current_topic'') <> '''')"},"applied_time_extras":{},"columns":[{"expressionType":"SQL","label":"My
column","sqlExpression":"JSON_VALUE(data, ''$.current_topic'')"},"request_id"],"metrics":["count"],"annotation_layers":[],"row_limit":10000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"2__table","viz_type":"dist_bar","slice_id":16,"granularity_sqla":"start_time","time_range":"No
''$.current_topic'') <> '''')"},"applied_time_extras":{},"columns":["request_id",{"label":"My
column","sqlExpression":"JSON_VALUE(data, ''$.current_topic'')","expressionType":"SQL"}],"metrics":["count"],"annotation_layers":[],"row_limit":10000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"2__table","viz_type":"dist_bar","slice_id":6,"granularity_sqla":"start_time","time_range":"No
filter","metrics":["count"],"adhoc_filters":[{"clause":"WHERE","comparator":"get_slots","datasourceWarning":false,"expressionType":"SIMPLE","filterOptionName":"filter_sz14lhn7d1d_c0zqn5dpgk","isExtra":false,"isNew":false,"operator":"==","operatorId":"EQUALS","sqlExpression":null,"subject":"data_key"},{"clause":"WHERE","comparator":null,"datasourceWarning":false,"expressionType":"SQL","filterOptionName":"filter_945dhn41x2m_sci7gkxy7o","isExtra":false,"isNew":false,"operator":null,"sqlExpression":"JSON_VALUE(data,
''$.current_topic'') <> ''''","subject":null}],"groupby":[{"expressionType":"SQL","label":"My
column","sqlExpression":"JSON_VALUE(data, ''$.current_topic'')"}],"columns":["request_id"],"row_limit":10000,"order_desc":true,"color_scheme":"echarts4Colors","show_legend":true,"rich_tooltip":true,"bar_stacked":true,"order_bars":false,"y_axis_format":"SMART_NUMBER","y_axis_label":"Counts","y_axis_bounds":[null,null],"x_axis_label":"Topic
slot values","bottom_margin":"auto","x_ticks_layout":"auto","extra_form_data":{},"dashboards":[1],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
''$.current_topic'') <> ''''","subject":null}],"groupby":["request_id"],"columns":[{"label":"My
column","sqlExpression":"JSON_VALUE(data, ''$.current_topic'')","expressionType":"SQL"}],"row_limit":10000,"order_desc":true,"color_scheme":"echarts4Colors","show_legend":true,"rich_tooltip":true,"bar_stacked":true,"order_bars":false,"y_axis_format":"SMART_NUMBER","y_axis_label":"Topic
counts","y_axis_bounds":[null,null],"x_axis_label":"Dialog turn","bottom_margin":"auto","x_ticks_layout":"auto","extra_form_data":{},"dashboards":[1],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
cache_timeout: null
uuid: a70c05d0-770b-4068-a55d-934283f5b1bb
version: 1.0.0
Expand Down
6 changes: 5 additions & 1 deletion dff/config/superset_dashboard/charts/Requests_17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ params:
table_timestamp_format: smart_date
show_cell_bars: true
color_pn: true
column_config:
data:
columnWidth: 150
truncateLongCells: true
extra_form_data: {}
dashboards: []
query_context: '{"datasource":{"id":2,"type":"table"},"force":false,"queries":[{"time_range":"No
filter","granularity":"start_time","filters":[{"col":"data_key","op":"==","val":"get_last_request"}],"extras":{"time_grain_sqla":"P1D","having":"","where":""},"applied_time_extras":{},"columns":["context_id","request_id","start_time",{"label":"data","sqlExpression":"JSON_VALUE(data,
''$.last_request'')","expressionType":"SQL"}],"orderby":[],"annotation_layers":[],"row_limit":1000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{},"post_processing":[]}],"form_data":{"datasource":"2__table","viz_type":"table","granularity_sqla":"start_time","time_grain_sqla":"P1D","time_range":"No
filter","query_mode":"raw","groupby":[],"all_columns":["context_id","request_id","start_time",{"label":"data","sqlExpression":"JSON_VALUE(data,
''$.last_request'')","expressionType":"SQL"}],"percent_metrics":[],"adhoc_filters":[{"expressionType":"SIMPLE","subject":"data_key","operator":"==","operatorId":"EQUALS","comparator":"get_last_request","clause":"WHERE","sqlExpression":null,"isExtra":false,"isNew":false,"datasourceWarning":false,"filterOptionName":"filter_4amlkzz0hd3_exx83iz5rof"}],"order_by_cols":[],"row_limit":1000,"server_page_length":10,"include_time":false,"order_desc":true,"table_timestamp_format":"smart_date","show_cell_bars":true,"color_pn":true,"extra_form_data":{},"dashboards":[],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
''$.last_request'')","expressionType":"SQL"}],"percent_metrics":[],"adhoc_filters":[{"expressionType":"SIMPLE","subject":"data_key","operator":"==","operatorId":"EQUALS","comparator":"get_last_request","clause":"WHERE","sqlExpression":null,"isExtra":false,"isNew":false,"datasourceWarning":false,"filterOptionName":"filter_4amlkzz0hd3_exx83iz5rof"}],"order_by_cols":[],"row_limit":1000,"server_page_length":10,"include_time":false,"order_desc":true,"table_timestamp_format":"smart_date","show_cell_bars":true,"color_pn":true,"column_config":{"data":{"truncateLongCells":true,"columnWidth":150}},"extra_form_data":{},"dashboards":[],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
cache_timeout: null
uuid: 45ef67db-d33d-49f5-8d46-1f0fa518eaac
version: 1.0.0
Expand Down
6 changes: 5 additions & 1 deletion dff/config/superset_dashboard/charts/Responses_16.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ params:
table_timestamp_format: smart_date
show_cell_bars: true
color_pn: true
column_config:
data:
columnWidth: 150
truncateLongCells: true
extra_form_data: {}
dashboards: []
query_context: '{"datasource":{"id":2,"type":"table"},"force":false,"queries":[{"time_range":"No
filter","granularity":"start_time","filters":[{"col":"data_key","op":"==","val":"get_last_response"}],"extras":{"time_grain_sqla":"P1D","having":"","where":""},"applied_time_extras":{},"columns":["context_id","request_id","start_time",{"label":"data","sqlExpression":"JSON_VALUE(data,
''$.last_response'')","expressionType":"SQL"}],"orderby":[],"annotation_layers":[],"row_limit":1000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{},"post_processing":[]}],"form_data":{"datasource":"2__table","viz_type":"table","granularity_sqla":"start_time","time_grain_sqla":"P1D","time_range":"No
filter","query_mode":"raw","groupby":[],"all_columns":["context_id","request_id","start_time",{"label":"data","sqlExpression":"JSON_VALUE(data,
''$.last_response'')","expressionType":"SQL"}],"percent_metrics":[],"adhoc_filters":[{"expressionType":"SIMPLE","subject":"data_key","operator":"==","operatorId":"EQUALS","comparator":"get_last_response","clause":"WHERE","sqlExpression":null,"isExtra":false,"isNew":false,"datasourceWarning":false,"filterOptionName":"filter_m3nzyr545di_lxjaivcal1"}],"order_by_cols":[],"row_limit":1000,"server_page_length":10,"include_time":false,"order_desc":true,"table_timestamp_format":"smart_date","show_cell_bars":true,"color_pn":true,"extra_form_data":{},"dashboards":[],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
''$.last_response'')","expressionType":"SQL"}],"percent_metrics":[],"adhoc_filters":[{"expressionType":"SIMPLE","subject":"data_key","operator":"==","operatorId":"EQUALS","comparator":"get_last_response","clause":"WHERE","sqlExpression":null,"isExtra":false,"isNew":false,"datasourceWarning":false,"filterOptionName":"filter_m3nzyr545di_lxjaivcal1"}],"order_by_cols":[],"row_limit":1000,"server_page_length":10,"include_time":false,"order_desc":true,"table_timestamp_format":"smart_date","show_cell_bars":true,"color_pn":true,"column_config":{"data":{"truncateLongCells":true,"columnWidth":150}},"extra_form_data":{},"dashboards":[],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
cache_timeout: null
uuid: 7844eb6d-4fce-44cf-8994-fb61a221a2ab
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ position:
code: '## Flow visit ratio monitor


Thus chart aggregates the ratio of visits for each flow over the whole period
This chart aggregates the ratio of visits for each flow over the whole period
of service uptime. The aggregation period can be set to shorter time spans
using the filters on the left.'
height: 17
Expand Down
2 changes: 1 addition & 1 deletion dff/utils/testing/toy_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"have_pets": ["yes"],
"like_animals": ["yes"],
"what_animal": ["bird", "dog"],
"ask_about_breed": ["pereat", "bulldog", "i do not known"],
"ask_about_breed": ["pereat", "bulldog", "I don't know"],
ruthenian8 marked this conversation as resolved.
Show resolved Hide resolved
},
"news": {
"what_news": ["science", "sport"],
Expand Down
6 changes: 3 additions & 3 deletions docs/source/user_guides/superset_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ in order to obtain sample data points to visualize.

.. code-block:: shell

export DISABLE_INTERACTIVE_MODE=1 && python tutorials/stats/3_sample_data_provider.py
python tutorials/stats/3_sample_data_provider.py

Displaying the data
~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -106,11 +106,11 @@ Using Superset

Service stats plots.

* The `Annotations` section contains example charts that show how annotations from supplemental pipeline services can be viewed and analyzed.
* The **Annotations** section contains example charts that show how annotations from supplemental pipeline services can be viewed and analyzed.

On some occasions, Superset can show warnings about the database connection being faulty.
In that case, you can navigate to the `Database Connections` section through the `Settings` menu and edit the `dff_database` instance updating the credentials.

.. figure:: ../_static/images/databases.png

Locate the database settings in the right corner of the screen.
Locate the database settings in the right corner of the screen.
28 changes: 16 additions & 12 deletions tutorials/stats/3_sample_data_provider.py
ruthenian8 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
default_extractors,
OtelInstrumentor,
)
from dff.utils.testing import is_interactive_mode
from dff.utils.testing.toy_script import MULTIFLOW_SCRIPT, MULTIFLOW_REQUEST_OPTIONS

# %%
Expand All @@ -43,12 +42,12 @@ async def get_slots(ctx: Context, _, info: ExtraHandlerRuntimeInfo):


def confidence_processor(ctx: Context):
ctx.framework_states["response_confidence"] = random.random()
ctx.misc["response_confidence"] = random.random()


@dff_instrumentor
async def get_confidence(ctx: Context, _, info: ExtraHandlerRuntimeInfo):
data = {"response_confidence": ctx.framework_states["response_confidence"]}
data = {"response_confidence": ctx.misc["response_confidence"]}
return data


Expand All @@ -61,17 +60,19 @@ async def get_confidence(ctx: Context, _, info: ExtraHandlerRuntimeInfo):
"components": [
Service(slot_processor_1, after_handler=[get_slots]),
Service(slot_processor_2, after_handler=[get_slots]),
Service(confidence_processor, after_handler=[get_confidence]),
Service(
handler=ACTOR,
before_handler=[default_extractors.get_timing_before],
before_handler=[
default_extractors.get_timing_before,
default_extractors.get_current_label,
],
after_handler=[
default_extractors.get_timing_after,
default_extractors.get_current_label,
default_extractors.get_last_request,
default_extractors.get_last_response,
],
),
Service(confidence_processor, after_handler=[get_confidence]),
],
}
)
Expand All @@ -81,6 +82,11 @@ async def get_confidence(ctx: Context, _, info: ExtraHandlerRuntimeInfo):
async def worker(queue: asyncio.Queue):
"""
Worker function for dispatching one client message.
The client message is chosen randomly from a predetermined set of options.
It simulates pauses in between messages by calling the sleep function.

The function also starts a new dialog as a new user, if the current dialog
ended in the fallback_node.

:param queue: Queue for sharing context variables.
"""
Expand All @@ -95,18 +101,17 @@ async def worker(queue: asyncio.Queue):
answers = list(MULTIFLOW_REQUEST_OPTIONS.get(flow, {}).get(node, []))
in_text = random.choice(answers) if answers else "go to fallback"
in_message = Message(text=in_text)
await asyncio.sleep(random.random() * 2)
await asyncio.sleep(random.random() * 3)
ctx = await pipeline._run_pipeline(in_message, ctx.id)
rand_interval = float(random.randint(0, 1)) + random.random()
await asyncio.sleep(rand_interval)
await asyncio.sleep(random.random() * 3)
await queue.put(ctx)


# %%
# main loop
async def main(n_iterations: int = 100, n_workers: int = 4):
"""
Main loop that runs one or more worker coroutines in parallel.
The main loop that runs one or more worker coroutines in parallel.

:param n_iterations: Total number of coroutine runs.
:param n_workers: Number of parallelized coroutine runs.
Expand All @@ -120,5 +125,4 @@ async def main(n_iterations: int = 100, n_workers: int = 4):


if __name__ == "__main__":
if is_interactive_mode():
asyncio.run(main())
asyncio.run(main())