Skip to content
Snippets Groups Projects
Commit fc020873 authored by Christoph Alt's avatar Christoph Alt
Browse files

fixed variable condition

parent 7ce0369a
Branches
No related merge requests found
Pipeline #42959 passed with stages
in 14 seconds
......@@ -111,6 +111,7 @@ def get_stat_panel(title: str, dataSource: str, stat_query: Query, **kwargs):
graphMode='area',
reduceCalc='last',
orientation='auto',
transparent=True,
targets=[
get_influx_target(str(stat_query), alias="$tag_name")
],
......
......@@ -249,7 +249,7 @@ def dashboard_general_infos():
return Query(
select_="duration",
from_=measurment_name,
where_=join_conditions([f'"name" =~ /{name_base}/', get_variable_condition('host', tag_key='name')],
where_=join_conditions([f'"name" =~ /{name_base}/', f'"name" =~ /${host_var.name}/'],
"AND"),
group_by=[
'name'
......
......@@ -38,7 +38,7 @@ def get_variable_condition(variable_name: str, *, tag_key: str = None) -> str:
clean_lhs = clean_rhs
if not clean_rhs:
raise ValueError("Empty variable name")
return f'"{clean_lhs}" =~ /${clean_rhs}$/'
return f'"{clean_lhs}" =~ /^${clean_rhs}$/'
def join_conditions(conditions: List[str], operators: Union[List[str], str]):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment