I'm using Grafana table panel to show status of my application.
Currently in Prometheus metrics, I'm returning 1 and 0. Where, 1 mean pass and 0 means fail.
On table view it is also showing as 0 & 1.
Can I change the Prometheus query to return 'PASS' when value is 1, 'FAIL' otherwise?
I faced similar for a graph. I had to convert int value to text for metric. I managed the situation by converting the value to text by using CAST. Simply use the CAST in your metric column. Please note that, I'm using PostgreSQL as a DataSource.
Please check below image for the casting example:
I believe you should look the way to change the display in Grafana.
Under Edit option of the panel
Check the overrides option where you can select
Override fields with name and select value mappings
Add Value mappings as per your requirement
I have also took the screenshot as per the numbers for your reference.
Related
I have a gender of a person and i want to create such filter
How can i set deafault "men" value in this filter?
When user select another value and then deselect value i need to
return default value in the filter
I've already tried to create such a calculated field, but it does not work with
MIN({FIXED: COUNTD([gender])}) <> MIN({EXCLUDE [gender]: COUNTD([gender])}) OR MIN([gender])="men"
There are several tutorials about creating a default value for filtering (and several different techniques), one of them is this one: Dynamic Parameters, Default Values and the Flexibility to Choose
For me, if you just have to put "men" as default (I mean, not a calculated value, like today's DateTime), you can just filter man before publishing your dashboard to Tableau Server/Tableau Online and every use that navigates your content will find this value selected.
I created a SQL query that counts the number of servers running test jobs on a specific Jenkins server at a specified time. I'm trying to chart it on Grafana but for some reason, it's displaying the value as NaN.
The data source is a MySQL server. I'm running Grafana version 8.1.5. I went on the server (phpMyAdmin) to check the results of the query and I can see numbers.
When we look at the grafana chart/panel, the bars on the chart look like it matches the values, but the chart shows NaN instead of the value.
What setting do I need to change so that it can print the numeric value on the chart instead of displaying NaN?
EDIT: Looks like I didn't include enough info to my question.
Here's the query that's used, although, I don't know how feasible it is to include the tables with data to demo the issue:
SELECT COUNT(DISTINCT(tb_name)) as val, jenkins FROM (
SELECT
hw.collected_date AS mytime,
hw.jenkins AS jenkins,
hw.name AS tb_name
FROM hw_report as hw LEFT OUTER JOIN jenkins_owner jo
ON hw.jenkins = jo.jenkins
WHERE jo.org IN ('Enterprise Readiness')) as y
WHERE mytime = '2021-12-03 00:00:00'
GROUP BY jenkins
HAVING count(distinct(tb_name)) > '0'
Here are screenshots of my panel. The "Show values" setting is set to "Always", which II assume should show the values.
One thing I noticed is when I hover over the bar, it shows
COUNT(DISTINCT(name_cnt))
instead of a numeric value. Not sure if this is indicative of anything. I checked other charts in the dashboard that someone created and their bars either have a numeric value or it's just a column name (like name_cnt)
Sorry I'm a noob and didn't know what to configure, look up, or mention in my question. I accidentally came across the answer.
So it seems like I need to select something under the "Transform" tab for the panel. Calculation needs to be "Total" instead of "Count" and I need to hide the fields specified in my SQL query and show the "Total"
In Prometheus exists some custom metrics from DB
In Graphana I maked Graph Dashboard with datasource from Prometheus
count(custom_metrics_project1<1)
If condition custom_metrics_project1<1 not found any metrics Graphana displays Points not found.
How change condition to be displyed 0?
You can select how to display NULL values in the edit menu for a given graph.
Please follow these steps:
click on your graph
click on edit to bring up the edit menu for the graph
switch to the tag Display
choose one of the options from the Null Value dropdown
The option you want is: null as zero.
Just use count(custom_metrics_project1<1) or on() vector(0). This will substitute all the gaps with zeroes. See docs for or operator and docs for vector() function.
Note that the q or on() vector(0) trick works only when q returns a single time series. If q returns multiple time series, then Prometheus doesn't provide an easy way to fill gaps in every time series with zeroes :(
If you still need to fill gaps in multiple time series, then you can use default operator in VictoriaMetrics. For example, the following query would fill all the gaps for all the time series returned from q with zeroes:
q default 0
VictoriaMetrics also provides interpolate, keep_last_value and keep_next_value functions, which can be used for filling gaps in more sophisticated ways.
I'm trying to have a chart be blank rather than showing results if the size of the data that populates the chart is too small. I have a variable ID in which each case has a unique value. In a case where I don't want any data to show if there are less than 10 cases, I figured I'd need to set up a calculated field that would do something like the following:
IF COUNTD([ID]) < 10 THEN ....
But I can't figure out what command to call so that it shows no data. Would anyone have a pointer?
You can create a calculated filed with calculation "COUNTD([ID])<10" .It would be a Boolean filter.Now drag and drop the calculation to the filter shelf and set it to either "TRUE" or "Exclude False".
I have a parameter and a calculated field
Parameter - "Hierarchy" (which is a string - '1', '2', '3')
Calculated Field - "Division" (which is based on the Hierarchy chosen)
Case 1 display '' (nothing)
Case 2 and 3 show Dimension A
My question - when I select a value 'X' from Division, when the parameter is set to 2 or 3. The value 'X' remains, when I switch to 1. I would like this to default to the 'All' values.
I don't have data for 'X' at level 1 hierarchy. So, my graphs shows nothing, which isn't good.
Does anyone know how to script this to default to 'All' when I revert selection to '1' (and I don't mean the string 'All', I mean the ALL values selection used in filtering.
Thanks,
gemmo
Assuming you are using quick filters, try setting your quick filter to display "Only Relevant Values" instead of "All Values in Database". I think that's the default setting, so that's likely not the complete solution to your problem -- but its something you can check quickly before diving deeper.
Another thing to check - what data source are you using? Some data sources have limitations, in particular, the MS Jet engine used for MS Access, Excel and text files apparently doesn't handle sets in filters (among other limitations). Tableau announced at their 2013 customer conference that they planned to replace the Microsoft Jet Engine in Tableau 8.2 (again -- I'm not sure that's your issue here)
I don't think tableau have this level of programmability. In short - can't be done at the moment. Research didnt bear any fruit
I was able to do this but it took an extra calculated field to make it work. Inside your parameter add the Value "All" and Display as "All".
Then create a calculated field with a case statement that returns 'All' for every value in your field's set. Something like this for you:
CASE Parameter
WHEN 1 THEN 'All'
WHEN 2 THEN 'All'
WHEN 3 THEN 'All'
END
I named it _All. Then add to or create a T|F calculated field to add to your filter pane. Add this to the field.
[_All] = [Parameter]
You should see then be able to select "All" in your parameter control and have it show all values.