# New annotation hooks

**URL:** <https://community.grafana.com/t/new-annotation-hooks/43949>\
**Category:** Grafana Plugin Development\
**Created:** [March 3, 2021, 3:19pm UTC](https://community.grafana.com/t/new-annotation-hooks/43949 "2021-03-03T15:19:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![catdigital](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/catdigital/32/15453_2.png) [@catdigital](https://community.grafana.com/u/catdigital)\
**Post date:** [March 3, 2021, 3:19pm UTC](https://community.grafana.com/t/new-annotation-hooks/43949/1 "2021-03-03T15:19:30Z")

</div>

Our team at Caterpillar would like to request a couple of working examples for **new annotation hooks**.

As of now, the official docs cover an old `annotationQuery` method that has been marked as deprecated. We’d want to avoid using deprecated code, and have already spent a good chunk of time figuring out how the new API works. Without docs and relevant examples, this has become more challenging than expected.

When applying a new annotation range in graph panel, an old method exposes an object (of `AnnotationQueryRequest<DataQuery>` type) with certain params (such as `range` or `rangeRow`) we use when requesting our API server. With new hooks, it’s unclear where this data can be read from.

We’d be happy to learn any documentation you may have on the topic (be it completed or in draft).

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ryantxu](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/ryantxu/32/4657_2.png) [@ryantxu](https://community.grafana.com/u/ryantxu)\
**Post date:** [March 4, 2021, 7:37pm UTC](https://community.grafana.com/t/new-annotation-hooks/43949/2 "2021-03-04T19:37:44Z")

</div>

If you are creating your own datasource and want annotation support. The easiest thing is to add:

> <https://github.com/grafana/iot-sitewise-datasource/blob/main/src/DataSource.ts#L36>

This is all that is required to use the standard QueryEditor and attach a mapping from normal results to annotations.

If you need custom UI/query processing for the queries check: [grafana/annotations.ts at master · grafana/grafana · GitHub](https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/types/annotations.ts#L68)

---

<div class="post-metadata">

**Author:** ![catdigital](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/catdigital/32/15453_2.png) [@catdigital](https://community.grafana.com/u/catdigital)\
**Post date:** [March 18, 2021, 3:28pm UTC](https://community.grafana.com/t/new-annotation-hooks/43949/3 "2021-03-18T15:28:14Z")

</div>

Thanks for your suggestion. Will give it a try!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [March 18, 2022, 3:28pm UTC](https://community.grafana.com/t/new-annotation-hooks/43949/4 "2022-03-18T15:28:29Z")

</div>

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
