Skip to content

Commit c7f2311

Browse files
committed
update httpd requests per sec
need to set defaults for lag functions or start values are wrong so all values end up having the extra added to them
1 parent 8bb234a commit c7f2311

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

couchdb/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,21 +224,21 @@ Note: Ledgend min, max, avg, current and total are from grafana and not the couc
224224
```
225225
226226
WITH httpd AS (
227-
SELECT (doc->>'ts')::numeric * 1000 AS time,
228-
((doc->'httpd'->'clients_requesting_changes'->>'current')::numeric - lag((doc->'httpd'->'clients_requesting_changes'->>'current')::numeric, 1) OVER w )
229-
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1) OVER w)::numeric AS clients_requesting_changes_per_sec,
230-
((doc->'httpd'->'requests'->>'current')::numeric - lag((doc->'httpd'->'requests'->>'current')::numeric, 1) OVER w )
231-
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1) OVER w)::numeric AS requests_per_sec,
232-
((doc->'httpd'->'bulk_requests'->>'current')::numeric - lag((doc->'httpd'->'bulk_requests'->>'current')::numeric, 1) OVER w )
233-
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1) OVER w)::numeric AS bulk_requests_per_sec,
234-
((doc->'httpd'->'view_reads'->>'current')::numeric - lag((doc->'httpd'->'view_reads'->>'current')::numeric, 1) OVER w )
235-
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1) OVER w)::numeric AS view_reads_per_sec,
236-
((doc->'httpd'->'temporary_view_reads'->>'current')::numeric - lag((doc->'httpd'->'temporary_view_reads'->>'current')::numeric, 1) OVER w )
237-
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1) OVER w)::numeric AS temporary_view_reads_per_sec
227+
SELECT (doc->>'ts')::numeric * 1000 AS time, id,
228+
((doc->'httpd'->'clients_requesting_changes'->>'current')::numeric -
229+
lag((doc->'httpd'->'clients_requesting_changes'->>'current')::numeric, 1,'0') OVER w )
230+
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1, '1') OVER w)::numeric AS clients_requesting_changes_per_sec,
231+
((doc->'httpd'->'requests'->>'current')::numeric - lag((doc->'httpd'->'requests'->>'current')::numeric, 1, '0') OVER w )
232+
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1, '1') OVER w)::numeric AS requests_per_sec,
233+
((doc->'httpd'->'bulk_requests'->>'current')::numeric - lag((doc->'httpd'->'bulk_requests'->>'current')::numeric, 1, '0') OVER w )
234+
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1, '1') OVER w)::numeric AS bulk_requests_per_sec,
235+
((doc->'httpd'->'view_reads'->>'current')::numeric - lag((doc->'httpd'->'view_reads'->>'current')::numeric, 1, '0') OVER w )
236+
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1, '1') OVER w)::numeric AS view_reads_per_sec,
237+
((doc->'httpd'->'temporary_view_reads'->>'current')::numeric - lag((doc->'httpd'->'temporary_view_reads'->>'current')::numeric, 1, '0') OVER w )
238+
/ ((doc->>'ts')::numeric - lag((doc->>'ts')::numeric, 1, '1') OVER w)::numeric AS temporary_view_reads_per_sec
238239
FROM abtest
239-
WHERE doc->>'name'='mw-staging.couchdb'
240-
AND ( to_timestamp((doc->>'ts')::numeric) > now() - interval '12h')
241-
WINDOW w AS (ORDER BY (doc->>'ts')::numeric)
240+
WHERE doc->>'name'='mel-couch.couchdb'
241+
WINDOW w AS (ORDER BY (doc->>'ts')::numeric)
242242
ORDER BY time
243243
),
244244
results AS (

0 commit comments

Comments
 (0)