Skip to content

Commit c2e5e53

Browse files
committed
Merge branch 'grafana-zplane' of https://github.com/simranquirky/openobserve-docs into grafana-zplane
2 parents febea4f + d02b85a commit c2e5e53

File tree

110 files changed

+1470
-952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1470
-952
lines changed

.github/workflows/deploy-docs.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy MkDocs Site to S3
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Change this to your deployment branch
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout source code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.10'
20+
21+
- name: Install Python dependencies
22+
run: |
23+
pip install -r requirements.txt
24+
25+
- name: Install AWS CLI
26+
run: |
27+
if ! command -v aws &> /dev/null; then
28+
echo "AWS CLI not found. Installing..."
29+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
30+
unzip awscliv2.zip
31+
sudo ./aws/install
32+
else
33+
echo "AWS CLI already installed."
34+
fi
35+
36+
- name: Configure AWS credentials
37+
uses: aws-actions/configure-aws-credentials@v2
38+
with:
39+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
40+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
41+
aws-region: us-west-2 # or your preferred region
42+
43+
- name: Build MkDocs site
44+
run: |
45+
rm -rf site
46+
mkdocs build
47+
48+
- name: Deploy to S3
49+
run: |
50+
aws s3 sync ./site s3://openobserve-staging-website/docs --exclude=".git/*"
51+
52+
- name: Invalidate CloudFront cache
53+
run: |
54+
aws cloudfront create-invalidation --distribution-id EZ2SEJVXM7NXL --paths "/docs/*"

docs/api/.pages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ nav:
55
- Functions: function
66
- Users: user
77
- Cluster: cluster
8-
8+
- Traces: traces

docs/api/traces/.pages

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
nav:
2+
3+
- Traces API Overview: index.md
4+
- Search Traces: trace-search-api.md

docs/api/traces/index.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
This documentation provides comprehensive guidance on using the OpenObserve API to search and retrieve traces from your application. Traces in OpenObserve represent the complete operational flow of requests through your system, showing the full tree of operations and their sub-operations (spans).
3+
4+
??? "What are Traces?"
5+
- **Traces** describe complete operations in your system.
6+
- Each trace represents the full execution path of a request.
7+
- Traces contain multiple **spans** that represent sub-operations or functions.
8+
- Each trace has a unique trace ID.
9+
10+
??? "What are Spans?"
11+
- **Spans** are individual operations within a trace.
12+
- They represent specific functions, service calls, or operations.
13+
- Each span has its own unique span ID.
14+
- Spans are organized in a tree structure within a trace.
15+
16+
??? "Example: OpenObserve Search Operation"
17+
When a user performs a search query in OpenObserve:
18+
19+
- The **trace** represents the entire search operation from query initiation to result return.
20+
- **Spans** might include: alert manager evaluation, query processing, gRPC search execution, cache operations, database interactions.
21+
- You can see the complete flow showing how the operation moves through different OpenObserve services (alert manager → querier → search services).
22+
- Each span shows the duration and status of individual OpenObserve components involved in processing the search request.
23+
24+
## API Endpoints
25+
26+
- [Get latest traces using `/api/{org_id}/{stream_name}/traces/latest`](trace-search-api.md)

