Transformation does not calculate Total, Mean correctly

Using Transformation when there are blank/null or Zero values causes incorrect Total or Mean calculations … is this a known issue or something to do with the data type of the field ? I tried giving 0 and also converting the data type to Numeric in the Query … still the issue persists … Grafana version is 9.3

Query
select A,B, count(*) :: int as Count
from table_name
group by A,B
order by 1

PS: There is a transformation before the above , that does transpose of data using “Grouping to matrix”

In the case of the image you posted what part is wrong?

Also what is your data source?

The totals highlighted in yellow … shows 16 +6 = 166 (string concat rather than addition)
and the next row result (15+409+18) = 4218 … not the math i learnt :smiley:

For sure :smile: I have seen this as a bug. Can you see if latest 9.x still has this issue?

will try on latest G10, but for now i am on 9.3.2 … tried using Volkov DynamicText and solved using js

image

2 Likes

And the latest dynamic text you can import external js and css

1 Like

Glad it worked for you.

@yosiasz Have you tried it? We will release a new version with external js/css next week.

1 Like

hey @mikhailvolkov I thought it was released in 4.0.0 :crazy_face:

Was planning to use it like following

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">

or

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap demo</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
  </head>
  <body>
    <h1>Hello, world!</h1>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
  </body>

but will wait till released and read up on the doco for it

1 Like

unless I can clone

and build locally and test?

You can download the latest signed CI artifact to test: Add External JavaScript, CSS Resources (#197) · VolkovLabs/volkovlabs-dynamictext-panel@2ff9233 · GitHub

Sanitizing should be disabled to see the panel options. Links have to be swapped :slight_smile:

Screenshot 2023-07-14 at 12.55.20

We don’t support link and script tags for security reasons and to ensure that scripts is loaded before rendering the panel.

1 Like

this is yuuuge, game changer!

1 Like

Looks great!

thanks for addressing this ask Mikhail …

tested with 4.1 and seems working wonderfully !! 1 minor issue though with “refresh interval” feature … the global js calls are not being made … guess can live with this for now :slight_smile:

1 Like

We release Dynamic Text 4.1.0 and submitted it to the Grafana team for review: GitHub - VolkovLabs/volkovlabs-dynamictext-panel at v4.1.0.

What kind of data source do you use in the panel? The panel does not subscribe to Refresh Event. It relies on the Data Source to refresh the data and re-render the panel.

currently postgres but this is a special case - relying on web page events than datasource events alone :slight_smile:

1 Like

@samant You can subscribe to the Refresh Event in the Dynamic Text panel yourself since v4. Make sure you unsubscribe from all events to avoid memory leaks.

1 Like

Thanks @mikhailvolkov for this tip ! Will try

1 Like