Skip to content

Instantly share code, notes, and snippets.

@dclarke
dclarke / slide-03-04-histograms.promql
Last active May 1, 2026 06:24
When Metrics Lie - companion examples
# ============================================================================
# p99 histogram
# ============================================================================
# WRONG: avg(p99) across pods. The hot pod's tail is averaged out.
# avg by (service) (
# histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))
# )
#
# RIGHT: sum the _bucket counts across instances first, then quantile.
# Use a recording rule so dashboards consume the rolled-up series.
@dclarke
dclarke / slide-03-04-histograms.promql
Created May 1, 2026 00:37
When Metrics Lie - companion examples
# ============================================================================
# p99 histogram
# ============================================================================
# WRONG: avg(p99) across pods. The hot pod's tail is averaged out.
# avg by (service) (
# histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))
# )
#
# RIGHT: sum the _bucket counts across instances first, then quantile.
# Use a recording rule so dashboards consume the rolled-up series.
localhost:mochitest dclarke$ python runtestsb2g.py --b2gpath /Volumes/Boot2Gecko/B2G/ --xre-path /Volumes/Boot2Gecko/mozilla-central/obj-x86_64-apple-darwin12.3.0/dist/bin/ --console-level INFO --emulator arm --test-path tests/dom/apps/tests/test_packaged_app_install.html
waiting for system-message-listener-ready...
done
args: ['/Volumes/Boot2Gecko/mozilla-central/obj-x86_64-apple-darwin12.3.0/dist/bin/xpcshell', '-g', '/Volumes/Boot2Gecko/mozilla-central/obj-x86_64-apple-darwin12.3.0/dist/bin', '-v', '170', '-f', './httpd.js', '-e', "const _PROFILE_PATH = '/var/folders/zg/gwxjd1ss2nl3jktt5khghk540000gn/T/tmpOHSnBh';const _SERVER_PORT = '8888'; const _SERVER_ADDR = '127.0.0.1';\n const _TEST_PREFIX = undefined; const _DISPLAY_RESULTS = false;", '-f', './server.js']
INFO | runtests.py | Server pid: 61009
INFO | runtests.py | Websocket server pid: 0
INFO | runtests.py | Running tests: start.
INFO | runtests.py | Received unexpected exception while running application
Traceback (most recent
@dclarke
dclarke / gist:5296247
Created April 2, 2013 21:13
ummm all ops = async
// make operations on the table asynchronous, for performance
mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("PRAGMA synchronous = OFF"));
// cache frequently used statements (for insertion, deletion, and updating)
rv = mDBConn->CreateAsyncStatement(NS_LITERAL_CSTRING(
"INSERT INTO moz_hosts "
"(id, host, type, permission, expireType, expireTime, appId, isInBrowserElement) "
"VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)"), getter_AddRefs(mStmtInsert));
NS_ENSURE_SUCCESS(rv, rv);