|
| 1 | +--- |
| 2 | +title: "Datadog" |
| 3 | +description: "How to use Foyle to assist you with Datadog." |
| 4 | +weight: 9 |
| 5 | +--- |
| 6 | + |
| 7 | +# Why Use Datadog with Foyle |
| 8 | + |
| 9 | +[Datadog](https://www.datadoghq.com/) is often used to store and visualize observability data. |
| 10 | + |
| 11 | +Using Foyle and RunMe you can |
| 12 | + |
| 13 | +* Use AI to turn a high level intent into an actual Datadog query or dashboard |
| 14 | +* Capture that query as part of a playbook or incident report |
| 15 | +* Create documents that capture the specific queries you are interested in rather than rely |
| 16 | + on static dashboards |
| 17 | + |
| 18 | + |
| 19 | +## How to integrate Datadog Logs with Runme |
| 20 | + |
| 21 | +This section explains how to integrate Datadog Logs with Runme |
| 22 | + |
| 23 | +Datadog supports embedding queries directly in the |
| 24 | +[URL](https://docs.datadoghq.com/logs/explorer/search/). You can use this feature to define log queries |
| 25 | +in your notebook and then generate a URL that can be opened in the browser to view the results. |
| 26 | +The [ddctl CLI](https://github.com/jlewi/ddctl) makes it easy to generate links. |
| 27 | + |
| 28 | +1. Download the latest CLI from [ddctl's releases page](https://github.com/jlewi/ddctl/releases) |
| 29 | + |
| 30 | +1. Configure it with the base URL for your Datadog instance |
| 31 | + |
| 32 | + ``` |
| 33 | + ddctl config set baseURL=https://acme.datadoghq.com |
| 34 | + ``` |
| 35 | + |
| 36 | + * You can determine the baseURL by opening up the Datadog UI a |
| 37 | + |
| 38 | +1. Create a code cell which uses contains the query to be executed |
| 39 | + * To make it readable the recommended pattern is to treat it as a multi-line JSON |
| 40 | + string and write it to a file |
| 41 | +2. Use the CLI [ddctl](https://github.com/jlewi/ddctl) to generate the URL and open it in the browser |
| 42 | + * While the CLI allows passing the query as an argument this isn't nearly as human |
| 43 | + readable as writing it and reading it from a temporary file |
| 44 | +Here's an example code cell |
| 45 | + |
| 46 | +```bash |
| 47 | +cat << EOF > /tmp/query.yaml |
| 48 | +query: service:foyle @contextId:01JEF30XB9A |
| 49 | +EOF |
| 50 | +ddctl logs querytourl --query-file=/tmp/query.yaml |
| 51 | +``` |
| 52 | + |
| 53 | +* The value of the YAML file should be a map containing the query arguments to include in the link |
| 54 | +* Some useful query arguments are |
| 55 | + |
| 56 | + * `live`: Set this to true if you always want to show the latest logs rather than fixing to a particular time range |
| 57 | + |
| 58 | +* You can use the `ddctl` command line flags `--duration` and `--end-time` to control the time window shown |
| 59 | + |
| 60 | +## Training Foyle to be your Datadog Expert |
| 61 | + |
| 62 | +To train Foyle to be your Datadog expert you follow these steps |
| 63 | + |
| 64 | +1. Create a markdown cell expressing the high level intent you want to accomplish |
| 65 | +1. Create a code cell which uses `ddctl` to generate the logs explorer link |
| 66 | +1. Execute the code cell |
| 67 | +1. Foyle automatically learns how to predict every successfully executed code cell |
0 commit comments