Annotation

A Circonus annotation can be created in several ways.

Explicit

annotation = circonus.create_annotation("title", "category")

Note: The create_annotation() method returns an Annotation instance rather than a requests.Response instance. The requests.Response object is available at the response attribute on the returned object.

Decorator

@circonus.annotation("title", "category")
def nap_time():
    sleep(10)

This will create an annotation with the given parameters and start and stop times that are automatically set to the UTC values of the object.__enter__() and object.__exit__() for the decorated function.

Context Manager

with circonus.annotation("title", "category"):
    sleep(10)

This will create an annotation with the given parameters and start and stop times that are automatically set to the UTC values of the object.__enter__() and object.__exit__() for the block.

Table Of Contents

Related Topics