Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

[Feature Request] Custom YLabel based on original series and ExtraInfo field on tooltip #152

Closed
sbengo opened this issue Dec 2, 2020 · 2 comments · Fixed by #153
Closed
Milestone

Comments

@sbengo
Copy link
Contributor

sbengo commented Dec 2, 2020

Hi @diafour,

First of all, thanks for this awesome plugin!
I'm using it with Flux (BETA) datasource on Grafana 6.6.3 to show discrete results based on probes executions.

Overview

I need to provide meta-information to each series in order to give more information to the user, and the only way that we have is setting up on the YLabel (format as _field on Flux DS or Alias on other DS). The problem is that if I customize the Alias, I will lose the variable nedeed for link creation, provided by the scopedVars as ${__y_label}

Proposal

To achieve that, I have been working with StatusMap and I added the following fields in order to be able to split the original target series (based on how boomtable-panel works) to:

  • The splitted values will be stored as part of the Bucket and BucketMatrix and will be visible as ${__y_label_N} variables on link
  • Create a custom YLabel over the original targets that will allow the user to setup a custom YLabel. This YLabel is set up as the core target and it will be possible to merge different series into one (if you have a variable name, like hash on containers name)

Additionally, as I need to show the metadata based on each series/execution, I created a new option on the Tooltip section - Extra Info - to:

  • Allow the user to embed a custom text/html into the tooltip using already available scopedVars and the new ${__y_label_N}

So, I will submit a PR on the following hours with the above implementations. The final result of a real case (explained below) is the following:

image

Thanks,
Regards!

Real use case:

Original series (after a join between InfluxDB and PostgresSQL using Flux language). Series pattern is: name=th1=th2=th3=org

 webrobot-chome-79-2=13000=14000=15000=marketing-org-probes
 webrobot-chome-79=12500=12600=18000=marketing-org-probes

Y-Label section configuration:

image

Label splitter:  "="
Label override: "Suite: ${__y_label_0}"

This will override the YLabel (and its internal target when mapping targets on Bucket object) to the following, with the partials:

yLabel: "Suite:  webrobot-chome-79-2"
pLabels: [" webrobot-chome-79-2", "13000", "14000", "15000", "marketing-org-probes"]

yLabel: "Suite:  webrobot-chome-79"
pLabels: [" webrobot-chome-79", "12500", "12600", "18000", "marketing-org-probes"]

The goal now is show those thresholds, different for each serie to the user based on a field that is not shown:

Extra tooltip:

image

<center style="min-width: 400px; margin-top: 5px"><b>Runtime - ${__value_1} ms</b></center>
<dl class="row"><dt class="col-sm-3">Thresholds</dt>
<dd class="col-sm-9">
<table style="width:100%"><tr><td>
<span><i class="fa fa-circle" style="color: rgb(25, 234, 165)"> </i> OK</td> <td align="right">< ${__y_label_1}ms</span></td></tr>
<tr><td><span><i class="fa fa-circle" style="color: rgb(248, 192, 0)"> </i> OK - High Runtime </td><td align="right">${__y_label_1}ms >= X < ${__y_label_2}ms</span></td></tr>

<tr><td><span><i class="fa fa-circle" style="color: rgb(245, 161, 17)"> </i> OK - Critical Runtime </td> <td align="right">${__y_label_2}ms >= X < ${__y_label_3}ms</span></td></tr>
<tr><td><span><i class="fa fa-circle" style="color: #e80661"> </i> OK - Fatal Runtime </td><td align="right"> >= ${__y_label_3}ms</span></td></tr></table></dd></dl>

Finally, use the partial YLabel to create a link using org, directly from the serie:

image

URL: "d/DETAILED/?var-org=${__y_label_4}
> Serie - Suite:  webrobot-chome-79-2" = d/DETAILED/?var-org=marketing-org-probes"
> Serie - Suite:  webrobot-chome-79" = d/DETAILED/?var-org=marketing-org-probes" 

Final tooltip result:

image

@diafour
Copy link
Collaborator

diafour commented Dec 2, 2020

Wow! Huge work! I'd like to say that problem with one string in Field/Alias is not a problem in Grafana 7.0+, where Data Frames are available. Each Data Frame contains metadata, fields, tags from query and you can use Transform tab to shape query results to your needs. I've created issue #150 to support this data format.

Some naming considerations:
image

"Y-Label" => "Y-axis label"
"Split Y-label" => "Split query alias" + add popup with info about variables and alias/field/legend from query editor.
"Label splitter" => "Delimiter"
"Label override" => "Label template"

image

"Extra info" (header) => "Custom content"
"Show extra info" => "Show custom content"
"Extra info" => "Template"

Also, there was an idea to implement different types of "Items". "Custom content" is a good new item type. As I can see, this content has one instance and is always shown before URLs. If "Custom content" will be an Item, we can mix URLs and contents. Feel free to implement it this way if it's interesting for you.

@sbengo
Copy link
Contributor Author

sbengo commented Dec 2, 2020

Hi @diafour ,

Thanks for the quick response, about the Data Frame, I knew it was, but due to limitations with our environment, we cannot upgrade to Grafana 7.0+ yet...

Naming considerations already implemented on the PR #153 .
Just a comment, the "Split query alias" toggle, just enables the other fields. The popover are on the other fields that, if they are not filled, they won't split the query at all.

About the item class, it will be quite interesting but I think it can be addressed in other PRs as it will need to do migration from what is defined now as item.

Thanks,
Regards!

@diafour diafour added this to the 0.4.0 milestone Feb 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants