Kibana (current version) - Not showing string type fields in visualization - charts

I am using current version of Kibana, not showing string type fields to select for x-axis (Line or Bar charts). Am I missing anything here?
Here is my sample json. How to breakdown by IterationName?
JSON
{
"iterationName":"Sprint 60",
"manualEffortInSec":300,
"automationEffortInSec":100,
"hrlyRate":150,
"manualEffortCost":750,
"automationEffortCost":250,
"verdictInteger":1
}

for visualizing fields in buckets(x-axis) you should, for example, choose the "Terms" and under that choose your field which is "iterationName".
this part shows all the fields regardless of their type.
maybe there is a problem in your mapping, it is better to go to the discover tab and check the fields of your index pattern to see if all the fields are indexed or not

Related

iText DITO - How can I use a fields Data name as a reference in a calculation?

In iText's DITO template designer product, I have one field which has a fairly complex calculation. In another field, I want to use the result of that calculation.
The tooltip says "Identifier used for referencing fields in calculation expressions". So I assumed if I named it blah I can use it in a calculation in another field like this: sum({{blah}},42) (e.g. add 42 to the value of blah). But if I do that I get the error
Unable to resolve reference: "{{blah}}" in node with tag: <span> and text:
The iText DITO documentation does not elaborate on this feature at all. I'm evaluating iText DITO and there does not seem to be any way to get support while evaluating the product.
Suppose I have a field with a very complex calculation. In order to reuse the calculation result, I can do the following:
Give a name to this field (in the image below I've chosen name "total")
Insert a calculation to another field (where I want to reuse "total")
Add "total" as the calculation's body:
That's it, now the total value is reused:
I think the documentation you are looking for is at https://kb.itextpdf.com/home/ditokb/latest/manuals/itext-dito-editor/calculations
You have to give the rich text element a name in the properties to be able to reference it on other rich text element and/or calculations.
See image example at https://kb.itextpdf.com/home/ditokb/files/latest/68620314/68620309/1/1660291029000/image2020-5-27_17-56-41.png

Display subset of data based on string pattern on template variable dropdown in table panel

Grafana Version: 6.2.5
Elastic search
I have logs data with pattern ERR,INFO,DEBUG
Example “data_ERR_notconnected”, “sys_INFO_connected”, “sys_DEBUG_network”
I am trying to create template variable for ‘marker’ with variable dropdown as ERR,INFO,DEBUG. So when ERR is clicked from dropdown only error based data is displayed in table format panel.
Drop down image
regex used
I am using regex as /.*(ERR|INFO|SH)/ but i dont see any change in response. Basically i am not able to group a values based on string pattern in a template variable? Is there anyway i could group the values based on string pattern? Any idea would be helpful?
Replace your regex with /.*_(ERR|INFO|SH)_.*/
This should give you ERR, INFO, SH as value of the dropdown

Prometheus & Grafana: templating and "bool" modifier

I am building Grafana (4.1.1) graphs with a Prometheus (1.1.2) backend, and am trying to use Templates to select/deselect certain sub-sets of metrics on a dashboard. I have a template variable called "$POP" which describes my city locations, and a template variable called "$Resolver" which describes the type of resolver I am using ("unbound" or "pdns" are the possible string results.)
I have these two metrics like this that work quite well currently selecting on the various values in $POP:
irate(dnsdist_recursor_main_servers_unbound_drops{env="prod",loc=~"$POP"}[1m]) > 0
irate(dnsdist_recursor_main_servers_pdns_drops{env="prod",loc=~"$POP"}[1m]) > 0
Putting aside for the moment that instead of labels the selection criteria are embedded in the metric name (I know it's not ideal but this is just an example of larger problem sets so please do not suggest how I can use labels) I would like the following results:
When (~"$Resolver" == "unbound") I would like to show the first metric (dnsdist_recursor_main_servers_unbound_drops) and when (~"$Resolver" == "pdns") I would like to show the second one (dnsdist_recursor_main_servers_pdns_drops) and when both are selected I'd like to show both metric set data. Basically, I hope to have an on/off visibility trigger for a metric that is keyed to my $Resolver template value.
How do I create a boolean such that the metric is shown or not shown based on the setting of the string value in the templated setting of $Resolver? The trick here is that the selection criteria is in the metric name, not a label, which is really stumping me. I tried "bool" modifiers but was never able to get anything to work on string equality tests. I'm sure it's just a syntax issue but examples are thin on the ground.
What you can take advantage of here is that there's no uniqueness restriction on label selectors, so you can do {resolver="$resolver",resolver="unbound"}

Kentico 9 macro for form field visibility

I have a custom page type, and the editor will have the option to enter the following
Image (from media library)
Video (from media library)
YouTube video ID
The field names are as follows
SlideImage
SlideVideo
YouTubeVideoID
So, if an editor ads a SlideImage, SlideVideo and YouTubeVideoID should not be usable. Same for SlideVideo and YouTubeVideoID.
Within the Visibility Condition fields, i'm going to assume a macro is needed for this. My logic is:
This field visible if Field A or B have data.
A possible approach can be to add an additional field, which determines the field that should be used.
Create a text field (let's say, SlideType) and use a radio button form control with your options:
image;Image
video;Video
youtube;YouTube
Tick the "Has depending fields" checkbox for this field, and tick the "Depends on another field" checkbox for the SlideImage, SlideVideo and YouTubeVideoID fields.
Your visibility conditions would then be simplified, instead of checking the values of multiple fields.
For example, the visibility condition for the SlideVideo field would be:
SlideType == "video"
This has a few benefits:
Easy to add new fields and configure the visibility conditions
Easy to check what needs to be rendered in the front-end - in your repeaters and other webparts, you can simply have conditional statements on the SlideType field to determine which field to use
Intuitive for the end user - the interface makes it clear which field is being used
Add this to Visibility condition in Page type field edit:
Fields.SlideImage.Value == String.Empty
Do not forget to set proper Has depending fields and Depends on another field properties depending on your needs. You can learn more about these properties here.
Let's say the column name on which this value of your depending field is "FirstName", so you can write in the dependent field -> Visibility Condition as
FirstName.value != ""
or
FirstName.value
You can twist the conditions for as many conditions as possible and can club more than one condition too.
I am also sharing links with you having a lot of examples from Kentico support
Dependency fields in Kentico
Using dependency fields in forms
Cheers,
Chetan

How do I write a Prometheus query that returns the value of a label?

I'm making a Grafana dashboard and want a panel that reports the latest version of our app. The version is reported as a label in the app_version (say) metric like so:
app_version_updated{instance="eu99",version="1.5.0-abcdefg"}
I've tried a number of Prometheus queries to extract the version label as a string from the latest member of this time series, to no effect.
For example, the query
count(app_version_updated) by (version)
returns a {version="1.5.0-abcdefg"} element with a value of 1. When put in a Grafana dashboard in a single value panel, this doesn't display the version string but instead the count value (1).
How can I construct a Prometheus query that returns the version string?
My answer tries to elaborate on Carl's answer. I assume that the GUI layout may have changed a little since 2016, so it took me while to find the "name" option.
Assuming you have a metric as follows:
# HELP db2_prometheus_adapter_info Information on the state of the DB2-Prometheus-Adapter
# TYPE db2_prometheus_adapter_info gauge
db2_prometheus_adapter_info{app_state="UP") 1.0
and you would like to show the value of the label app_state.
Follow these steps:
Create a "SingleStat" visualization.
Go to the "Queries" tab:
Enter the name (here db2_prometheus_adapter_info) of the metric.
Enter the label name as the legend using the {{[LABEL]}} notation (here {{app_state}}).
Activate the "instant" option.
Go to the "Visualization" tab:
Choose the value "Name" under "Value - Stat".
Note on the "Instant" setting: This setting switches from a range query to a simplified query only returning the most recent value of the metric (also see What does the "instant" checkbox in grafana graphs based on prometheus do?). If not activated, the panel will show an error as soon as there is more than one distinct value for the label in the history of the metric. For a "normal" metric you would remedy this by choosing "current" in the "Value - Stat" option. But doing so here prevents your label value to be shown.
We recently added support for displaying the serie name as a value in the single stat panel (https://github.com/grafana/grafana/issues/4740). So you have to run our nightly build until we release 4.0.
Just make sure the query returns one serie and you can use the "name" value in the dropdown under Options -> big value.Then you can format the string using the legend formater. Ex {{job}} would return "node" as a serie name.
I hope this answers your question.
While most of #marcus-rickert's answer is still valid in Grafana 7, there is some change.
The 'Stat' 'Name' field seems to be gone, instead in the 'Field' panel, you can set the 'Display name' to the label you want to show.
This worked for me.
label_values(my_metric{type= "xxx", another_label="xxx"},target_label)
With Stat visualization in Grafana 8+, you can set the legend to the intended label name and then change the Stat Styles -> Text Mode to Name
Prometheus doesn't have any functions that return strings, what you're looking for is for a Grafana singlestat to be able to display a label value - which it unfortunately doesn't support yet.
https://github.com/grafana/grafana/issues/5094 tracks this.
Another update on very latest kube-prometheus-stack using grafana 8.0.3. I still faced this issue, for me in a Bar gauge I still had this issue in scenarios where it only returned 1 value, but with 2+ values the Legend field works OK.
My solution:
Go to Edit Panel, find Display Name, type
${__field.labels.insertYourLegendValueHere}
I wanted to get all the various values of a label from Prometheus to put into a variable in Grafana. I used this simple query to populate my varialbe Drop-Down list:
label_values(myLabelName)
This returned the expected "value01", "value02" etc