Skip to content

Commit

Permalink
docs: overhauled annotation docs and moved some of the data source sp…
Browse files Browse the repository at this point in the history
…ecific annotation docs to the respective data source doc pages, closes #1111
  • Loading branch information
torkelo committed Apr 28, 2017
1 parent c46b735 commit 4f9f186
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 36 deletions.
18 changes: 16 additions & 2 deletions docs/sources/features/datasources/elasticsearch.md
Expand Up @@ -89,7 +89,21 @@ The Elasticsearch datasource supports two types of queries you can use to fill t
{"find": "fields", "type": "string", "query": <lucene query>}
```

### Multi format / All format
Use lucene format.
<br>
## Annotations

[Annotations]({{< relref "reference/Annotations.md" >}}) allows you to overlay rich event information on top of graphs. You add annotation
queries via the Dashboard menu / Annotations view. Grafana can query any Elasticsearch index
for annotation events.

Name | Description
------------ | -------------
Query | You can leave the search query blank or specify a lucene query
Time | The name of the time field, needs to be date field.
Title | The name of field to use for the event title.
Tags | Optional field name to use for event tags (can be array or csv string).
Text | Optional field name to use event text body.




14 changes: 12 additions & 2 deletions docs/sources/features/datasources/graphite.md
Expand Up @@ -63,6 +63,10 @@ Some functions like aliasByNode support an optional second argument. To add this

![](/img/docs/animated_gifs/func_editor_optional_params.gif)

### Nested Queries

You can reference queries by the row “letter” that they’re on (similar to Microsoft Excel). If you add a second query to graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries.

## Point consolidation

All Graphite metrics are consolidated so that Graphite doesn't return more data points than there are pixels in the graph. By default
Expand All @@ -83,6 +87,12 @@ You can also create nested variables that use other variables in their definitio

![](/img/docs/v2/templated_variable_parameter.png)

## Annotations

[Annotations]({{< relref "reference/Annotations.md" >}}) allows you to overlay rich event information on top of graphs. You add annotation
queries via the Dashboard menu / Annotations view.

Graphite supports two ways to query annotations. A regular metric query, for this you use the `Graphite query` textbox. A Graphite events query, use the `Graphite event tags` textbox,
specify an tag or wildcard (leave empty should also work)


## Query Reference
You can reference queries by the row “letter” that they’re on (similar to Microsoft Excel). If you add a second query to graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries.
8 changes: 7 additions & 1 deletion docs/sources/features/datasources/influxdb.md
Expand Up @@ -121,12 +121,18 @@ SHOW TAG VALUES WITH KEY = "hostname" WHERE region =~ /$region/
![](/img/docs/influxdb/templating_simple_ex1.png)

## Annotations
Annotations allows you to overlay rich event information on top of graphs.

[Annotations]({{< relref "reference/Annotations.md" >}}) allows you to overlay rich event information on top of graphs. You add annotation
queries via the Dashboard menu / Annotations view.

An example query:

```SQL
SELECT title, description from events WHERE $timeFilter order asc
```

For InfluxDB you need to enter a query like in the above example. You need to have the ```where $timeFilter```
part. If you only select one column you will not need to enter anything in the column mapping fields. The
Tags field can be a comma seperated string.


12 changes: 12 additions & 0 deletions docs/sources/features/datasources/prometheus.md
Expand Up @@ -81,3 +81,15 @@ When the `Include All` option or `Multi-Value` option is enabled, Grafana conver
Which means you have to use `=~` instead of `=` in your Prometheus queries. For example `ALERTS{instance=~$instance}` instead of `ALERTS{instance=$instance}`.

![](/img/docs/v2/prometheus_templating.png)

## Annotations

[Annotations]({{< relref "reference/Annotations.md" >}}) allows you to overlay rich event information on top of graphs. You add annotation
queries via the Dashboard menu / Annotations view.

Prometheus supports two ways to query annotations.

- A regular metric query
- A Prometheus query for pending and firing alerts (for details see [Inspecting alerts during runtime](https://prometheus.io/docs/alerting/rules/#inspecting-alerts-during-runtime))

The step option is useful to limit the number of events returned from your query.
46 changes: 16 additions & 30 deletions docs/sources/reference/annotations.md
Expand Up @@ -13,42 +13,28 @@ weight = 2
Annotations provide a way to mark points on the graph with rich events. When you hover over an annotation
you can get title, tags, and text information for the event.

![](/img/docs/v1/annotated_graph1.png)
![](/img/docs/annotations/toggles.png)

To add an annotation query click dashboard settings icon in top menu and select `Annotations` from the
dropdown. This will open the `Annotations` edit view. Click the `Add` tab to add a new annotation query.
## Queries

> Note: Annotations apply to all graphs in a given dashboard, not on a per-panel basis.
Annotatation events are fetched via annotation queries. To add a new annotation query to a dashboard
open the dashboard settings menu, then select `Annotations`. This will open the dashboard annotations
settings view. To create a new annotation query hit the `New` button.

## Graphite annotations
![](/img/docs/annotations/new_query.png)

Graphite supports two ways to query annotations.
Specify a name for the annotation query. This name is given to the toggle (checkbox) that will allow
you to enable/disable showing annotation events from this query. For example you might have two
annotation queries named `Deploys` and `Outages`. The toggles will allow you to decide what annotations
to show.

- A regular metric query, use the `Graphite target expression` text input for this
- Graphite events query, use the `Graphite event tags` text input, specify an tag or wildcard (leave empty should also work)
### Annotation query details

## Elasticsearch annotations
![](/img/docs/v2/annotations_es.png)
The annotation query options are different for each data source.

Grafana can query any Elasticsearch index for annotation events. The index name can be the name of an alias or an index wildcard pattern.
You can leave the search query blank or specify a lucene query.
- [Graphite annotation queries]({{< relref "features/datasources/graphite.md#annotations" >}})
- [Elasticsearch annotation queries]({{< relref "features/datasources/elasticsearch.md#annotations" >}})
- [InfluxDB annotation queries]({{< relref "features/datasources/influxdb.md#annotations" >}})
- [Prometheus annotation queries]({{< relref "features/datasources/prometheus.md#annotations" >}})

If your elasticsearch document has a timestamp field other than `@timestamp` you will need to specify that. As well
as the name for the fields that should be used for the annotation title, tags and text. Tags and text are optional.

> **Note** The annotation timestamp field in elasticsearch need to be in UTC format.
## InfluxDB Annotations
![](/img/docs/v2/annotations_influxdb.png)

For InfluxDB you need to enter a query like in the above screenshot. You need to have the ```where $timeFilter``` part.
If you only select one column you will not need to enter anything in the column mapping fields.

## Prometheus Annotations

![](/img/docs/v3/annotations_prom.png)

Prometheus supports two ways to query annotations.

- A regular metric query
- A Prometheus query for pending and firing alerts (for details see [Inspecting alerts during runtime](https://prometheus.io/docs/alerting/rules/#inspecting-alerts-during-runtime))
2 changes: 1 addition & 1 deletion public/app/features/annotations/partials/editor.html
Expand Up @@ -28,7 +28,7 @@ <h2 class="tabbed-view-title">
<div class="tabbed-view-body">
<div class="editor-row row" ng-if="ctrl.mode === 'list'">
<div ng-if="ctrl.annotations.length === 0">
<em>No annotations defined</em>
<em>No annotation queries defined</em>
</div>
<table class="grafana-options-table">
<tr ng-repeat="annotation in ctrl.annotations">
Expand Down

0 comments on commit 4f9f186

Please sign in to comment.