Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
113037: cli: support OpenMetrics in tsdump r=koorosh a=koorosh **This PR duplicates initial work in #111654** with additional change that adds tests and small fixes. Last commit can be reviewed only. The only reason for new PR is that I couldn't push additional changes to former one. ---- This PR continues #97411 from `@tbg.` Fixes #97120. See individual commit messages for details. ---- *From #97411 on the first two commits:* Touches #97120. $ cockroach debug tsdump --insecure --format=openmetrics > tsdump.om $ tail -n 3 tsdump.om valcount{store="1"} 9841.000000 1677012190.0 valcount{store="1"} 9847.000000 1677012200.0 # EOF $ docker run -v $PWD/tsdump.om:/tsdump.om -v $PWD/data:/data --entrypoint /bin/promtool prom/prometheus tsdb create-blocks-from openmetrics /tsdump.om /data BLOCK ULID MIN TIME MAX TIME DURATION NUM SAMPLES NUM CHUNKS NUM SERIES SIZE 01GSTVJG4QMBSQ4ACPK80FFDJ9 1676544540000 1676544940001 6m40.001s 10598 1514 1514 261097 01GSTVJGWM2CX1AA56QSSZ9T2R 1677009150000 1677009590001 7m20.001s 68130 1514 1514 305952 01GSTVJHT2TWTZGCPE52AE1T95 1677009600000 1677012200001 43m20.001s 394093 4542 1514 692053 $ ls data 01GSTVJG4QMBSQ4ACPK80FFDJ9 01GSTVJGWM2CX1AA56QSSZ9T2R 01GSTVJHT2TWTZGCPE52AE1T95 $ docker run -p 9090:9090 -v $PWD/data:/data prom/prometheus --storage.tsdb.path=/data --web.enable-admin-api --config.file=/etc/prometheus/prometheus.yml <img width="1689" alt="image" src="https://user-images.githubusercontent.com/5076964/220455288-e29147d7-c2f6-49dc-bb1d-5be3b28d958f.png"> ---- Second commit, convert existing raw tsdump and look at it through Grafana/prom: `./cockroach debug tsdump --format=openmetrics tsdump.gob > tsdump.om` For demonstration purposes one can then: - clone dockprom[^1] - add `uid: v9Zz2K6nz` to the prometheus datasource[^2] - run: ``` for d in grafana_data prometheus_data; do docker volume create --driver local --opt type=none --opt device=$PWD/$d--opt o=bind $d done promtool tsdb create-blocks-from openmetrics tsdump.om prometheus_data/ docker-compose up -d ``` - http://localhost:3000 admin/admin - import the L2 dashboard[^3] - view the tsdump![^4] Note that all of the histograms are missing because the internal timeseries data doesn't support histograms (records just a few quantiles). [^1]: https://github.com/stefanprodan/dockprom [^2]: grafana/provisioning/datasources/datasource.yml [^3]: https://grafana.testeng.crdb.io/d/CAvWxELVz/l2-drill-down?orgId=1&from=now-1h&to=now&refresh=1m&var-cluster=grinaker-231&var-instances=All [^4]: <img width="1664" alt="image" src="https://user-images.githubusercontent.com/5076964/233642565-175fec77-1bff-4a75-af98-b9bdc6748f78.png"> ---- *re: additons to #97411:* The last two commits enable tsdump raw -> openmetrics conversion offline and add additional labels to the metrics, for parity with cloud metrics. With a single-node, insecure cluster: ``` ➜ cockroach git:(tsdump-openmetrics) ./cockroach debug tsdump --insecure --host=localhost:26258 --format=raw --from="2023-09-29 15:27:03" --to="2023-09-29 20:57:03" > tsdump.gob ... shut down cluster... ➜ cockroach git:(tsdump-openmetrics) ✗ ./cockroach debug tsdump --format=openmetrics tsdump.gob --cluster-label="my-cluster" > tsdump_converted.om ➜ cockroach git:(tsdump-openmetrics) ✗ open ./tsdump_converted.om ``` ``` admission_admitted_elastic_cpu{instance="",organization_id="",organization_label="",node_id="1",sla_type="",tenant_id="",cluster="my-cluster",cluster_type="SELF_HOSTED",job="cockroachdb",region="local",node=""} 0.000000 1696013730.0 admission_admitted_elastic_cpu{instance="",organization_id="",organization_label="",node_id="1",sla_type="",tenant_id="",cluster="my-cluster",cluster_type="SELF_HOSTED",job="cockroachdb",region="local",node=""} 0.000000 1696013740.0 admission_admitted_elastic_cpu{instance="",organization_id="",organization_label="",node_id="1",sla_type="",tenant_id="",cluster="my-cluster",cluster_type="SELF_HOSTED",job="cockroachdb",region="local",node=""} 0.000000 1696013750.0 .... Epic: None 113138: kv: assert transaction finalization after re-issued EndTxn r=nvanbenschoten a=nvanbenschoten Informs #111962. Informs #111967. This commit updates the two places where EndTxn requests are re-issued in the TxnCoordSender (one in the txnCommitter, one in the txnSpanRefresher) to ensure that after the retry succeeds and the response is stitched back together, the transaction is finalized. I have no reason to believe that these assertions will fail. Release note: None Co-authored-by: Tobias Grieger <[email protected]> Co-authored-by: Nathan VanBenschoten <[email protected]>
- Loading branch information