12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2022 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)typemetrics={checkpoint_level:Prometheus.Gauge.t;savepoint_level:Prometheus.Gauge.t;caboose_level:Prometheus.Gauge.t;alternate_heads_count:Prometheus.Gauge.t;last_written_block_size:Prometheus.Gauge.t;last_store_merge_time:Prometheus.Gauge.t;}letnamespace=Tezos_version.Node_version.namespacetypecollectors={mutableinvalid_blocks:unit->floatLwt.t}letcollectors={invalid_blocks=(fun()->Lwt.return0.)}letset_invalid_blocks_collectorfn=collectors.invalid_blocks<-fnletmetrics=letopenLwt_syntaxinletsubsystem="store"inletcheckpoint_level=lethelp="Current checkpoint level"inPrometheus.Gauge.v~help~namespace~subsystem"checkpoint_level"inletsavepoint_level=lethelp="Current savepoint level"inPrometheus.Gauge.v~help~namespace~subsystem"savepoint_level"inletcaboose_level=lethelp="Current caboose level"inPrometheus.Gauge.v~help~namespace~subsystem"caboose_level"inletalternate_heads_count=lethelp="Current number of alternated heads known"inPrometheus.Gauge.v~help~namespace~subsystem"alternate_heads_count"inletlast_written_block_size=lethelp="Size, in bytes, of the last block written in store"inPrometheus.Gauge.v~help~namespace~subsystem"last_written_block_size"inletlast_store_merge_time=lethelp="Time, in seconds, for the completion of the last store merge"inPrometheus.Gauge.v~help~namespace~subsystem"last_merge_time"inletinvalid_blocks_info=Prometheus.MetricInfo.{name=Prometheus.MetricName.v(String.concat"_"[namespace;subsystem;"invalid_blocks"]);metric_type=Gauge;help="Number of blocks known to be invalid stored on disk";label_names=[];}inletinvalid_blocks_collect()=let*collect=collectors.invalid_blocks()inreturn@@Prometheus.LabelSetMap.singleton[][Prometheus.Sample_set.samplecollect]inPrometheus.CollectorRegistry.(register_lwtdefaultinvalid_blocks_infoinvalid_blocks_collect);{checkpoint_level;savepoint_level;caboose_level;alternate_heads_count;last_written_block_size;last_store_merge_time;}