Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions content/en/dashboards/querying/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,16 @@ Datadog also supports the ability to graph your metrics, logs, traces, and other

To graph metrics separately, use the comma (`,`). For example, `a, b, c`.

**Note**: Queries using commas are only supported in visualizations, they do not work on monitors. Use [boolean operators][15] or arithmetic operations to combine multiple metrics in a monitor.
**Note**: Queries using commas are only supported in visualizations; they do not work on monitors. Use [boolean operators][15] or arithmetic operations to combine multiple metrics in a monitor.

#### Metric arithmetic using an integer
{{% collapse-content title="Metric arithmetic using an integer" level="h4" %}}

Modify the displayed value of a metric on a graph by performing an arithmetic operation. For example, to visualize the double of a specific metric, click the {{< ui >}}Advanced...{{< /ui >}} link in the graph editor. Then enter your arithmetic in the `Formula` box, in this case: `a * 2`:
Modify the displayed value of a metric on a graph by performing an arithmetic operation. For example, to visualize the double of a specific metric, click the {{< ui >}}Advanced...{{< /ui >}} link in the graph editor. Then enter your arithmetic in the `Formula` box; in this case: `a * 2`:

{{< img src="dashboards/querying/arithmetic_4.png" alt="Formula example - multiply" style="width:75%;" >}}
{{% /collapse-content %}}

#### Arithmetic between two metrics
{{% collapse-content title="Arithmetic between two metrics" level="h4" %}}

Visualize the percentage of a metric by dividing one metric over another, for example:

Expand All @@ -181,12 +182,13 @@ status:error / status:info
{{< img src="dashboards/querying/arithmetic_6.png" alt="Formula example - logs ratio" style="width:75%;" >}}

**Note**: Formulas are not lettered. Arithmetic cannot be done between formulas.
{{% /collapse-content %}}

#### Hide a query from the visualization

When a widget has multiple queries and a formula, you can hide individual queries so only the formula result appears on the graph. Click the query's letter label to toggle its visibility on the graph. A blue label indicates the query is displayed; a grey label indicates it is hidden. The hidden query is still used in the formula calculation.

#### Minimum or Maximum between two queries
{{% collapse-content title="Minimum or Maximum between two queries" level="h4" %}}

Use `minimum()` and `maximum()` to compare two queries point by point and return the lower or higher value at each timestamp.

Expand All @@ -207,6 +209,19 @@ minimum(status:error, status:warn)
```

{{< img src="dashboards/querying/minmax_logs_platform_example.png" alt="Formula example for 'minimum' showing the lower value between two log queries" style="width:75%;" >}}
{{% /collapse-content %}}

{{% collapse-content title="time() function" level="h4" %}}

The `time()` function returns the current Unix time in seconds as a timeseries. Use it in formulas to compare a metric's timestamp against the present, which helps monitor data freshness or calculate time until an expiration.

For example, to calculate the time elapsed in seconds since the last reported backup, you can use `time()` to find the difference between the present and the timestamp of the backup metric.

```text
time() - max:backup.last_completed_timestamp{*}
```

{{% /collapse-content %}}

### Create an alias

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ aws ecs register-task-definition --cli-input-json file://task-definition.json
aws ecs run-task --cluster your-cluster --task-definition your-task-definition
```

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand All @@ -227,4 +227,3 @@ If you encounter issues while setting up App and API Protection for your Java ap
[1]: /security/application_security/setup/java/compatibility
[2]: /security/application_security/setup/java/troubleshooting


Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ docker run -d \
your-java-app-image
```

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ kubectl apply -f your-deployment.yaml
```


{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ java -javaagent:/path/to/dd-java-agent.jar -jar path/to/app.jar

Start your Java application with above settings.

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ java -javaagent:/path/to/dd-java-agent.jar -jar path/to/app.jar
## 3. Run your application
Start your Java application with the configured settings.

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ java -javaagent:path\to\dd-java-agent.jar -jar path\to\app.jar

Start your Java application with the configured settings.

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ docker run -d \
your-php-app-image
```

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Apply your updated deployment:
kubectl apply -f your-deployment.yaml
```

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export DD_ENV=<YOUR_ENVIRONMENT>

Start your PHP application with the settings described above.

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ aws ecs register-task-definition --cli-input-json file://task-definition.json
aws ecs run-task --cluster your-cluster --task-definition your-task-definition
```

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ docker run -d \
your-python-app-image
```

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Apply your updated deployment:
kubectl apply -f your-deployment.yaml
```

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ddtrace-run python app.py

Start your Python application with the settings described above.

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ddtrace-run python app.py

Start your Python application with the configured settings.

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ddtrace-run python app.py

Start your Python application with the configured settings.

{{% app_and_api_protection_verify_setup %}}
{{% aap/aap_and_api_protection_verify_setup %}}

## Troubleshooting

Expand Down
Loading