Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename qstash events to logs #419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -1009,9 +1009,7 @@
},
{
"group": "Flow Control",
"pages": [
"qstash/api/flow-control/get"
]
"pages": ["qstash/api/flow-control/get"]
},
{
"group": "Queues",
Expand Down Expand Up @@ -1043,7 +1041,11 @@
]
},
{
"group": "Events",
"group": "Logs",
"pages": ["qstash/api/logs/list"]
},
{
"group": "Events (Deprecated)",
"pages": ["qstash/api/events/list"]
},
{
Expand Down Expand Up @@ -1078,7 +1080,7 @@
"qstash/sdks/ts/examples/schedules",
"qstash/sdks/ts/examples/url-groups",
"qstash/sdks/ts/examples/dlq",
"qstash/sdks/ts/examples/events",
"qstash/sdks/ts/examples/logs",
"qstash/sdks/ts/examples/messages",
"qstash/sdks/ts/examples/receiver",
"qstash/sdks/ts/examples/queues"
Expand Down Expand Up @@ -1494,9 +1496,7 @@
},
{
"group": "Flow Control",
"pages": [
"workflow/rest/flow-control/get"
]
"pages": ["workflow/rest/flow-control/get"]
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion qstash/api/api-ratelimiting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can learn more about QStash plans and their limits on the [QStash pricing pa

### Daily Rate Limit

This is a **daily** limit applied to publish-related API endpoints (new message requests like publish, enqueue, or batch). Other API requests, such as fetching events or messages, do not count toward this limit.
This is a **daily** limit applied to publish-related API endpoints (new message requests like publish, enqueue, or batch). Other API requests, such as fetching logs or messages, do not count toward this limit.

**Headers**:

Expand Down
2 changes: 1 addition & 1 deletion qstash/api/dlq/listMessages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ List all messages currently inside the DLQ

<ResponseField name="cursor" type="string">
A cursor which you can use in subsequent requests to paginate through all
events. If no cursor is returned, you have reached the end of the events.
messages. If no cursor is returned, you have reached the end of the messages.
</ResponseField>

<ResponseField name="messages" type="Array">
Expand Down
4 changes: 4 additions & 0 deletions qstash/api/events/list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ api: "GET https://qstash.upstash.io/v2/events"
authMethod: "bearer"
---

<Warning>
QStash events are being renamed to [Logs](/qstash/api/logs/list) to better reflect their purpose and to not get confused with [Workflow Events](/workflow/howto/events).
</Warning>

## Request

<ParamField query="cursor" type="string">
Expand Down
208 changes: 208 additions & 0 deletions qstash/api/logs/list.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
---
title: "List Logs"
description: "Paginate through logs of published messages"
api: "GET https://qstash.upstash.io/v2/logs"
authMethod: "bearer"
---

## Request

<ParamField query="cursor" type="string">
By providing a cursor you can paginate through all of the logs.
</ParamField>

<ParamField query="messageId" type="string">
Filter logs by message id.
</ParamField>

<ParamField query="state" type="string">
Filter logs by [state](/qstash/howto/debug-logs)
</ParamField>

<ParamField query="url" type="string">
Filter logs by url.
</ParamField>

<ParamField query="topicName" type="string">
Filter logs by URL Group (topic) name.
</ParamField>

<ParamField query="scheduleId" type="string">
Filter logs by schedule id.
</ParamField>

<ParamField query="queueName" type="string">
Filter logs by queue name.
</ParamField>

<ParamField query="fromDate" type="number">
Filter logs by starting date, in milliseconds (Unix timestamp). This is inclusive.
</ParamField>

<ParamField query="toDate" type="number">
Filter logs by ending date, in milliseconds (Unix timestamp). This is inclusive.
</ParamField>

<ParamField query="count" type="number">
The number of logs to return. Default and max is 1000.
</ParamField>

<ParamField query="order" type="string">
The sorting order of logs by timestamp. Valid values are "earliestFirst" and "latestFirst". The default is "latestFirst".
</ParamField>

## Response


<ResponseField name="cursor" type="string">
A cursor which you can use in subsequent requests to paginate through all logs.
If no cursor is returned, you have reached the end of the logs.
</ResponseField>
<ResponseField name="events" type="Array">
<Expandable defaultOpen>
<ResponseField name="time" type="int" required>
Timestamp of this log entry, in milliseconds
</ResponseField>
<ResponseField name="messageId" type="string" required>
The associated message id
</ResponseField>
<ResponseField name="header" type="Record<string, string[]>" required>
The headers of the message.
</ResponseField>
<ResponseField name="body" type="string" required>
Base64 encoded body of the message.
</ResponseField>
<ResponseField name="state" type="string" required>
The current state of the message at this point in time.

| Value | Description |
| ------------------ | ---------------------------------------------------------------------------------------- |
| `CREATED` | The message has been accepted and stored in QStash |
| `ACTIVE` | The task is currently being processed by a worker. |
| `RETRY` | The task has been scheduled to retry. |
| `ERROR` | The execution threw an error and the task is waiting to be retried or failed. |
| `DELIVERED` | The message was successfully delivered. |
| `FAILED` | The task has errored too many times or encountered an error that it cannot recover from. |
| `CANCEL_REQUESTED` | The cancel request from the user is recorded. |
| `CANCELLED` | The cancel request from the user is honored. |

</ResponseField>
<ResponseField name="error" type="string" optional>
An explanation what went wrong
</ResponseField>
<ResponseField name="nextDeliveryTime" type="int" >
The next scheduled time of the message.
(Unix timestamp in milliseconds)
</ResponseField>
<ResponseField name="url" type="string" >
The destination url
</ResponseField>
<ResponseField name="topicName" type="string" >
The name of the URL Group (topic) if this message was sent through a topic
</ResponseField>
<ResponseField name="endpointName" type="int" >
The name of the endpoint if this message was sent through a URL Group
</ResponseField>
<ResponseField name="scheduleId" type="string" >
The scheduleId of the message if the message is triggered by a schedule
</ResponseField>
<ResponseField name="queueName" type="string">
The name of the queue if this message is enqueued on a queue
</ResponseField>
<ResponseField name="header" type="string">
The headers that are forwarded to the users endpoint
</ResponseField>
<ResponseField name="body" type="string">
Base64 encoded body of the message
</ResponseField>
<ResponseField name="responseStatus" type="int">
The status code of the response. Only set if the state is `ERROR`
</ResponseField>
<ResponseField name="responseBody" type="string">
The base64 encoded body of the response. Only set if the state is `ERROR`
</ResponseField>
<ResponseField name="responseHeaders" type="Record<string, string[]>">
The headers of the response. Only set if the state is `ERROR`
</ResponseField>
<ResponseField name="timeout" type="int">
The timeout(in milliseconds) of the outgoing http requests, after which Qstash cancels the request
</ResponseField>
<ResponseField name="method" type="string">
Method is the HTTP method of the message for outgoing request
</ResponseField>
<ResponseField name="callback" type="string">
Callback is the URL address where QStash sends the response of a publish
</ResponseField>
<ResponseField name="callbackHeaders" type="Record<string, string[]>">
The headers that are passed to the callback url
</ResponseField>
<ResponseField name="failureCallback" type="string">
Failure Callback is the URL address where QStash sends the response of a publish
</ResponseField>
<ResponseField name="failureCallbackHeaders" type="Record<string, string[]>">
The headers that are passed to the failure callback url
</ResponseField>
<ResponseField name="maxRetries" type="int">
The number of retries that should be attempted in case of delivery failure
</ResponseField>
</Expandable>
</ResponseField>

<RequestExample>
```sh curl
curl https://qstash.upstash.io/v2/logs \
-H "Authorization: Bearer <token>"
```

```javascript Node
const response = await fetch("https://qstash.upstash.io/v2/logs", {
headers: {
Authorization: "Bearer <token>",
},
});
```

```python Python
import requests
headers = {
'Authorization': 'Bearer <token>',
}

response = requests.get(
'https://qstash.upstash.io/v2/logs',
headers=headers
)
```

```go Go
req, err := http.NewRequest("GET", "https://qstash.upstash.io/v2/logs", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer <token>")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
```

</RequestExample>

<ResponseExample>
```json 200 OK
{
"cursor": "1686652644442-12",
"events":[
{
"time": "1686652644442",
"messageId": "msg_123",
"state": "delivered",
"url": "https://example.com",
"header": { "Content-Type": [ "application/x-www-form-urlencoded" ] },
"body": "bWVyaGFiYSBiZW5pbSBhZGltIHNhbmNhcg=="
}
]
}
```
</ResponseExample>
2 changes: 1 addition & 1 deletion qstash/howto/debug-logs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ If retries are not exhausted yet, in the next deliver time, the message will be
## Console

Head over to the [Upstash Console](https://console.upstash.com/qstash) and go to
the `Logs` tab, where you can see the latest events.
the `Logs` tab, where you can see the latest status of your messages.
9 changes: 4 additions & 5 deletions qstash/overall/apiexamples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -436,23 +436,22 @@ client.message.publish_json(
</Tab>
</Tabs>

### List all events
### Get message logs

Retrieve a list of all [events](https://upstash.com/docs/qstash/api/events/list) that have
been published (filtering is also available).
Retrieve logs for all messages that have been published (filtering is also available).

<Tabs>
<Tab title="cURL">
```shell
curl https://qstash.upstash.io/v2/events \
curl https://qstash.upstash.io/v2/logs \
-H "Authorization: Bearer XXX"
```
</Tab>

<Tab title="Typescript SDK">
```typescript
const client = new Client({ token: "<QSTASH_TOKEN>" });
const events = await client.events()
const logs = await client.logs()
```
</Tab>

Expand Down
2 changes: 1 addition & 1 deletion qstash/overall/getstarted.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ You should receive a response with a unique message ID.
### Check Message Status

Head over to [Upstash Console](https://console.upstash.com/qstash) and go to the
`Events` tab where you can see your message activities.
`Logs` tab where you can see your message activities.

<Frame>
<img src="/img/qstash/log.png" />
Expand Down
2 changes: 1 addition & 1 deletion qstash/sdks/py/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Using `qstash` you can:
- Publish a message to a URL/URL group/API
- Publish a message with a delay
- Schedule a message to be published
- Access all events
- Access logs for the messages that have been published
- Create, read, update, or delete URL groups.
- Read or remove messages from the [DLQ](/qstash/features/dlq)
- Read or cancel messages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
---
title: Events
title: Logs
---

#### Get all events with pagination using cursor
#### Get all logs with pagination using cursor

Since there can be a large number of events, they are paginated.
Since there can be a large number of logs, they are paginated.
You can go through the results using the `cursor`.

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const allEvents = [];
const logs = [];
let cursor = null;
while (true) {
const res = await client.events({ cursor });
allEvents.push(...res.events);
const res = await client.logs({ cursor });
logs.push(...res.logs);
cursor = res.cursor;
if (!cursor) {
break;
}
}
```

#### Filter events by state and only return the first 50.
#### Filter logs by state and only return the first 50.

<Info>
More filters can be found in the [API Reference](/qstash/api/events/list).
Expand All @@ -33,7 +33,7 @@ More filters can be found in the [API Reference](/qstash/api/events/list).
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const res = await client.events({
const res = await client.logs({
filter: {
state: "DELIVERED",
count: 50
Expand Down
2 changes: 1 addition & 1 deletion qstash/sdks/ts/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Using `@upstash/qstash` you can:
- Publish a message to a URL/URL Group
- Publish a message with a delay
- Schedule a message to be published
- Access all events
- Access logs for the messages that have been published
- Create, read, update, or delete URL groups.
- Read or remove messages from the [DLQ](/qstash/features/dlq)
- Read or cancel messages
Expand Down