@cryptotaxi247 / kubo / commits / b3973fa01

refactor: make datastore metrics opt-in (#10788)

* datastore: metrics optional and off by default When ipfs is initialized, the datastore metrics wrapper is not configured by default as it previously was. To enable datastore metrics during initialization, specifying the appropriate `--profile` option. To enable datastore metrics tracking wrapper, initialize with datastore profile name + "-measure" suffix. For example: ``` ipfs init --profile flatfs-measure ``` Closes #10767 * fix sharness tests for new datastore dafaults * Add sharness test to check metrics added by flatfs-measure profile * Document updated metrics in changelog * update config doc with new profiles * docs(changelog): separate section * initialize non-measure pebbleds with FormatMajorVersion config * docs: fix typos, add docs link --------- Co-authored-by: gammazero <gammazero@users.noreply.github.com> Co-authored-by: Marcin Rataj <lidel@lidel.org>

Andrew Gillis committed Apr 30, 2025 at 13:01 UTC b3973fa016c3a12d6f866e6c8c538c94a6fe5a8a
9 files changed +341 -163
config/init.go
+42
@@ -141,6 +141,15 @@ func DefaultDatastoreConfig() Datastore {
141 }
142
143 func pebbleSpec() map[string]interface{} {
144 + return map[string]interface{}{
145 + "type": "pebbleds",
146 + "prefix": "pebble.datastore",
147 + "path": "pebbleds",
148 + "formatMajorVersion": int(pebble.FormatNewest),
149 + }
150 +}
151 +
152 +func pebbleSpecMeasure() map[string]interface{} {
153 return map[string]interface{}{
154 "type": "measure",
155 "prefix": "pebble.datastore",
@@ -153,6 +162,16 @@ func pebbleSpec() map[string]interface{} {
162 }
163
164 func badgerSpec() map[string]interface{} {
165 + return map[string]interface{}{
166 + "type": "badgerds",
167 + "prefix": "badger.datastore",
168 + "path": "badgerds",
169 + "syncWrites": false,
170 + "truncate": true,
171 + }
172 +}
173 +
174 +func badgerSpecMeasure() map[string]interface{} {
175 return map[string]interface{}{
176 "type": "measure",
177 "prefix": "badger.datastore",
@@ -166,6 +185,29 @@ func badgerSpec() map[string]interface{} {
185 }
186
187 func flatfsSpec() map[string]interface{} {
188 + return map[string]interface{}{
189 + "type": "mount",
190 + "mounts": []interface{}{
191 + map[string]interface{}{
192 + "mountpoint": "/blocks",
193 + "type": "flatfs",
194 + "prefix": "flatfs.datastore",
195 + "path": "blocks",
196 + "sync": false,
197 + "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
198 + },
199 + map[string]interface{}{
200 + "mountpoint": "/",
201 + "type": "levelds",
202 + "prefix": "leveldb.datastore",
203 + "path": "datastore",
204 + "compression": "none",
205 + },
206 + },
207 + }
208 +}
209 +
210 +func flatfsSpecMeasure() map[string]interface{} {
211 return map[string]interface{}{
212 "type": "mount",
213 "mounts": []interface{}{
config/profile.go
+42
@@ -150,6 +150,20 @@ NOTE: This profile may only be applied when first initializing node at IPFS_PATH
150 return nil
151 },
152 },
153 + "flatfs-measure": {
154 + Description: `Configures the node to use the flatfs datastore with metrics tracking wrapper.
155 +Additional '*_datastore_*' metrics will be exposed on /debug/metrics/prometheus
156 +
157 +NOTE: This profile may only be applied when first initializing node at IPFS_PATH
158 + via 'ipfs init --profile flatfs-measure'
159 +`,
160 +
161 + InitOnly: true,
162 + Transform: func(c *Config) error {
163 + c.Datastore.Spec = flatfsSpecMeasure()
164 + return nil
165 + },
166 + },
167 "pebbleds": {
168 Description: `Configures the node to use the pebble high-performance datastore.
169
@@ -176,6 +190,20 @@ NOTE: This profile may only be applied when first initializing node at IPFS_PATH
190 return nil
191 },
192 },
193 + "pebbleds-measure": {
194 + Description: `Configures the node to use the pebble datastore with metrics tracking wrapper.
195 +Additional '*_datastore_*' metrics will be exposed on /debug/metrics/prometheus
196 +
197 +NOTE: This profile may only be applied when first initializing node at IPFS_PATH
198 + via 'ipfs init --profile pebbleds-measure'
199 +`,
200 +
201 + InitOnly: true,
202 + Transform: func(c *Config) error {
203 + c.Datastore.Spec = pebbleSpecMeasure()
204 + return nil
205 + },
206 + },
207 "badgerds": {
208 Description: `Configures the node to use the legacy badgerv1 datastore.
209
@@ -205,6 +233,20 @@ NOTE: This profile may only be applied when first initializing node at IPFS_PATH
233 return nil
234 },
235 },
236 + "badgerds-measure": {
237 + Description: `Configures the node to use the legacy badgerv1 datastore with metrics wrapper.
238 +Additional '*_datastore_*' metrics will be exposed on /debug/metrics/prometheus
239 +
240 +NOTE: This profile may only be applied when first initializing node at IPFS_PATH
241 + via 'ipfs init --profile badgerds-measure'
242 +`,
243 +
244 + InitOnly: true,
245 + Transform: func(c *Config) error {
246 + c.Datastore.Spec = badgerSpecMeasure()
247 + return nil
248 + },
249 + },
250 "lowpower": {
251 Description: `Reduces daemon overhead on the system. May affect node
252 functionality - performance of content discovery and data
docs/changelogs/v0.35.md
+12 -2
@@ -16,7 +16,8 @@ This release was brought to you by the [Shipyard](http://ipshipyard.com/) team.
16 - [Enhanced DAG-Shaping Controls for `ipfs add`](#enhanced-dag-shaping-controls-for-ipfs-add)
17 - [New `ipfs add` Options](#new-ipfs-add-options)
18 - [Persistent `Import.*` Configuration](#persistent-import-configuration)
19 - - [Updated Configuration Profiles](#updated-configuration-profiles)
19 + - [Updated `Import` Profiles](#updated-import-profiles)
20 + - [`Datastore` Metrics Now Opt-In](#datastore-metrics-now-opt-in)
21 - [Optimized, dedicated queue for providing fresh CIDs](#optimized-dedicated-queue-for-providing-fresh-cids)
22 - [Deprecated `ipfs stats provider`](#deprecated-ipfs-stats-provider)
23 - [Pebble Database Format Config](#pebble-database-format-config)
@@ -74,7 +75,7 @@ You can set default values for these options using the following configuration s
75 - [`Import.UnixFSHAMTDirectoryMaxFanout`](https://github.com/ipfs/kubo/blob/master/docs/config.md#importunixfshamtdirectorymaxfanout)
76 - [`Import.UnixFSHAMTDirectorySizeThreshold`](https://github.com/ipfs/kubo/blob/master/docs/config.md#importunixfshamtdirectorysizethreshold)
77
77 -##### Updated Configuration Profiles
78 +##### Updated `Import` Profiles
79
80 The release updated configuration [profiles](https://github.com/ipfs/kubo/blob/master/docs/config.md#profiles) to incorporate these new `Import.*` settings:
81 - Updated Profile: `test-cid-v1` now includes current defaults as explicit `Import.UnixFSFileMaxLinks=174`, `Import.UnixFSDirectoryMaxLinks=0`, `Import.UnixFSHAMTDirectoryMaxFanout=256` and `Import.UnixFSHAMTDirectorySizeThreshold=256KiB`
@@ -84,6 +85,15 @@ The release updated configuration [profiles](https://github.com/ipfs/kubo/blob/m
85 > [!TIP]
86 > Apply one of CIDv1 test [profiles](https://github.com/ipfs/kubo/blob/master/docs/config.md#profiles) with `ipfs config profile apply test-cid-v1[-wide]`.
87
88 +#### `Datastore` Metrics Now Opt-In
89 +
90 +To reduce overhead in the default configuration, datastore metrics are no longer enabled by default when initializing a Kubo repository with `ipfs init`.
91 +Metrics prefixed with `<dsname>_datastore` (e.g., `flatfs_datastore_...`, `leveldb_datastore_...`) are not exposed unless explicitly enabled. For a complete list of affected default metrics, refer to [`prometheus_metrics_added_by_measure_profile`](https://github.com/ipfs/kubo/blob/master/test/sharness/t0119-prometheus-data/prometheus_metrics_added_by_measure_profile).
92 +
93 +Convenience opt-in [profiles](https://github.com/ipfs/kubo/blob/master/docs/config.md#profiles) can be enabled at initialization time with `ipfs init --profile`: `flatfs-measure`, `pebbleds-measure`, `badgerds-measure`
94 +
95 +It is also possible to manually add the `measure` wrapper. See examples in [`Datastore.Spec`](https://github.com/ipfs/kubo/blob/master/docs/config.md#datastorespec) documentation.
96 +
97 #### Optimized, dedicated queue for providing fresh CIDs
98
99 From `kubo` [`v0.33.0`](https://github.com/ipfs/kubo/releases/tag/v0.33.0),
docs/config.md
+40 -1
@@ -203,8 +203,11 @@ config file at runtime.
203 - [`local-discovery` profile](#local-discovery-profile)
204 - [`default-networking` profile](#default-networking-profile)
205 - [`flatfs` profile](#flatfs-profile)
206 + - [`flatfs-measure` profile](#flatfs-measure-profile)
207 - [`pebbleds` profile](#pebbleds-profile)
208 + - [`pebbleds-measure` profile](#pebbleds-measure-profile)
209 - [`badgerds` profile](#badgerds-profile)
210 + - [`badgerds-measure` profile](#badgerds-measure-profile)
211 - [`lowpower` profile](#lowpower-profile)
212 - [`announce-off` profile](#announce-off-profile)
213 - [`announce-on` profile](#announce-on-profile)
@@ -735,6 +738,30 @@ datastores to provide extra functionality (eg metrics, logging, or caching).
738
739 Default:
740 ```
741 +{
742 + "mounts": [
743 + {
744 + "mountpoint": "/blocks",
745 + "path": "blocks",
746 + "prefix": "flatfs.datastore",
747 + "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
748 + "sync": false,
749 + "type": "flatfs"
750 + },
751 + {
752 + "compression": "none",
753 + "mountpoint": "/",
754 + "path": "datastore",
755 + "prefix": "leveldb.datastore",
756 + "type": "levelds"
757 + }
758 + ],
759 + "type": "mount"
760 +}
761 +```
762 +
763 +With `flatfs-measure` profile:
764 +```
765 {
766 "mounts": [
767 {
@@ -2773,9 +2800,13 @@ You should use this datastore if:
2800 > [!NOTE]
2801 > See caveats and configuration options at [`datastores.md#flatfs`](datastores.md#flatfs)
2802
2803 +### `flatfs-measure` profile
2804 +
2805 +Configures the node to use the flatfs datastore with metrics. This is the same as [`flatfs` profile](#flatfs-profile) with the addition of the `measure` datastore wrapper.
2806 +
2807 ### `pebbleds` profile
2808
2778 -Configures the node to use the **EXPERIMENTAL** pebble high-performance datastore.
2809 +Configures the node to use the pebble high-performance datastore.
2810
2811 Pebble is a LevelDB/RocksDB inspired key-value store focused on performance and internal usage by CockroachDB.
2812 You should use this datastore if:
@@ -2793,6 +2824,10 @@ You should use this datastore if:
2824 > [!NOTE]
2825 > See other caveats and configuration options at [`datastores.md#pebbleds`](datastores.md#pebbleds)
2826
2827 +### `pebbleds-measure` profile
2828 +
2829 +Configures the node to use the pebble datastore with metrics. This is the same as [`pebbleds` profile](#pebble-profile) with the addition of the `measure` datastore wrapper.
2830 +
2831 ### `badgerds` profile
2832
2833 Configures the node to use the **legacy** badgerv1 datastore.
@@ -2818,6 +2853,10 @@ Also, be aware that:
2853 > [!NOTE]
2854 > See other caveats and configuration options at [`datastores.md#pebbleds`](datastores.md#pebbleds)
2855
2856 +### `badgerds-measure` profile
2857 +
2858 +Configures the node to use the **legacy** badgerv1 datastore with metrics. This is the same as [`badgerds` profile](#badger-profile) with the addition of the `measure` datastore wrapper.
2859 +
2860 ### `lowpower` profile
2861
2862 Reduces daemon overhead on the system by disabling optional swarm services.
test/sharness/lib/test-lib.sh
+21
@@ -214,6 +214,27 @@ test_init_ipfs() {
214
215 }
216
217 +test_init_ipfs_measure() {
218 + args=("$@")
219 +
220 + # we set the Addresses.API config variable.
221 + # the cli client knows to use it, so only need to set.
222 + # todo: in the future, use env?
223 +
224 + test_expect_success "ipfs init succeeds" '
225 + export IPFS_PATH="$(pwd)/.ipfs" &&
226 + ipfs init "${args[@]}" --profile=test,flatfs-measure > /dev/null
227 + '
228 +
229 + test_expect_success "prepare config -- mounting" '
230 + mkdir mountdir ipfs ipns &&
231 + test_config_set Mounts.IPFS "$(pwd)/ipfs" &&
232 + test_config_set Mounts.IPNS "$(pwd)/ipns" ||
233 + test_fsh cat "\"$IPFS_PATH/config\""
234 + '
235 +
236 +}
237 +
238 test_wait_for_file() {
239 loops=$1
240 delay=$2
test/sharness/t0060-daemon.sh
+2 -2
@@ -8,7 +8,7 @@ test_description="Test daemon command"
8
9 . lib/test-lib.sh
10
11 -test_expect_success "create badger config" '
11 +test_expect_success "create pebble config" '
12 ipfs init --profile=pebbleds,test > /dev/null &&
13 cp "$IPFS_PATH/config" init-config
14 '
@@ -21,7 +21,7 @@ test_launch_ipfs_daemon --init --init-config="$(pwd)/init-config" --init-profile
21 test_kill_ipfs_daemon
22
23 test_expect_success "daemon initialization with existing config works" '
24 - ipfs config "Datastore.Spec.child.path" >actual &&
24 + ipfs config "Datastore.Spec.path" >actual &&
25 test $(cat actual) = "pebbleds" &&
26 ipfs config Addresses > orig_addrs
27 '
test/sharness/t0119-prometheus-data/prometheus_metrics
-158
@@ -7,85 +7,6 @@ exchange_bitswap_wantlists_seconds_bucket
7 exchange_bitswap_wantlists_seconds_count
8 exchange_bitswap_wantlists_seconds_sum
9 exchange_bitswap_wantlists_total
10 -flatfs_datastore_batchcommit_errors_total
11 -flatfs_datastore_batchcommit_latency_seconds_bucket
12 -flatfs_datastore_batchcommit_latency_seconds_count
13 -flatfs_datastore_batchcommit_latency_seconds_sum
14 -flatfs_datastore_batchcommit_total
15 -flatfs_datastore_batchdelete_errors_total
16 -flatfs_datastore_batchdelete_latency_seconds_bucket
17 -flatfs_datastore_batchdelete_latency_seconds_count
18 -flatfs_datastore_batchdelete_latency_seconds_sum
19 -flatfs_datastore_batchdelete_total
20 -flatfs_datastore_batchput_errors_total
21 -flatfs_datastore_batchput_latency_seconds_bucket
22 -flatfs_datastore_batchput_latency_seconds_count
23 -flatfs_datastore_batchput_latency_seconds_sum
24 -flatfs_datastore_batchput_size_bytes_bucket
25 -flatfs_datastore_batchput_size_bytes_count
26 -flatfs_datastore_batchput_size_bytes_sum
27 -flatfs_datastore_batchput_total
28 -flatfs_datastore_check_errors_total
29 -flatfs_datastore_check_latency_seconds_bucket
30 -flatfs_datastore_check_latency_seconds_count
31 -flatfs_datastore_check_latency_seconds_sum
32 -flatfs_datastore_check_total
33 -flatfs_datastore_delete_errors_total
34 -flatfs_datastore_delete_latency_seconds_bucket
35 -flatfs_datastore_delete_latency_seconds_count
36 -flatfs_datastore_delete_latency_seconds_sum
37 -flatfs_datastore_delete_total
38 -flatfs_datastore_du_errors_total
39 -flatfs_datastore_du_latency_seconds_bucket
40 -flatfs_datastore_du_latency_seconds_count
41 -flatfs_datastore_du_latency_seconds_sum
42 -flatfs_datastore_du_total
43 -flatfs_datastore_gc_errors_total
44 -flatfs_datastore_gc_latency_seconds_bucket
45 -flatfs_datastore_gc_latency_seconds_count
46 -flatfs_datastore_gc_latency_seconds_sum
47 -flatfs_datastore_gc_total
48 -flatfs_datastore_get_errors_total
49 -flatfs_datastore_get_latency_seconds_bucket
50 -flatfs_datastore_get_latency_seconds_count
51 -flatfs_datastore_get_latency_seconds_sum
52 -flatfs_datastore_get_size_bytes_bucket
53 -flatfs_datastore_get_size_bytes_count
54 -flatfs_datastore_get_size_bytes_sum
55 -flatfs_datastore_get_total
56 -flatfs_datastore_getsize_errors_total
57 -flatfs_datastore_getsize_latency_seconds_bucket
58 -flatfs_datastore_getsize_latency_seconds_count
59 -flatfs_datastore_getsize_latency_seconds_sum
60 -flatfs_datastore_getsize_total
61 -flatfs_datastore_has_errors_total
62 -flatfs_datastore_has_latency_seconds_bucket
63 -flatfs_datastore_has_latency_seconds_count
64 -flatfs_datastore_has_latency_seconds_sum
65 -flatfs_datastore_has_total
66 -flatfs_datastore_put_errors_total
67 -flatfs_datastore_put_latency_seconds_bucket
68 -flatfs_datastore_put_latency_seconds_count
69 -flatfs_datastore_put_latency_seconds_sum
70 -flatfs_datastore_put_size_bytes_bucket
71 -flatfs_datastore_put_size_bytes_count
72 -flatfs_datastore_put_size_bytes_sum
73 -flatfs_datastore_put_total
74 -flatfs_datastore_query_errors_total
75 -flatfs_datastore_query_latency_seconds_bucket
76 -flatfs_datastore_query_latency_seconds_count
77 -flatfs_datastore_query_latency_seconds_sum
78 -flatfs_datastore_query_total
79 -flatfs_datastore_scrub_errors_total
80 -flatfs_datastore_scrub_latency_seconds_bucket
81 -flatfs_datastore_scrub_latency_seconds_count
82 -flatfs_datastore_scrub_latency_seconds_sum
83 -flatfs_datastore_scrub_total
84 -flatfs_datastore_sync_errors_total
85 -flatfs_datastore_sync_latency_seconds_bucket
86 -flatfs_datastore_sync_latency_seconds_count
87 -flatfs_datastore_sync_latency_seconds_sum
88 -flatfs_datastore_sync_total
10 go_gc_duration_seconds
11 go_gc_duration_seconds_count
12 go_gc_duration_seconds_sum
@@ -227,85 +148,6 @@ ipfs_http_response_size_bytes
148 ipfs_http_response_size_bytes_count
149 ipfs_http_response_size_bytes_sum
150 ipfs_info
230 -leveldb_datastore_batchcommit_errors_total
231 -leveldb_datastore_batchcommit_latency_seconds_bucket
232 -leveldb_datastore_batchcommit_latency_seconds_count
233 -leveldb_datastore_batchcommit_latency_seconds_sum
234 -leveldb_datastore_batchcommit_total
235 -leveldb_datastore_batchdelete_errors_total
236 -leveldb_datastore_batchdelete_latency_seconds_bucket
237 -leveldb_datastore_batchdelete_latency_seconds_count
238 -leveldb_datastore_batchdelete_latency_seconds_sum
239 -leveldb_datastore_batchdelete_total
240 -leveldb_datastore_batchput_errors_total
241 -leveldb_datastore_batchput_latency_seconds_bucket
242 -leveldb_datastore_batchput_latency_seconds_count
243 -leveldb_datastore_batchput_latency_seconds_sum
244 -leveldb_datastore_batchput_size_bytes_bucket
245 -leveldb_datastore_batchput_size_bytes_count
246 -leveldb_datastore_batchput_size_bytes_sum
247 -leveldb_datastore_batchput_total
248 -leveldb_datastore_check_errors_total
249 -leveldb_datastore_check_latency_seconds_bucket
250 -leveldb_datastore_check_latency_seconds_count
251 -leveldb_datastore_check_latency_seconds_sum
252 -leveldb_datastore_check_total
253 -leveldb_datastore_delete_errors_total
254 -leveldb_datastore_delete_latency_seconds_bucket
255 -leveldb_datastore_delete_latency_seconds_count
256 -leveldb_datastore_delete_latency_seconds_sum
257 -leveldb_datastore_delete_total
258 -leveldb_datastore_du_errors_total
259 -leveldb_datastore_du_latency_seconds_bucket
260 -leveldb_datastore_du_latency_seconds_count
261 -leveldb_datastore_du_latency_seconds_sum
262 -leveldb_datastore_du_total
263 -leveldb_datastore_gc_errors_total
264 -leveldb_datastore_gc_latency_seconds_bucket
265 -leveldb_datastore_gc_latency_seconds_count
266 -leveldb_datastore_gc_latency_seconds_sum
267 -leveldb_datastore_gc_total
268 -leveldb_datastore_get_errors_total
269 -leveldb_datastore_get_latency_seconds_bucket
270 -leveldb_datastore_get_latency_seconds_count
271 -leveldb_datastore_get_latency_seconds_sum
272 -leveldb_datastore_get_size_bytes_bucket
273 -leveldb_datastore_get_size_bytes_count
274 -leveldb_datastore_get_size_bytes_sum
275 -leveldb_datastore_get_total
276 -leveldb_datastore_getsize_errors_total
277 -leveldb_datastore_getsize_latency_seconds_bucket
278 -leveldb_datastore_getsize_latency_seconds_count
279 -leveldb_datastore_getsize_latency_seconds_sum
280 -leveldb_datastore_getsize_total
281 -leveldb_datastore_has_errors_total
282 -leveldb_datastore_has_latency_seconds_bucket
283 -leveldb_datastore_has_latency_seconds_count
284 -leveldb_datastore_has_latency_seconds_sum
285 -leveldb_datastore_has_total
286 -leveldb_datastore_put_errors_total
287 -leveldb_datastore_put_latency_seconds_bucket
288 -leveldb_datastore_put_latency_seconds_count
289 -leveldb_datastore_put_latency_seconds_sum
290 -leveldb_datastore_put_size_bytes_bucket
291 -leveldb_datastore_put_size_bytes_count
292 -leveldb_datastore_put_size_bytes_sum
293 -leveldb_datastore_put_total
294 -leveldb_datastore_query_errors_total
295 -leveldb_datastore_query_latency_seconds_bucket
296 -leveldb_datastore_query_latency_seconds_count
297 -leveldb_datastore_query_latency_seconds_sum
298 -leveldb_datastore_query_total
299 -leveldb_datastore_scrub_errors_total
300 -leveldb_datastore_scrub_latency_seconds_bucket
301 -leveldb_datastore_scrub_latency_seconds_count
302 -leveldb_datastore_scrub_latency_seconds_sum
303 -leveldb_datastore_scrub_total
304 -leveldb_datastore_sync_errors_total
305 -leveldb_datastore_sync_latency_seconds_bucket
306 -leveldb_datastore_sync_latency_seconds_count
307 -leveldb_datastore_sync_latency_seconds_sum
308 -leveldb_datastore_sync_total
151 libp2p_autonat_next_probe_timestamp
152 libp2p_autonat_reachability_status
153 libp2p_autonat_reachability_status_confidence
test/sharness/t0119-prometheus-data/prometheus_metrics_added_by_measure_profile new
+158
@@ -0,0 +1,158 @@
1 +flatfs_datastore_batchcommit_errors_total
2 +flatfs_datastore_batchcommit_latency_seconds_bucket
3 +flatfs_datastore_batchcommit_latency_seconds_count
4 +flatfs_datastore_batchcommit_latency_seconds_sum
5 +flatfs_datastore_batchcommit_total
6 +flatfs_datastore_batchdelete_errors_total
7 +flatfs_datastore_batchdelete_latency_seconds_bucket
8 +flatfs_datastore_batchdelete_latency_seconds_count
9 +flatfs_datastore_batchdelete_latency_seconds_sum
10 +flatfs_datastore_batchdelete_total
11 +flatfs_datastore_batchput_errors_total
12 +flatfs_datastore_batchput_latency_seconds_bucket
13 +flatfs_datastore_batchput_latency_seconds_count
14 +flatfs_datastore_batchput_latency_seconds_sum
15 +flatfs_datastore_batchput_size_bytes_bucket
16 +flatfs_datastore_batchput_size_bytes_count
17 +flatfs_datastore_batchput_size_bytes_sum
18 +flatfs_datastore_batchput_total
19 +flatfs_datastore_check_errors_total
20 +flatfs_datastore_check_latency_seconds_bucket
21 +flatfs_datastore_check_latency_seconds_count
22 +flatfs_datastore_check_latency_seconds_sum
23 +flatfs_datastore_check_total
24 +flatfs_datastore_delete_errors_total
25 +flatfs_datastore_delete_latency_seconds_bucket
26 +flatfs_datastore_delete_latency_seconds_count
27 +flatfs_datastore_delete_latency_seconds_sum
28 +flatfs_datastore_delete_total
29 +flatfs_datastore_du_errors_total
30 +flatfs_datastore_du_latency_seconds_bucket
31 +flatfs_datastore_du_latency_seconds_count
32 +flatfs_datastore_du_latency_seconds_sum
33 +flatfs_datastore_du_total
34 +flatfs_datastore_gc_errors_total
35 +flatfs_datastore_gc_latency_seconds_bucket
36 +flatfs_datastore_gc_latency_seconds_count
37 +flatfs_datastore_gc_latency_seconds_sum
38 +flatfs_datastore_gc_total
39 +flatfs_datastore_get_errors_total
40 +flatfs_datastore_get_latency_seconds_bucket
41 +flatfs_datastore_get_latency_seconds_count
42 +flatfs_datastore_get_latency_seconds_sum
43 +flatfs_datastore_get_size_bytes_bucket
44 +flatfs_datastore_get_size_bytes_count
45 +flatfs_datastore_get_size_bytes_sum
46 +flatfs_datastore_get_total
47 +flatfs_datastore_getsize_errors_total
48 +flatfs_datastore_getsize_latency_seconds_bucket
49 +flatfs_datastore_getsize_latency_seconds_count
50 +flatfs_datastore_getsize_latency_seconds_sum
51 +flatfs_datastore_getsize_total
52 +flatfs_datastore_has_errors_total
53 +flatfs_datastore_has_latency_seconds_bucket
54 +flatfs_datastore_has_latency_seconds_count
55 +flatfs_datastore_has_latency_seconds_sum
56 +flatfs_datastore_has_total
57 +flatfs_datastore_put_errors_total
58 +flatfs_datastore_put_latency_seconds_bucket
59 +flatfs_datastore_put_latency_seconds_count
60 +flatfs_datastore_put_latency_seconds_sum
61 +flatfs_datastore_put_size_bytes_bucket
62 +flatfs_datastore_put_size_bytes_count
63 +flatfs_datastore_put_size_bytes_sum
64 +flatfs_datastore_put_total
65 +flatfs_datastore_query_errors_total
66 +flatfs_datastore_query_latency_seconds_bucket
67 +flatfs_datastore_query_latency_seconds_count
68 +flatfs_datastore_query_latency_seconds_sum
69 +flatfs_datastore_query_total
70 +flatfs_datastore_scrub_errors_total
71 +flatfs_datastore_scrub_latency_seconds_bucket
72 +flatfs_datastore_scrub_latency_seconds_count
73 +flatfs_datastore_scrub_latency_seconds_sum
74 +flatfs_datastore_scrub_total
75 +flatfs_datastore_sync_errors_total
76 +flatfs_datastore_sync_latency_seconds_bucket
77 +flatfs_datastore_sync_latency_seconds_count
78 +flatfs_datastore_sync_latency_seconds_sum
79 +flatfs_datastore_sync_total
80 +leveldb_datastore_batchcommit_errors_total
81 +leveldb_datastore_batchcommit_latency_seconds_bucket
82 +leveldb_datastore_batchcommit_latency_seconds_count
83 +leveldb_datastore_batchcommit_latency_seconds_sum
84 +leveldb_datastore_batchcommit_total
85 +leveldb_datastore_batchdelete_errors_total
86 +leveldb_datastore_batchdelete_latency_seconds_bucket
87 +leveldb_datastore_batchdelete_latency_seconds_count
88 +leveldb_datastore_batchdelete_latency_seconds_sum
89 +leveldb_datastore_batchdelete_total
90 +leveldb_datastore_batchput_errors_total
91 +leveldb_datastore_batchput_latency_seconds_bucket
92 +leveldb_datastore_batchput_latency_seconds_count
93 +leveldb_datastore_batchput_latency_seconds_sum
94 +leveldb_datastore_batchput_size_bytes_bucket
95 +leveldb_datastore_batchput_size_bytes_count
96 +leveldb_datastore_batchput_size_bytes_sum
97 +leveldb_datastore_batchput_total
98 +leveldb_datastore_check_errors_total
99 +leveldb_datastore_check_latency_seconds_bucket
100 +leveldb_datastore_check_latency_seconds_count
101 +leveldb_datastore_check_latency_seconds_sum
102 +leveldb_datastore_check_total
103 +leveldb_datastore_delete_errors_total
104 +leveldb_datastore_delete_latency_seconds_bucket
105 +leveldb_datastore_delete_latency_seconds_count
106 +leveldb_datastore_delete_latency_seconds_sum
107 +leveldb_datastore_delete_total
108 +leveldb_datastore_du_errors_total
109 +leveldb_datastore_du_latency_seconds_bucket
110 +leveldb_datastore_du_latency_seconds_count
111 +leveldb_datastore_du_latency_seconds_sum
112 +leveldb_datastore_du_total
113 +leveldb_datastore_gc_errors_total
114 +leveldb_datastore_gc_latency_seconds_bucket
115 +leveldb_datastore_gc_latency_seconds_count
116 +leveldb_datastore_gc_latency_seconds_sum
117 +leveldb_datastore_gc_total
118 +leveldb_datastore_get_errors_total
119 +leveldb_datastore_get_latency_seconds_bucket
120 +leveldb_datastore_get_latency_seconds_count
121 +leveldb_datastore_get_latency_seconds_sum
122 +leveldb_datastore_get_size_bytes_bucket
123 +leveldb_datastore_get_size_bytes_count
124 +leveldb_datastore_get_size_bytes_sum
125 +leveldb_datastore_get_total
126 +leveldb_datastore_getsize_errors_total
127 +leveldb_datastore_getsize_latency_seconds_bucket
128 +leveldb_datastore_getsize_latency_seconds_count
129 +leveldb_datastore_getsize_latency_seconds_sum
130 +leveldb_datastore_getsize_total
131 +leveldb_datastore_has_errors_total
132 +leveldb_datastore_has_latency_seconds_bucket
133 +leveldb_datastore_has_latency_seconds_count
134 +leveldb_datastore_has_latency_seconds_sum
135 +leveldb_datastore_has_total
136 +leveldb_datastore_put_errors_total
137 +leveldb_datastore_put_latency_seconds_bucket
138 +leveldb_datastore_put_latency_seconds_count
139 +leveldb_datastore_put_latency_seconds_sum
140 +leveldb_datastore_put_size_bytes_bucket
141 +leveldb_datastore_put_size_bytes_count
142 +leveldb_datastore_put_size_bytes_sum
143 +leveldb_datastore_put_total
144 +leveldb_datastore_query_errors_total
145 +leveldb_datastore_query_latency_seconds_bucket
146 +leveldb_datastore_query_latency_seconds_count
147 +leveldb_datastore_query_latency_seconds_sum
148 +leveldb_datastore_query_total
149 +leveldb_datastore_scrub_errors_total
150 +leveldb_datastore_scrub_latency_seconds_bucket
151 +leveldb_datastore_scrub_latency_seconds_count
152 +leveldb_datastore_scrub_latency_seconds_sum
153 +leveldb_datastore_scrub_total
154 +leveldb_datastore_sync_errors_total
155 +leveldb_datastore_sync_latency_seconds_bucket
156 +leveldb_datastore_sync_latency_seconds_count
157 +leveldb_datastore_sync_latency_seconds_sum
158 +leveldb_datastore_sync_total
test/sharness/t0119-prometheus.sh
+24
@@ -57,4 +57,28 @@ test_expect_success "make sure initial metrics added by setting ResourceMgr.Enab
57 diff -u ../t0119-prometheus-data/prometheus_metrics_added_by_enabling_rcmgr rcmgr_metrics
58 '
59
60 +# Reinitialize ipfs with --profile=flatfs-measure and check metrics.
61 +
62 +test_expect_success "remove ipfs directory" '
63 + rm -rf .ipfs mountdir ipfs ipns
64 +'
65 +
66 +test_init_ipfs_measure
67 +
68 +test_launch_ipfs_daemon
69 +
70 +test_expect_success "collect metrics" '
71 + curl "$API_ADDR/debug/metrics/prometheus" > raw_metrics
72 +'
73 +test_kill_ipfs_daemon
74 +
75 +test_expect_success "filter metrics and find ones added by enabling flatfs-measure profile" '
76 + sed -ne "s/^\([a-z0-9_]\+\).*/\1/p" raw_metrics | LC_ALL=C sort > filtered_metrics &&
77 + grep -v -x -f ../t0119-prometheus-data/prometheus_metrics filtered_metrics | LC_ALL=C sort | uniq > measure_metrics
78 +'
79 +
80 +test_expect_success "make sure initial metrics added by initializing with flatfs-measure profile haven't changed" '
81 + diff -u ../t0119-prometheus-data/prometheus_metrics_added_by_measure_profile measure_metrics
82 +'
83 +
84 test_done