27 Dec 2023 09:10 AM - last edited on 28 Dec 2023 11:23 AM by Ana_Kuzmenchuk
HI,
I created this filter, and I want to add another filter in addition that I can see by ZONE
I can Search but the list to long so i what to add another filer
can you help 🙂
Solved! Go to Solution.
27 Dec 2023 09:29 AM
I did it this way
But he doesn't cut and filter for the big list
27 Dec 2023 09:55 AM
Hi,
Do you need something like this?
27 Dec 2023 10:00 AM
Or like this
27 Dec 2023 12:30 PM - edited 27 Dec 2023 12:34 PM
thanks 🙂
How can I fix this?
And How I add a Tags filter ?
In the category "Properties and tags"
I made an association based on Tags
28 Dec 2023 08:51 AM
Can you post whole query?
28 Dec 2023 08:54 AM
To filter a tag you just need something like this:
fetch dt.entity.service
| fields entity.name, managementZones, tags
| filter matchesValue(tags, "TAG you looking for")
28 Dec 2023 09:23 AM
HI,
/*
* This function will run in the DYNATRACE JavaScript runtime.
* For information, visit https://dt-url.net/functions-help
*/
import { metricsClient } from '@dynatrace-sdk/client-classic-environment-v2';
export default async function fetchMetricResults() {
const serviceSelection = $Service;
const metricKey = "builtin:service.errors.total.rate";
const config = {
metricSelector: buildQuery(serviceSelection, metricKey),
resolution: "Inf",
from: $dt_timeframe_from,
to: $dt_timeframe_to,
acceptType: "application/json; charset=utf-8"
};
if (config.metricSelector.length > 3500) {
return "Please select fewer services";
}
const metricQuery = await metricsClient.query(config);
const processedResults: MetricResult[] = metricQuery.result[0].data.map(result => {
return {
"Service Name": result.dimensionMap["dt.entity.service.name"],
"Service ID": result.dimensionMap["dt.entity.service"],
"Failure Rate": +result.values
};
});
return processedResults;
}
function buildQuery(inputs: string[], metricKey: string): string {
const filters = inputs.map(
input => `in("dt.entity.service", entitySelector("type(service), entityName.equals(~"${input}~")"))`
);
const filterString = filters.join(",");
return `${metricKey}:filter(or(${filterString})):splitBy("dt.entity.service"):sort(value(auto, descending)):names`;
}
I have an example code that I want to add Zone filter capabilities to in the Failure Rate window. This means that in addition to the current filters for *prod OR *QA OR *Test, I would like to add another filter for location, such as *US OR *UK. The purpose of these filters is to be able to narrow down the results by location or name. Thank you your assistance.
02 Jan 2024 08:15 AM
Sorry but I can't find any solutions for this problem 😕
07 Jan 2024 10:01 AM - edited 07 Jan 2024 10:02 AM
OK - maybe it sounds too complicated - i try explain
This is my screen
I want to add in the area of the filter
Column filter
Enables/disables field filters in table
Then the result will be in the window
- I want to add TAGS:PROD -
The code found in average is like this
import { metricsClient } from '@dynatrace-sdk/client-classic-environment-v2'; export default async function fetchMetricResults() { const serviceSelection = $Service; const metricKey = "builtin:service.errors.total.rate"; const config = { metricSelector: buildQuery(serviceSelection, metricKey), resolution: "Inf", from: $dt_timeframe_from, to: $dt_timeframe_to, acceptType: "application/json; charset=utf-8" }; if (config.metricSelector.length > 3500) { return "Please select fewer services"; } const metricQuery = await metricsClient.query(config); const processedResults: MetricResult[] = metricQuery.result[0].data.map(result => { return { "Service Name": result.dimensionMap["dt.entity.service.name"], "Service ID": result.dimensionMap["dt.entity.service"], "Failure Rate": +result.values }; }); return processedResults; } function buildQuery(inputs: string[], metricKey: string): string { const filters = inputs.map( input => `in("dt.entity.service", entitySelector("type(service), entityName.equals(~"${input}~")"))` ); const filterString = filters.join(","); return `${metricKey}:filter(or(${filterString})):splitBy("dt.entity.service"):sort(value(auto, descending)):names`; }
The window shows me only the first filter - I want to add another filtering filter
@Pawel_Zalewski wrote:Sorry but I can't find any solutions for this problem 😕