Datadog syntax: Difference between revisions

From wikinotes
No edit summary
Line 56: Line 56:


= Filters =
= Filters =
<blockquote>
== Glob/Wildcard ==
<blockquote>
<blockquote>
You can glob-match metrics.
You can glob-match metrics.
Line 61: Line 63:
jobs:*{*}  # jobs.* with no tag matchers
jobs:*{*}  # jobs.* with no tag matchers
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Glob/Wildcard -->


== Tag-Search ==
<blockquote>
Tag-Search lets you conditionally match metrics by tag.
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
AND  # metric with both tags
OR  # metric with either tag
OR  # metric with either tag
Line 72: Line 74:
</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="promql">
perform_time{(env:prod AND env:staging)}
perform_time{(env:prod AND -user:test)}
</syntaxhighlight>
</blockquote><!-- Tag-Search -->
== Comparison/Ranges ==
<blockquote>
Exclude records by numerical operators, or ranges
Exclude records by numerical operators, or ranges
<syntaxhighlight lang="promql">
<syntaxhighlight lang="promql">
# ex. foo.response_time:>100
foo.response_time:>100
# ex. foo.response_time:[100 TO 200]
foo.response_time:[100 TO 200]
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Joins -->
</blockquote><!-- Joins -->
</blockquote><!-- Comparison/Ranges -->


= Aggregation (Samples) =
= Aggregation (Samples) =

Revision as of 22:11, 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

Glob/Wildcard

You can glob-match metrics.

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

Tag-Search

Tag-Search lets you conditionally match metrics by tag.

AND  # metric with both tags
OR   # metric with either tag
-    # (AND|OR) exclude results with another matcher
perform_time{(env:prod AND env:staging)}
perform_time{(env:prod AND -user:test)}

Comparison/Ranges

Exclude records by numerical operators, or ranges

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

Aggregation (Samples)