Skip to content

Commit abd8020

Browse files
authored
Update docs about query API and alerts (#1098)
1 parent 21a95ab commit abd8020

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

docs/guides/web-ui/alerts.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,15 @@ On our example, we're going to set up an alert that will trigger when an excepti
2626
and the route is `/members/{user_id}`.
2727

2828
```sql
29-
SELECT * FROM records -- (1)!
29+
SELECT trace_id, exception_type, exception_message FROM records -- (1)!
3030
WHERE
31-
is_exception and -- (2)!
32-
service_name = 'api' and -- (3)!
33-
attributes->>'http.route' = '/members/{user_id}' -- (4)!
31+
is_exception and
32+
service_name = 'api' and
33+
attributes->>'http.route' = '/members/{user_id}' -- (2)!
3434
```
3535

36-
1. The `SELECT * FROM records` statement is the base query that will be executed. The **records** table contains the spans and logs data.
37-
38-
You can use this table to filter the data you want to analyze.
39-
40-
2. The `is_exception` field is a boolean field that indicates whether the record is an exception.
41-
3. The `service_name` field contains the name of the service that generated the record.
42-
4. The `attributes` field is a [JSONB] field that contains additional information about the record.
43-
5. In this case, we're using the `http.route` attribute to filter the records by route.
36+
1. The `SELECT ... FROM records` statement is the base query that will be executed. The **records** table contains the spans and logs data. `trace_id` links to the trace in the live view when viewing the alert run results in the web UI.
37+
2. The `attributes` field is a JSON field that contains additional information about the record. In this case, we're using the `http.route` attribute to filter the records by route.
4438

4539
The **Time window** field allows you to specify the time range over which the query will be executed.
4640

@@ -75,4 +69,3 @@ You can configure an alert by clicking on the **Configuration** button on the ri
7569
You can update the alert, or delete it by clicking the **Delete** button. If instead of deleting the alert, you want to disable it, you can click on the **Active** switch.
7670

7771
[Slack format]: https://api.slack.com/reference/surfaces/formatting
78-
[JSONB]: https://www.postgresql.org/docs/current/datatype-json.html

docs/how-to-guides/query-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ client library, such as `requests` in Python. Below are the general steps and an
144144

145145
### General Steps to Make a Direct HTTP Request
146146

147-
1. **Set the Endpoint URL**: The base URL for the Logfire API is `https://logfire-api.pydantic.dev`.
147+
1. **Set the Endpoint URL**: The base URL for the Logfire API is `https://logfire-us.pydantic.dev` for accounts in the US region, and `https://logfire-eu.pydantic.dev` for accounts in the EU region.
148148

149149
2. **Add Authentication**: Include the read token in your request headers to authenticate.
150150
The header key should be `Authorization` with the value `Bearer <your_read_token_here>`.
@@ -162,7 +162,7 @@ You can also use the `Accept` header to specify the desired format for the respo
162162
import requests
163163

164164
# Define the base URL and your read token
165-
base_url = 'https://logfire-api.pydantic.dev'
165+
base_url = 'https://logfire-us.pydantic.dev' # or 'https://logfire-eu.pydantic.dev' for EU accounts
166166
read_token = '<your_read_token_here>'
167167

168168
# Set the headers for authentication

0 commit comments

Comments
 (0)