@neon/skills 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/neon/references/logs-loki.md +40 -7
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "neon-postgres",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.4",
|
|
5
5
|
"description": "Manage your Neon backend with the Neon agent skills and the Neon MCP Server: Lakebase Postgres, Managed Better Auth, Realtime, Object Storage, Functions, the Data API, and AI Gateway",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Neon",
|
|
@@ -20,7 +20,17 @@ neon logs field-values service_name --since 1h
|
|
|
20
20
|
neon logs query --since 1h --logql '{entity_type="function"} |= "timeout"'
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
`neon logs loki` (Neon CLI 9.1 or newer) reads the same records through the Loki-compatible API below and prints Loki's JSON response: lines grouped by stream labels, with nanosecond timestamp strings where `logs query` rounds to the second. Use it when ordering within a second matters or a tool expects Loki output:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
neon logs loki '{entity_type="function"} |= "timeout"' --since 30m --limit 100
|
|
27
|
+
neon logs loki --endpoint labels
|
|
28
|
+
neon logs loki '{entity_type="function"}' --endpoint label/scope_name/values --since 6h
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
It has no cursor. A result with `--limit` lines, or 10,000 lines (the server's cap, which adds no `warnings` entry), may be incomplete, so narrow `--since` or the selector instead of trusting it as complete.
|
|
32
|
+
|
|
33
|
+
If the CLI is unavailable, fall back to the Neon MCP server's read-only `query_logs`, `query_loki_logs`, `list_log_fields`, and `list_log_field_values` tools.
|
|
24
34
|
|
|
25
35
|
## Loki-compatible read API
|
|
26
36
|
|
|
@@ -40,22 +50,45 @@ This is a read-only Loki-compatible subset, not a push endpoint or complete Loki
|
|
|
40
50
|
|
|
41
51
|
The paths above are the ones to call directly. A Loki client that builds its own paths — a Grafana data source appends `/loki/api/v1` to whatever URL it is given — may need a different root, so confirm the data-source URL against the Neon docs rather than pasting this base.
|
|
42
52
|
|
|
43
|
-
In TypeScript applications, use `@neon/sdk`.
|
|
53
|
+
In TypeScript applications, use `@neon/sdk`. Every method takes one named parameter object, and `query` returns a lazy paginated iterable rather than a promise:
|
|
44
54
|
|
|
45
55
|
```typescript
|
|
46
|
-
for await (const record of neon.logs.query(
|
|
56
|
+
for await (const record of neon.logs.query({
|
|
57
|
+
projectId,
|
|
58
|
+
branchId,
|
|
47
59
|
since: "1h",
|
|
48
60
|
source: "function",
|
|
49
61
|
})) {
|
|
50
62
|
console.log(record.timestamp, record.severity_text, record.message);
|
|
51
63
|
}
|
|
52
64
|
|
|
53
|
-
const { data: fields } = await neon.logs.fields(projectId, branchId);
|
|
54
|
-
const { data: serviceNames } = await neon.logs.fieldValues(
|
|
65
|
+
const { data: fields } = await neon.logs.fields({ projectId, branchId });
|
|
66
|
+
const { data: serviceNames } = await neon.logs.fieldValues({
|
|
55
67
|
projectId,
|
|
56
68
|
branchId,
|
|
57
|
-
"service_name",
|
|
58
|
-
);
|
|
69
|
+
fieldName: "service_name",
|
|
70
|
+
});
|
|
59
71
|
```
|
|
60
72
|
|
|
61
73
|
`query`'s iterator always throws on error, but `fields` and `fieldValues` follow the client's `throwOnError`, which defaults to `false` and hands back `{ data, error }`. `fieldValues` resolves to the whole response, not a bare array: read `serviceNames.values`, and treat them as an arbitrary subset whenever `serviceNames.is_truncated` is true.
|
|
74
|
+
|
|
75
|
+
`neon.logs.loki` (`@neon/sdk` 7.11 or newer) calls the Loki-compatible API with the client's key and returns Loki's response body unchanged:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const { data, error } = await neon.logs.loki.queryRange({
|
|
79
|
+
projectId,
|
|
80
|
+
branchId,
|
|
81
|
+
query: '{entity_type="function"} |= "timeout"',
|
|
82
|
+
since: "30m",
|
|
83
|
+
limit: 100,
|
|
84
|
+
});
|
|
85
|
+
if (error) throw error;
|
|
86
|
+
for (const { stream, values } of data.data.result) {
|
|
87
|
+
for (const [timestampNs, line] of values) console.log(timestampNs, stream.service_name, line);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
await neon.logs.loki.labels({ projectId, branchId });
|
|
91
|
+
await neon.logs.loki.labelValues({ projectId, branchId, name: "service_name" });
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
A rejected query, such as one with a parser stage, comes back as a `NeonApiError` carrying Loki's message.
|