slotlock 0.6.3 → 0.7.0
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/CHANGELOG.md +467 -0
- package/CONTRIBUTING.md +12 -5
- package/README.md +50 -1551
- package/SECURITY.md +5 -2
- package/SPEC.md +1 -1
- package/agent-server.d.ts +160 -8
- package/agent-server.js +559 -44
- package/agent-store-backend.d.ts +34 -1
- package/agent-store-backend.js +1399 -38
- package/api-keys.d.ts +69 -3
- package/api-keys.js +217 -28
- package/application-api.d.ts +56 -3
- package/application-api.js +826 -15
- package/approvals.d.ts +88 -0
- package/approvals.js +293 -0
- package/assistant.d.ts +40 -0
- package/assistant.js +115 -0
- package/billing.d.ts +114 -0
- package/billing.js +258 -0
- package/config.d.ts +25 -4
- package/config.js +72 -3
- package/dashboard-icon.d.ts +1 -0
- package/dashboard-icon.js +5 -0
- package/dashboard.d.ts +203 -7
- package/dashboard.js +1545 -64
- package/ddl.d.ts +51 -12
- package/ddl.js +2566 -54
- package/event-feed.d.ts +30 -4
- package/event-feed.js +171 -19
- package/index.d.ts +15 -4
- package/index.js +8 -2
- package/maintenance.d.ts +10 -0
- package/maintenance.js +16 -2
- package/metrics.d.ts +41 -0
- package/metrics.js +22 -0
- package/openapi.json +14675 -5957
- package/otel.d.ts +86 -0
- package/otel.js +273 -0
- package/overage.d.ts +33 -0
- package/overage.js +115 -0
- package/package.json +1 -1
- package/partner-billing.d.ts +81 -0
- package/partner-billing.js +333 -0
- package/partner-names.d.ts +8 -0
- package/partner-names.js +10 -0
- package/partners.d.ts +147 -0
- package/partners.js +375 -0
- package/plans.d.ts +92 -0
- package/plans.js +115 -0
- package/quotas.d.ts +108 -0
- package/quotas.js +258 -0
- package/rate-limit.d.ts +21 -1
- package/rate-limit.js +82 -15
- package/resource-profile.d.ts +135 -0
- package/resource-profile.js +263 -0
- package/rest-api.d.ts +2 -0
- package/rest-api.js +68 -3
- package/sandbox.d.ts +70 -0
- package/sandbox.js +295 -0
- package/self-host.d.ts +33 -5
- package/self-host.js +950 -22
- package/slotlock.manifest.json +1 -1
- package/store.d.ts +373 -4
- package/store.js +1212 -118
- package/teams.d.ts +25 -0
- package/teams.js +63 -0
- package/timezone.js +13 -1
- package/types.d.ts +95 -1
- package/usage.d.ts +106 -0
- package/usage.js +238 -0
package/metrics.js
CHANGED
|
@@ -7,6 +7,7 @@ const REFUSAL_REASONS = [
|
|
|
7
7
|
'series_writes_busy',
|
|
8
8
|
'maintenance_busy',
|
|
9
9
|
'request_too_large',
|
|
10
|
+
'quota_exceeded',
|
|
10
11
|
];
|
|
11
12
|
const MAINTENANCE_COUNTS = [
|
|
12
13
|
'extended',
|
|
@@ -17,6 +18,7 @@ const MAINTENANCE_COUNTS = [
|
|
|
17
18
|
'staleSources',
|
|
18
19
|
'noShows',
|
|
19
20
|
'waitlistOffers',
|
|
21
|
+
'approvalsExpired',
|
|
20
22
|
];
|
|
21
23
|
/** A label value: an operation, protocol or outcome code. Anything else is counted as `other`. */
|
|
22
24
|
const LABEL = /^[a-z0-9_.]{1,64}$/;
|
|
@@ -43,6 +45,9 @@ class Counter {
|
|
|
43
45
|
current.value += amount;
|
|
44
46
|
this.values.set(id, current);
|
|
45
47
|
}
|
|
48
|
+
points() {
|
|
49
|
+
return [...this.values.values()].map(({ labels, value }) => ({ labels, value }));
|
|
50
|
+
}
|
|
46
51
|
render(type = 'counter') {
|
|
47
52
|
const lines = [`# HELP ${this.name} ${this.help}`, `# TYPE ${this.name} ${type}`];
|
|
48
53
|
for (const { labels, value } of this.values.values()) {
|
|
@@ -75,6 +80,9 @@ class Histogram {
|
|
|
75
80
|
current.count += 1;
|
|
76
81
|
this.series.set(id, current);
|
|
77
82
|
}
|
|
83
|
+
points() {
|
|
84
|
+
return [...this.series.values()].map(({ labels, buckets, sum, count }) => ({ labels, cumulative: [...buckets], sum, count }));
|
|
85
|
+
}
|
|
78
86
|
render() {
|
|
79
87
|
const lines = [`# HELP ${this.name} ${this.help}`, `# TYPE ${this.name} histogram`];
|
|
80
88
|
for (const { labels, buckets, sum, count } of this.series.values()) {
|
|
@@ -99,6 +107,7 @@ export function createSlotlockMetrics(info) {
|
|
|
99
107
|
const refused = new Counter('slotlock_refusals_total', 'Requests refused before they ran, by reason.');
|
|
100
108
|
const passes = new Counter('slotlock_maintenance_passes_total', 'Maintenance passes, by whether one was capped.');
|
|
101
109
|
const upkeep = new Counter('slotlock_maintenance_items_total', 'What maintenance did, by kind: series extended, holds pruned, no-shows released, waitlist offers made, and so on.');
|
|
110
|
+
const clients = new Counter('slotlock_requests_by_client_total', 'Authenticated requests by the integrator their Slotlock-Client field names (known ones, other or none).');
|
|
102
111
|
const deliveries = new Counter('slotlock_webhook_deliveries_total', 'Webhook changes delivered, and deliveries that failed and will be retried.');
|
|
103
112
|
return {
|
|
104
113
|
event(event) {
|
|
@@ -134,6 +143,9 @@ export function createSlotlockMetrics(info) {
|
|
|
134
143
|
refusedScrape() {
|
|
135
144
|
refused.add({ reason: 'metrics_auth_refused' });
|
|
136
145
|
},
|
|
146
|
+
client(name) {
|
|
147
|
+
clients.add({ client: label(name) });
|
|
148
|
+
},
|
|
137
149
|
webhooks(result) {
|
|
138
150
|
if (result.delivered > 0)
|
|
139
151
|
deliveries.add({ result: 'delivered' }, result.delivered);
|
|
@@ -159,8 +171,18 @@ export function createSlotlockMetrics(info) {
|
|
|
159
171
|
...passes.render(),
|
|
160
172
|
...upkeep.render(),
|
|
161
173
|
...deliveries.render(),
|
|
174
|
+
...clients.render(),
|
|
162
175
|
];
|
|
163
176
|
return `${lines.join('\n')}\n`;
|
|
164
177
|
},
|
|
178
|
+
collect() {
|
|
179
|
+
const counter = (metric) => ({ name: metric.name, help: metric.help, points: metric.points() });
|
|
180
|
+
return {
|
|
181
|
+
startedAtMs: started * 1000,
|
|
182
|
+
counters: [calls, confirmations, subscriptions, refused, passes, upkeep, deliveries, clients].map(counter),
|
|
183
|
+
histograms: [{ name: duration.name, help: duration.help, bounds: BUCKETS, points: duration.points() }],
|
|
184
|
+
gauges: [{ name: 'slotlock_subscriptions_open', help: 'MCP subscriptions open now.', points: [{ labels: {}, value: open }] }],
|
|
185
|
+
};
|
|
186
|
+
},
|
|
165
187
|
};
|
|
166
188
|
}
|