cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dashboard/Data explorer tips

zietho
Dynatrace Champion
Dynatrace Champion

For quite some time I was thinking about putting together a few things I've learned and come across regularly, since I joined the Dashboarding and Data explorer band wagon. 

So rather than wait until I get the time to write a proper blog post, I thought why not start small and iterate. So here we are: 

Shift the timeframe for METRICs relative to the selected timeframe (aka :timeshift transformation)

Something we even documented by now, pls check out https://www.dynatrace.com/support/help/shortlink/explorer-advanced-query-editor#example-compare-a-me... and let us know whether something isn't clear or missing.

The TLTR; with the :timeshift transformation in the Data explorer code mode you can shift single metrics in comparison to others. So that on a dashboard you choose last 7 days, for example, your first metric (line) shows you the traffic from this week, while your shifted metric 2 shows you the line from last week. Both use the global timeframe selector as a reference and both metrics (shifted and unshifted) dynamically change based on that.  

 

When to use the :timeshift transformation? When you want to compare two or more metrics for a different timeframe in a single visualization. E.g in a graph/line chart.  

 

A static shift would be to use the TILE settings on the dashboard tile, where you define either a certain timeframe or relative timeframe for the whole tile. This applies to all metrics in that tile. 

 

When to use the tile settings: When you need different timeframes for different visualizations. E.g. State visualizations (last day, last 2 h,...) vs. trend based visualizations (last 30 days) on the same dashboard. Tip: obviously querying smaller timeframes should also be more performant, so you might end up 

Working with rates 

Sometimes you are not interested in the absolute count but in the rate (common for APM cases). This is how you can transform it: 

 

The original metric

 

 

builtin:apps.web.actionCount.category:splitBy():sum:auto:sort(value(sum,descending)):limit(10)

 

 

The :rate transformation applied, tells the Metrics API, pls transform this to a per minute number, so you don't have to do the math. Tipp: should your metric not support rate automatically (its no number by default) than use :auto:rate(..) to fix it.  

 

 

builtin:apps.web.actionCount.category:splitBy():sum:auto:sort(value(sum,descending)):limit(10):rate(1m)

 

 

Finally :toUnit (silently available since 1.228) to set the unit accordingly and have the beloved /m... in the charts

 

 

builtin:apps.web.actionCount.category:splitBy():sum:auto:sort(value(sum,descending)):limit(10):rate(1m):toUnit(PerMinute,PerMinute) 

 

 

The result: 

zietho_0-1643811997056.png

 

Sort by (metric entity) names instead of their values

 

Sometimes you want to sort your visualization results, for example in a table or heatmap, alphabetically rather than according to the values in case you used split by.

Let's look at an easy example: 

 

