Datadog syntax: Difference between revisions
From wikinotes
(→Syntax) |
No edit summary |
||
Line 1: | Line 1: | ||
= Documentation = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| facets || https://docs.datadoghq.com/logs/explorer/facets/#manage-facets | |||
|- | |||
|} | |||
</blockquote><!-- Documentation --> | |||
= Example = | |||
<blockquote> | |||
<syntaxhighlight lang="promql"> | |||
sum:my_metric{*}.as_count() # sum counts per-sample of `my_metric` | |||
sum:my_metric{env:prod} # `my_metric`, where tag `env=prod` | |||
</syntaxhighlight> | |||
</blockquote><!-- Example --> | |||
= Entering Queries = | = Basics = | ||
<blockquote> | |||
== Entering Queries == | |||
<blockquote> | <blockquote> | ||
There is both a JSON query (all-text), and a UI-aided query. | There is both a JSON query (all-text), and a UI-aided query. | ||
Line 10: | Line 28: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Entering Queries --> | </blockquote><!-- Entering Queries --> | ||
== Components == | |||
<blockquote> | |||
Queries have a <code>term</code> and an <code>operator</code>. | |||
terms | |||
<syntaxhighlight lang="yaml"> | |||
facet: @host, @url # provided by the application, applies to all metrics | |||
tag: status, perform_time # assigned to your specific metric when emitted | |||
</syntaxhighlight> | |||
tags | |||
<syntaxhighlight lang="yaml"> | |||
</syntaxhighlight> | |||
</blockquote><!-- Components --> | |||
</blockquote><!-- Basics --> | |||
= Datatypes = | = Datatypes = | ||
Line 20: | Line 55: | ||
</blockquote><!-- Datatypes --> | </blockquote><!-- Datatypes --> | ||
= | = Filters = | ||
<blockquote> | <blockquote> | ||
You can glob-match metrics. | |||
<syntaxhighlight lang="promql"> | <syntaxhighlight lang="promql"> | ||
jobs:*{*} # jobs.* with no tag matchers | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Tag-Search lets you conditionally match metrics by tag. | |||
<syntaxhighlight lang="promql"> | <syntaxhighlight lang="promql"> | ||
# ex. perform_time{(env:prod AND env:staging)} | |||
# ex. perform_time{(env:prod AND -user:test)} | |||
AND # metric with both tags | |||
OR # metric with either tag | |||
- # (AND|OR) exclude results with another matcher | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Exclude records by numerical operators, or ranges | |||
<syntaxhighlight lang="promql"> | |||
# ex. foo.response_time:>100 | |||
# ex. foo.response_time:[100 TO 200] | |||
</syntaxhighlight> | |||
</blockquote><!-- Joins --> | |||
< | = Aggregation (Samples) = | ||
<blockquote> | |||
</blockquote><!-- Aggregation (Samples) --> | |||
</blockquote><!-- |
Revision as of 22:09, 5 May 2022
Documentation
facets https://docs.datadoghq.com/logs/explorer/facets/#manage-facets
Example
sum:my_metric{*}.as_count() # sum counts per-sample of `my_metric` sum:my_metric{env:prod} # `my_metric`, where tag `env=prod`
Basics
Entering Queries
There is both a JSON query (all-text), and a UI-aided query.
Notebooks: - New Notebook: - </> # on the far right of the query, this toggles interactive "json-syntax" queriesComponents
Queries have a
term
and anoperator
.terms
facet: @host, @url # provided by the application, applies to all metrics tag: status, perform_time # assigned to your specific metric when emittedtags
Datatypes
Metrics are assigned datatypes
Filters
You can glob-match metrics.
jobs:*{*} # jobs.* with no tag matchersTag-Search lets you conditionally match metrics by tag.
# ex. perform_time{(env:prod AND env:staging)} # ex. perform_time{(env:prod AND -user:test)} AND # metric with both tags OR # metric with either tag - # (AND|OR) exclude results with another matcherExclude records by numerical operators, or ranges
# ex. foo.response_time:>100 # ex. foo.response_time:[100 TO 200]