Datadog syntax: Difference between revisions

From wikinotes
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 -->


= Joins =
= Filters =
<blockquote>
<blockquote>
You can glob-match metrics.
<syntaxhighlight lang="promql">
<syntaxhighlight lang="promql">
AND
jobs:*{*}  # jobs.* with no tag matchers
OR
-
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Joins -->


= Syntax =
Tag-Search lets you conditionally match metrics by tag.
<blockquote>
<syntaxhighlight lang="promql">
<syntaxhighlight lang="promql">
sum:my_metric{*}.as_count() # sum counts per-sample of `my_metric`
# ex. perform_time{(env:prod AND env:staging)}
sum:my_metric{env:prod}     # `my_metric`, where tag `env=prod`
# 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 -->


<syntaxhighlight lang="promql">
= Aggregation (Samples) =
<blockquote>


</syntaxhighlight>
</blockquote><!-- Aggregation (Samples) -->
</blockquote><!-- Syntax -->

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" queries

Components

Queries have a term and an operator.

terms

facet:  @host, @url           # provided by the application, applies to all metrics
tag:    status, perform_time  # assigned to your specific metric when emitted

tags

Datatypes

Metrics are assigned datatypes

Filters

You can glob-match metrics.

jobs:*{*}   # jobs.* with no tag matchers

Tag-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 matcher

Exclude records by numerical operators, or ranges

# ex. foo.response_time:>100
# ex. foo.response_time:[100 TO 200]

Aggregation (Samples)