docs/api/traces/trace-search-api.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
## Get Latest Traces
2+
3+
Retrieve traces within a specified time range.
4+
5+
**Endpoint** <br>
6+
```
7+
GET /api/{org_id}/{stream_name}/traces/latest
8+
```
9+
10+
**Parameters** <br>
11+
12+
| Parameter | Type | Required | Description |
13+
|-----------|------|----------|-------------|
14+
| `org_id` | string | Yes | Your organization ID |
15+
| `stream_name` | string | Yes | Name of the trace stream |
16+
| `start_time` | integer | Yes | Start time in microseconds |
17+
| `end_time` | integer | Yes | End time in microseconds |
18+
| `from` | integer | Yes | Result start count (pagination offset) |
19+
| `size` | integer | Yes | Number of traces to return |
20+
| `filter` | string | No | Filter query for traces |
21+
22+
**Example Request** <br>
23+
```bash
24+
curl -X GET \
25+
"https://your-openobserve-instance/api/org_id/stream_name/traces/latest?&filter=&start_time=1751443100969000&end_time=1751444000969000&from=0&size=25 \
26+
-H "Authorization: Basic <your-auth-token>"
27+
```
28+
29+
**Response Format**<br>
30+
```json
31+
{
32+
"total": 1,
33+
"trace_id": "b1eeb579ae863bdf9408e7d64c02d5d1",
34+
"hits": [
35+
{
36+
"duration": 9,
37+
"end_time": 1751444644327767600,
38+
"first_event": {
39+
"_timestamp": 1751444644327758,
40+
"duration": 9,
41+
"end_time": 1751444644327767600,
42+
"operation_name": "infra:schema:get_versions",
43+
"service_name": "compactor",
44+
"span_status": "UNSET",
45+
"start_time": 1751444644327758300,
46+
"trace_id": "b1eeb579ae863bdf9408e7d64c02d5d1"
47+
},
48+
"service_name": [
49+
{
50+
"count": 1,
51+
"service_name": "compactor"
52+
}
53+
],
54+
"spans": [1, 0],
55+
"start_time": 1751444644327758300,
56+
"trace_id": "b1eeb579ae863bdf9408e7d64c02d5d1"
57+
}
58+
]
59+
}
60+
```
61+
62+
**Response Fields** <br>
63+
64+
| Field | Description |
65+
|-------|-------------|
66+
| `total` | Total number of traces found |
67+
| `trace_id` | Unique identifier for the trace |
68+
| `hits` | Array of trace objects |
69+
| `duration` | Total duration of the trace in microseconds |
70+
| `start_time` | Trace start time in microseconds |
71+
| `end_time` | Trace end time in microseconds |
72+
| `first_event` | Details of the first span in the trace |
73+
| `service_name` | Array of services involved in the trace |
74+
| `spans` | Array indicating span counts |
75+
76+
## Get Spans Details
77+
78+
Retrieve detailed span information for a specific trace using the traces `/latest` endpoint with a `trace_id` filter.
79+
80+
### Using Search API
81+
82+
For complex queries, you can use the [search API](https://openobserve.ai/docs/api/search/search/) with SQL queries:
83+
```sql
84+
SELECT * FROM default WHERE trace_id = {trace_id} ORDER BY start_time
85+
```
86+
87+
**Note:** Traces do not support full SQL queries in the traces interface, however, the search API supports SQL for trace data when needed for complex queries.
88+
89+
**Example:**
90+
```sql
91+
{
92+
"query": {
93+
"sql": "SELECT * FROM default WHERE trace_id = b1eeb579ae863bdf9408e7d64c02d5d1" ORDER BY start_time,
94+
"start_time": 1751443100969000,
95+
"end_time": 1751444000969000,
96+
"from": 0,
97+
"size": 25
98+
},
99+
"search_type": "ui",
100+
"timeout": 0
101+
}
102+
```
103+
**Note:**
104+
105+
- When `size` is set to `25`, only the first `25` spans for the trace are returned.
106+
- To retrieve all spans, set `size` to `-1`. In this case, you do not need to define the `from` parameter.
107+
108+
## Error Handling
109+
110+
Common HTTP Status Codes:
111+
112+
- `200 OK`: Request successful
113+
- `400 Bad Request`: Invalid parameters or query format
114+
- `401 Unauthorized`: Invalid or missing authentication
115+
- `404 Not Found`: Stream or organization not found
116+
- `500 Internal Server Error`: Server error
117+
118+
**Error Response Format** <br>
119+
```json
120+
{
121+
"error": {
122+
"type": "invalid_query",
123+
"message": "Invalid time range specified",
124+
"details": "start_time must be less than end_time"
125+
}
126+
}
127+
```
128+
129+
## Best Practices
130+
131+
**Performance Optimization**:
132+
133+
1. **Use appropriate time ranges**: Avoid overly broad time ranges.
134+
2. **Implement pagination**: Use `from` and `size` parameters for large result sets.
135+
3. **Filter effectively**: Use specific filters to reduce result size.
136+
4. **Cache results**: Cache trace metadata for frequently accessed traces.
137+
138+
**Query Optimization**:
139+
140+
1. **Start with trace metadata**: Use the `/latest` endpoint first to get trace overview.
141+
2. **Fetch spans selectively**: Only fetch detailed spans when needed.
142+
3. **Use specific trace IDs**: When possible, query for specific trace IDs.
143+
144+
**Limitations**:
145+
146+
1. **SQL Query Support**: Full SQL queries are not supported in traces; use filter queries instead.
147+
2. **Time Range Requirement**: Start time and end time are mandatory for all queries.
148+
3. **Result Size Limits**: Large result sets should be paginated using `from` and `size`.
149+
150+
151+

0 commit comments

Comments
 (0)