Sorted by name: 

  1. add :names right after the metric name
  2. Split by "dt.entity..... .name" (you can also split by only the entity to get the drill down link, for example in a table. 
  3. change :sort to dimension(dt.entity.... .name, [ascending/descending])

zietho_0-1661159590154.png

Note: we treat upper- and lower-case differently and sort them one after the other. So don't be surprised to see, for instance, something like:

  1. Adelaide
  2. Berlin
  3. Cleveland ... but then
  4. atlanta
  5. boston
  6. c...

 

Sorting by value (out of the box default):

zietho_1-1661164024145.png 

Searching metrics made easy with additional search terms

While with Custom charting we provided a naive matching between the metric key and the "category" of our metrics, I'd argue you can do pretty much the same with the Data explorer and probably most of you just don't know this yet! But let's talk examples:

 

E.g. when you look for certain "application" metrics you sometimes end up with "premature" results like the following: 

zietho_0-1644264120092.png

Since the search term provided is matched against the display name as well as the key by adding additional words like, app or web will do the trick here and only display you the desired and relevant builtin metrics. This of course works for all others - e.g. add additional words like "services".. or "process" or any other entity type to refine your search result and get to relevant metrics faster.  

zietho_1-1644264148784.png

Replacing missing values like a bo$$

The basis a synthetic-based event metric: 

Screenshot 2022-02-07 at 21.24.16.png

Naive missing value replacement strategy - connect gaps (use build mode):

Screenshot 2022-02-07 at 21.24.30.png

 

What if you want to set all missing values to 0? Easy with the code mode and the :default() transformation. https://www.dynatrace.com/support/help/shortlink/api-metrics-v2-selector#default 

 

Note: only replaces all null values with 0, in the series, if at least one data point exists within the selected timeframe. 

 

Screenshot 2022-02-07 at 21.25.31.png

 

Advanced filtering with code mode 

I often come across the request to filter all entities that don't match a certain name. 

Use not and other suitable conditions of the entity selector to efficiently narrow them down or to remove them. Let's look at an example: 

For builtin metrics when you need to use the entity name

Where we usually use "ids" instead of "names" you would use the entity selector.

For example, to get a honeycomb for the Response time of all our "Web" services, indicated by Web at the beginning of their names, we could do the following: 

 

builtin:service.response.time
:splitBy("dt.entity.service")
:filter(
in(
dt.entity.service,
entitySelector("type(SERVICE),entityName.startsWith(Web)")
)

zietho_0-1657898221216.png

 

while without the filter, we'd get 

zietho_1-1657898252687.png

For your own ingested metrics 

you can leverage the simpler syntax without an entity selector like

weather.info.temperature
:splitBy("station")
:filter(prefix("station","EU-"))

Can I show the host for a PGI? 

Yes, you (code mode) can! 

 

1. add :parents after the metrics name

2. add the desired dimension, in this case "dt.entity.host", to the splitBy

zietho_0-1657812763872.png

 

How can I get a hive with more than 100 honeycombs?

You previously created a honeycomb but were bothered by the fact that the max limit of 100 is limiting your bird's eye view? Well, that's the solution: 

1. Pick a metric of your choice (e.g., Response time - a service metric)

2. Use the desired splitBy criteria (e.g. Service) 

3. Select Honeycomb in the visualization  

4. Switch to Code mode and inside limit(100) replace the number with a higher one. For example 5000. 

 

Voila. almost 2.5K services at a glance.  

image (1).png

 

regards 

Thomas

6 REPLIES 6

ChadTurner
DynaMight Guru
DynaMight Guru

This is great! thanks @zietho 

-Chad

AlanZ
Organizer

Thanks for this! We're using code more and more and examples of specific use cases is of great help.

 

Special request for volume 2 (which I hope is coming soon): filter on relations (example: response time of all the services related to a specific process group).

techean
Dynatrace Champion
Dynatrace Champion

Thanks @zietho  This will help in release comparison for our clients where weekly release are getting deployed 🙂

KG

Julius_Loman
DynaMight Guru
DynaMight Guru

The advanced filtering capabilities are really cool indeed. Especially when you get familiar with the entity selectors. 

For example, the following query will show you the failure of services which are called from services running in a process group named prodCluster tagged with a tag named TAG1. Such queries are really cool with honeycomb visualizations.

builtin:service.errors.total.rate
:splitBy("dt.entity.service")
:filter(in("dt.entity.service",entitySelector("type(SERVICE),toRelationships.calls(type(SERVICE),tag(TAG1),fromRelationships.runsOn(type(PROCESS_GROUP),entityName(prodCluster)))")))
:avg
:auto
:sort(value(avg,descending))
:limit(100)

 

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

zietho
Dynatrace Champion
Dynatrace Champion

Added "Sort by (metric entity) names instead of their values", long needed and often asked. Yes, we plan to add this to build mode ;)! 

DynaLou
Visitor

@zietho Hello and thank you for your post! Right now I'm running into an issue where I'm unable to increase the returned information past 100 despite using the code tab. Any ideas?

 

DynaLou_0-1663177973030.png