diff --git a/config/init.go b/config/init.go index c32b53e17..1da876313 100644 --- a/config/init.go +++ b/config/init.go @@ -141,6 +141,15 @@ func DefaultDatastoreConfig() Datastore { } func pebbleSpec() map[string]interface{} { + return map[string]interface{}{ + "type": "pebbleds", + "prefix": "pebble.datastore", + "path": "pebbleds", + "formatMajorVersion": int(pebble.FormatNewest), + } +} + +func pebbleSpecMeasure() map[string]interface{} { return map[string]interface{}{ "type": "measure", "prefix": "pebble.datastore", @@ -153,6 +162,16 @@ func pebbleSpec() map[string]interface{} { } func badgerSpec() map[string]interface{} { + return map[string]interface{}{ + "type": "badgerds", + "prefix": "badger.datastore", + "path": "badgerds", + "syncWrites": false, + "truncate": true, + } +} + +func badgerSpecMeasure() map[string]interface{} { return map[string]interface{}{ "type": "measure", "prefix": "badger.datastore", @@ -166,6 +185,29 @@ func badgerSpec() map[string]interface{} { } func flatfsSpec() map[string]interface{} { + return map[string]interface{}{ + "type": "mount", + "mounts": []interface{}{ + map[string]interface{}{ + "mountpoint": "/blocks", + "type": "flatfs", + "prefix": "flatfs.datastore", + "path": "blocks", + "sync": false, + "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2", + }, + map[string]interface{}{ + "mountpoint": "/", + "type": "levelds", + "prefix": "leveldb.datastore", + "path": "datastore", + "compression": "none", + }, + }, + } +} + +func flatfsSpecMeasure() map[string]interface{} { return map[string]interface{}{ "type": "mount", "mounts": []interface{}{ diff --git a/config/profile.go b/config/profile.go index a26d74f99..605af3555 100644 --- a/config/profile.go +++ b/config/profile.go @@ -150,6 +150,20 @@ NOTE: This profile may only be applied when first initializing node at IPFS_PATH return nil }, }, + "flatfs-measure": { + Description: `Configures the node to use the flatfs datastore with metrics tracking wrapper. +Additional '*_datastore_*' metrics will be exposed on /debug/metrics/prometheus + +NOTE: This profile may only be applied when first initializing node at IPFS_PATH + via 'ipfs init --profile flatfs-measure' +`, + + InitOnly: true, + Transform: func(c *Config) error { + c.Datastore.Spec = flatfsSpecMeasure() + return nil + }, + }, "pebbleds": { Description: `Configures the node to use the pebble high-performance datastore. @@ -176,6 +190,20 @@ NOTE: This profile may only be applied when first initializing node at IPFS_PATH return nil }, }, + "pebbleds-measure": { + Description: `Configures the node to use the pebble datastore with metrics tracking wrapper. +Additional '*_datastore_*' metrics will be exposed on /debug/metrics/prometheus + +NOTE: This profile may only be applied when first initializing node at IPFS_PATH + via 'ipfs init --profile pebbleds-measure' +`, + + InitOnly: true, + Transform: func(c *Config) error { + c.Datastore.Spec = pebbleSpecMeasure() + return nil + }, + }, "badgerds": { Description: `Configures the node to use the legacy badgerv1 datastore. @@ -205,6 +233,20 @@ NOTE: This profile may only be applied when first initializing node at IPFS_PATH return nil }, }, + "badgerds-measure": { + Description: `Configures the node to use the legacy badgerv1 datastore with metrics wrapper. +Additional '*_datastore_*' metrics will be exposed on /debug/metrics/prometheus + +NOTE: This profile may only be applied when first initializing node at IPFS_PATH + via 'ipfs init --profile badgerds-measure' +`, + + InitOnly: true, + Transform: func(c *Config) error { + c.Datastore.Spec = badgerSpecMeasure() + return nil + }, + }, "lowpower": { Description: `Reduces daemon overhead on the system. May affect node functionality - performance of content discovery and data diff --git a/docs/changelogs/v0.35.md b/docs/changelogs/v0.35.md index 98a7f2af4..825d536fa 100644 --- a/docs/changelogs/v0.35.md +++ b/docs/changelogs/v0.35.md @@ -16,7 +16,8 @@ This release was brought to you by the [Shipyard](http://ipshipyard.com/) team. - [Enhanced DAG-Shaping Controls for `ipfs add`](#enhanced-dag-shaping-controls-for-ipfs-add) - [New `ipfs add` Options](#new-ipfs-add-options) - [Persistent `Import.*` Configuration](#persistent-import-configuration) - - [Updated Configuration Profiles](#updated-configuration-profiles) + - [Updated `Import` Profiles](#updated-import-profiles) + - [`Datastore` Metrics Now Opt-In](#datastore-metrics-now-opt-in) - [Optimized, dedicated queue for providing fresh CIDs](#optimized-dedicated-queue-for-providing-fresh-cids) - [Deprecated `ipfs stats provider`](#deprecated-ipfs-stats-provider) - [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 - [`Import.UnixFSHAMTDirectoryMaxFanout`](https://github.com/ipfs/kubo/blob/master/docs/config.md#importunixfshamtdirectorymaxfanout) - [`Import.UnixFSHAMTDirectorySizeThreshold`](https://github.com/ipfs/kubo/blob/master/docs/config.md#importunixfshamtdirectorysizethreshold) -##### Updated Configuration Profiles +##### Updated `Import` Profiles The release updated configuration [profiles](https://github.com/ipfs/kubo/blob/master/docs/config.md#profiles) to incorporate these new `Import.*` settings: - 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 > [!TIP] > 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]`. +#### `Datastore` Metrics Now Opt-In + +To reduce overhead in the default configuration, datastore metrics are no longer enabled by default when initializing a Kubo repository with `ipfs init`. +Metrics prefixed with `_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). + +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` + +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. + #### Optimized, dedicated queue for providing fresh CIDs From `kubo` [`v0.33.0`](https://github.com/ipfs/kubo/releases/tag/v0.33.0), diff --git a/docs/config.md b/docs/config.md index d812f8271..504597aa2 100644 --- a/docs/config.md +++ b/docs/config.md @@ -203,8 +203,11 @@ config file at runtime. - [`local-discovery` profile](#local-discovery-profile) - [`default-networking` profile](#default-networking-profile) - [`flatfs` profile](#flatfs-profile) + - [`flatfs-measure` profile](#flatfs-measure-profile) - [`pebbleds` profile](#pebbleds-profile) + - [`pebbleds-measure` profile](#pebbleds-measure-profile) - [`badgerds` profile](#badgerds-profile) + - [`badgerds-measure` profile](#badgerds-measure-profile) - [`lowpower` profile](#lowpower-profile) - [`announce-off` profile](#announce-off-profile) - [`announce-on` profile](#announce-on-profile) @@ -735,6 +738,30 @@ datastores to provide extra functionality (eg metrics, logging, or caching). Default: ``` +{ + "mounts": [ + { + "mountpoint": "/blocks", + "path": "blocks", + "prefix": "flatfs.datastore", + "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2", + "sync": false, + "type": "flatfs" + }, + { + "compression": "none", + "mountpoint": "/", + "path": "datastore", + "prefix": "leveldb.datastore", + "type": "levelds" + } + ], + "type": "mount" +} +``` + +With `flatfs-measure` profile: +``` { "mounts": [ { @@ -2773,9 +2800,13 @@ You should use this datastore if: > [!NOTE] > See caveats and configuration options at [`datastores.md#flatfs`](datastores.md#flatfs) +### `flatfs-measure` profile + +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. + ### `pebbleds` profile -Configures the node to use the **EXPERIMENTAL** pebble high-performance datastore. +Configures the node to use the pebble high-performance datastore. Pebble is a LevelDB/RocksDB inspired key-value store focused on performance and internal usage by CockroachDB. You should use this datastore if: @@ -2793,6 +2824,10 @@ You should use this datastore if: > [!NOTE] > See other caveats and configuration options at [`datastores.md#pebbleds`](datastores.md#pebbleds) +### `pebbleds-measure` profile + +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. + ### `badgerds` profile Configures the node to use the **legacy** badgerv1 datastore. @@ -2818,6 +2853,10 @@ Also, be aware that: > [!NOTE] > See other caveats and configuration options at [`datastores.md#pebbleds`](datastores.md#pebbleds) +### `badgerds-measure` profile + +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. + ### `lowpower` profile Reduces daemon overhead on the system by disabling optional swarm services. diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index e5714d622..12a1f71be 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -214,6 +214,27 @@ test_init_ipfs() { } +test_init_ipfs_measure() { + args=("$@") + + # we set the Addresses.API config variable. + # the cli client knows to use it, so only need to set. + # todo: in the future, use env? + + test_expect_success "ipfs init succeeds" ' + export IPFS_PATH="$(pwd)/.ipfs" && + ipfs init "${args[@]}" --profile=test,flatfs-measure > /dev/null + ' + + test_expect_success "prepare config -- mounting" ' + mkdir mountdir ipfs ipns && + test_config_set Mounts.IPFS "$(pwd)/ipfs" && + test_config_set Mounts.IPNS "$(pwd)/ipns" || + test_fsh cat "\"$IPFS_PATH/config\"" + ' + +} + test_wait_for_file() { loops=$1 delay=$2 diff --git a/test/sharness/t0060-daemon.sh b/test/sharness/t0060-daemon.sh index 45788da55..5dbbd852f 100755 --- a/test/sharness/t0060-daemon.sh +++ b/test/sharness/t0060-daemon.sh @@ -8,7 +8,7 @@ test_description="Test daemon command" . lib/test-lib.sh -test_expect_success "create badger config" ' +test_expect_success "create pebble config" ' ipfs init --profile=pebbleds,test > /dev/null && cp "$IPFS_PATH/config" init-config ' @@ -21,7 +21,7 @@ test_launch_ipfs_daemon --init --init-config="$(pwd)/init-config" --init-profile test_kill_ipfs_daemon test_expect_success "daemon initialization with existing config works" ' - ipfs config "Datastore.Spec.child.path" >actual && + ipfs config "Datastore.Spec.path" >actual && test $(cat actual) = "pebbleds" && ipfs config Addresses > orig_addrs ' diff --git a/test/sharness/t0119-prometheus-data/prometheus_metrics b/test/sharness/t0119-prometheus-data/prometheus_metrics index 07cd44d8f..d0900322b 100644 --- a/test/sharness/t0119-prometheus-data/prometheus_metrics +++ b/test/sharness/t0119-prometheus-data/prometheus_metrics @@ -7,85 +7,6 @@ exchange_bitswap_wantlists_seconds_bucket exchange_bitswap_wantlists_seconds_count exchange_bitswap_wantlists_seconds_sum exchange_bitswap_wantlists_total -flatfs_datastore_batchcommit_errors_total -flatfs_datastore_batchcommit_latency_seconds_bucket -flatfs_datastore_batchcommit_latency_seconds_count -flatfs_datastore_batchcommit_latency_seconds_sum -flatfs_datastore_batchcommit_total -flatfs_datastore_batchdelete_errors_total -flatfs_datastore_batchdelete_latency_seconds_bucket -flatfs_datastore_batchdelete_latency_seconds_count -flatfs_datastore_batchdelete_latency_seconds_sum -flatfs_datastore_batchdelete_total -flatfs_datastore_batchput_errors_total -flatfs_datastore_batchput_latency_seconds_bucket -flatfs_datastore_batchput_latency_seconds_count -flatfs_datastore_batchput_latency_seconds_sum -flatfs_datastore_batchput_size_bytes_bucket -flatfs_datastore_batchput_size_bytes_count -flatfs_datastore_batchput_size_bytes_sum -flatfs_datastore_batchput_total -flatfs_datastore_check_errors_total -flatfs_datastore_check_latency_seconds_bucket -flatfs_datastore_check_latency_seconds_count -flatfs_datastore_check_latency_seconds_sum -flatfs_datastore_check_total -flatfs_datastore_delete_errors_total -flatfs_datastore_delete_latency_seconds_bucket -flatfs_datastore_delete_latency_seconds_count -flatfs_datastore_delete_latency_seconds_sum -flatfs_datastore_delete_total -flatfs_datastore_du_errors_total -flatfs_datastore_du_latency_seconds_bucket -flatfs_datastore_du_latency_seconds_count -flatfs_datastore_du_latency_seconds_sum -flatfs_datastore_du_total -flatfs_datastore_gc_errors_total -flatfs_datastore_gc_latency_seconds_bucket -flatfs_datastore_gc_latency_seconds_count -flatfs_datastore_gc_latency_seconds_sum -flatfs_datastore_gc_total -flatfs_datastore_get_errors_total -flatfs_datastore_get_latency_seconds_bucket -flatfs_datastore_get_latency_seconds_count -flatfs_datastore_get_latency_seconds_sum -flatfs_datastore_get_size_bytes_bucket -flatfs_datastore_get_size_bytes_count -flatfs_datastore_get_size_bytes_sum -flatfs_datastore_get_total -flatfs_datastore_getsize_errors_total -flatfs_datastore_getsize_latency_seconds_bucket -flatfs_datastore_getsize_latency_seconds_count -flatfs_datastore_getsize_latency_seconds_sum -flatfs_datastore_getsize_total -flatfs_datastore_has_errors_total -flatfs_datastore_has_latency_seconds_bucket -flatfs_datastore_has_latency_seconds_count -flatfs_datastore_has_latency_seconds_sum -flatfs_datastore_has_total -flatfs_datastore_put_errors_total -flatfs_datastore_put_latency_seconds_bucket -flatfs_datastore_put_latency_seconds_count -flatfs_datastore_put_latency_seconds_sum -flatfs_datastore_put_size_bytes_bucket -flatfs_datastore_put_size_bytes_count -flatfs_datastore_put_size_bytes_sum -flatfs_datastore_put_total -flatfs_datastore_query_errors_total -flatfs_datastore_query_latency_seconds_bucket -flatfs_datastore_query_latency_seconds_count -flatfs_datastore_query_latency_seconds_sum -flatfs_datastore_query_total -flatfs_datastore_scrub_errors_total -flatfs_datastore_scrub_latency_seconds_bucket -flatfs_datastore_scrub_latency_seconds_count -flatfs_datastore_scrub_latency_seconds_sum -flatfs_datastore_scrub_total -flatfs_datastore_sync_errors_total -flatfs_datastore_sync_latency_seconds_bucket -flatfs_datastore_sync_latency_seconds_count -flatfs_datastore_sync_latency_seconds_sum -flatfs_datastore_sync_total go_gc_duration_seconds go_gc_duration_seconds_count go_gc_duration_seconds_sum @@ -227,85 +148,6 @@ ipfs_http_response_size_bytes ipfs_http_response_size_bytes_count ipfs_http_response_size_bytes_sum ipfs_info -leveldb_datastore_batchcommit_errors_total -leveldb_datastore_batchcommit_latency_seconds_bucket -leveldb_datastore_batchcommit_latency_seconds_count -leveldb_datastore_batchcommit_latency_seconds_sum -leveldb_datastore_batchcommit_total -leveldb_datastore_batchdelete_errors_total -leveldb_datastore_batchdelete_latency_seconds_bucket -leveldb_datastore_batchdelete_latency_seconds_count -leveldb_datastore_batchdelete_latency_seconds_sum -leveldb_datastore_batchdelete_total -leveldb_datastore_batchput_errors_total -leveldb_datastore_batchput_latency_seconds_bucket -leveldb_datastore_batchput_latency_seconds_count -leveldb_datastore_batchput_latency_seconds_sum -leveldb_datastore_batchput_size_bytes_bucket -leveldb_datastore_batchput_size_bytes_count -leveldb_datastore_batchput_size_bytes_sum -leveldb_datastore_batchput_total -leveldb_datastore_check_errors_total -leveldb_datastore_check_latency_seconds_bucket -leveldb_datastore_check_latency_seconds_count -leveldb_datastore_check_latency_seconds_sum -leveldb_datastore_check_total -leveldb_datastore_delete_errors_total -leveldb_datastore_delete_latency_seconds_bucket -leveldb_datastore_delete_latency_seconds_count -leveldb_datastore_delete_latency_seconds_sum -leveldb_datastore_delete_total -leveldb_datastore_du_errors_total -leveldb_datastore_du_latency_seconds_bucket -leveldb_datastore_du_latency_seconds_count -leveldb_datastore_du_latency_seconds_sum -leveldb_datastore_du_total -leveldb_datastore_gc_errors_total -leveldb_datastore_gc_latency_seconds_bucket -leveldb_datastore_gc_latency_seconds_count -leveldb_datastore_gc_latency_seconds_sum -leveldb_datastore_gc_total -leveldb_datastore_get_errors_total -leveldb_datastore_get_latency_seconds_bucket -leveldb_datastore_get_latency_seconds_count -leveldb_datastore_get_latency_seconds_sum -leveldb_datastore_get_size_bytes_bucket -leveldb_datastore_get_size_bytes_count -leveldb_datastore_get_size_bytes_sum -leveldb_datastore_get_total -leveldb_datastore_getsize_errors_total -leveldb_datastore_getsize_latency_seconds_bucket -leveldb_datastore_getsize_latency_seconds_count -leveldb_datastore_getsize_latency_seconds_sum -leveldb_datastore_getsize_total -leveldb_datastore_has_errors_total -leveldb_datastore_has_latency_seconds_bucket -leveldb_datastore_has_latency_seconds_count -leveldb_datastore_has_latency_seconds_sum -leveldb_datastore_has_total -leveldb_datastore_put_errors_total -leveldb_datastore_put_latency_seconds_bucket -leveldb_datastore_put_latency_seconds_count -leveldb_datastore_put_latency_seconds_sum -leveldb_datastore_put_size_bytes_bucket -leveldb_datastore_put_size_bytes_count -leveldb_datastore_put_size_bytes_sum -leveldb_datastore_put_total -leveldb_datastore_query_errors_total -leveldb_datastore_query_latency_seconds_bucket -leveldb_datastore_query_latency_seconds_count -leveldb_datastore_query_latency_seconds_sum -leveldb_datastore_query_total -leveldb_datastore_scrub_errors_total -leveldb_datastore_scrub_latency_seconds_bucket -leveldb_datastore_scrub_latency_seconds_count -leveldb_datastore_scrub_latency_seconds_sum -leveldb_datastore_scrub_total -leveldb_datastore_sync_errors_total -leveldb_datastore_sync_latency_seconds_bucket -leveldb_datastore_sync_latency_seconds_count -leveldb_datastore_sync_latency_seconds_sum -leveldb_datastore_sync_total libp2p_autonat_next_probe_timestamp libp2p_autonat_reachability_status libp2p_autonat_reachability_status_confidence diff --git a/test/sharness/t0119-prometheus-data/prometheus_metrics_added_by_measure_profile b/test/sharness/t0119-prometheus-data/prometheus_metrics_added_by_measure_profile new file mode 100644 index 000000000..03f132701 --- /dev/null +++ b/test/sharness/t0119-prometheus-data/prometheus_metrics_added_by_measure_profile @@ -0,0 +1,158 @@ +flatfs_datastore_batchcommit_errors_total +flatfs_datastore_batchcommit_latency_seconds_bucket +flatfs_datastore_batchcommit_latency_seconds_count +flatfs_datastore_batchcommit_latency_seconds_sum +flatfs_datastore_batchcommit_total +flatfs_datastore_batchdelete_errors_total +flatfs_datastore_batchdelete_latency_seconds_bucket +flatfs_datastore_batchdelete_latency_seconds_count +flatfs_datastore_batchdelete_latency_seconds_sum +flatfs_datastore_batchdelete_total +flatfs_datastore_batchput_errors_total +flatfs_datastore_batchput_latency_seconds_bucket +flatfs_datastore_batchput_latency_seconds_count +flatfs_datastore_batchput_latency_seconds_sum +flatfs_datastore_batchput_size_bytes_bucket +flatfs_datastore_batchput_size_bytes_count +flatfs_datastore_batchput_size_bytes_sum +flatfs_datastore_batchput_total +flatfs_datastore_check_errors_total +flatfs_datastore_check_latency_seconds_bucket +flatfs_datastore_check_latency_seconds_count +flatfs_datastore_check_latency_seconds_sum +flatfs_datastore_check_total +flatfs_datastore_delete_errors_total +flatfs_datastore_delete_latency_seconds_bucket +flatfs_datastore_delete_latency_seconds_count +flatfs_datastore_delete_latency_seconds_sum +flatfs_datastore_delete_total +flatfs_datastore_du_errors_total +flatfs_datastore_du_latency_seconds_bucket +flatfs_datastore_du_latency_seconds_count +flatfs_datastore_du_latency_seconds_sum +flatfs_datastore_du_total +flatfs_datastore_gc_errors_total +flatfs_datastore_gc_latency_seconds_bucket +flatfs_datastore_gc_latency_seconds_count +flatfs_datastore_gc_latency_seconds_sum +flatfs_datastore_gc_total +flatfs_datastore_get_errors_total +flatfs_datastore_get_latency_seconds_bucket +flatfs_datastore_get_latency_seconds_count +flatfs_datastore_get_latency_seconds_sum +flatfs_datastore_get_size_bytes_bucket +flatfs_datastore_get_size_bytes_count +flatfs_datastore_get_size_bytes_sum +flatfs_datastore_get_total +flatfs_datastore_getsize_errors_total +flatfs_datastore_getsize_latency_seconds_bucket +flatfs_datastore_getsize_latency_seconds_count +flatfs_datastore_getsize_latency_seconds_sum +flatfs_datastore_getsize_total +flatfs_datastore_has_errors_total +flatfs_datastore_has_latency_seconds_bucket +flatfs_datastore_has_latency_seconds_count +flatfs_datastore_has_latency_seconds_sum +flatfs_datastore_has_total +flatfs_datastore_put_errors_total +flatfs_datastore_put_latency_seconds_bucket +flatfs_datastore_put_latency_seconds_count +flatfs_datastore_put_latency_seconds_sum +flatfs_datastore_put_size_bytes_bucket +flatfs_datastore_put_size_bytes_count +flatfs_datastore_put_size_bytes_sum +flatfs_datastore_put_total +flatfs_datastore_query_errors_total +flatfs_datastore_query_latency_seconds_bucket +flatfs_datastore_query_latency_seconds_count +flatfs_datastore_query_latency_seconds_sum +flatfs_datastore_query_total +flatfs_datastore_scrub_errors_total +flatfs_datastore_scrub_latency_seconds_bucket +flatfs_datastore_scrub_latency_seconds_count +flatfs_datastore_scrub_latency_seconds_sum +flatfs_datastore_scrub_total +flatfs_datastore_sync_errors_total +flatfs_datastore_sync_latency_seconds_bucket +flatfs_datastore_sync_latency_seconds_count +flatfs_datastore_sync_latency_seconds_sum +flatfs_datastore_sync_total +leveldb_datastore_batchcommit_errors_total +leveldb_datastore_batchcommit_latency_seconds_bucket +leveldb_datastore_batchcommit_latency_seconds_count +leveldb_datastore_batchcommit_latency_seconds_sum +leveldb_datastore_batchcommit_total +leveldb_datastore_batchdelete_errors_total +leveldb_datastore_batchdelete_latency_seconds_bucket +leveldb_datastore_batchdelete_latency_seconds_count +leveldb_datastore_batchdelete_latency_seconds_sum +leveldb_datastore_batchdelete_total +leveldb_datastore_batchput_errors_total +leveldb_datastore_batchput_latency_seconds_bucket +leveldb_datastore_batchput_latency_seconds_count +leveldb_datastore_batchput_latency_seconds_sum +leveldb_datastore_batchput_size_bytes_bucket +leveldb_datastore_batchput_size_bytes_count +leveldb_datastore_batchput_size_bytes_sum +leveldb_datastore_batchput_total +leveldb_datastore_check_errors_total +leveldb_datastore_check_latency_seconds_bucket +leveldb_datastore_check_latency_seconds_count +leveldb_datastore_check_latency_seconds_sum +leveldb_datastore_check_total +leveldb_datastore_delete_errors_total +leveldb_datastore_delete_latency_seconds_bucket +leveldb_datastore_delete_latency_seconds_count +leveldb_datastore_delete_latency_seconds_sum +leveldb_datastore_delete_total +leveldb_datastore_du_errors_total +leveldb_datastore_du_latency_seconds_bucket +leveldb_datastore_du_latency_seconds_count +leveldb_datastore_du_latency_seconds_sum +leveldb_datastore_du_total +leveldb_datastore_gc_errors_total +leveldb_datastore_gc_latency_seconds_bucket +leveldb_datastore_gc_latency_seconds_count +leveldb_datastore_gc_latency_seconds_sum +leveldb_datastore_gc_total +leveldb_datastore_get_errors_total +leveldb_datastore_get_latency_seconds_bucket +leveldb_datastore_get_latency_seconds_count +leveldb_datastore_get_latency_seconds_sum +leveldb_datastore_get_size_bytes_bucket +leveldb_datastore_get_size_bytes_count +leveldb_datastore_get_size_bytes_sum +leveldb_datastore_get_total +leveldb_datastore_getsize_errors_total +leveldb_datastore_getsize_latency_seconds_bucket +leveldb_datastore_getsize_latency_seconds_count +leveldb_datastore_getsize_latency_seconds_sum +leveldb_datastore_getsize_total +leveldb_datastore_has_errors_total +leveldb_datastore_has_latency_seconds_bucket +leveldb_datastore_has_latency_seconds_count +leveldb_datastore_has_latency_seconds_sum +leveldb_datastore_has_total +leveldb_datastore_put_errors_total +leveldb_datastore_put_latency_seconds_bucket +leveldb_datastore_put_latency_seconds_count +leveldb_datastore_put_latency_seconds_sum +leveldb_datastore_put_size_bytes_bucket +leveldb_datastore_put_size_bytes_count +leveldb_datastore_put_size_bytes_sum +leveldb_datastore_put_total +leveldb_datastore_query_errors_total +leveldb_datastore_query_latency_seconds_bucket +leveldb_datastore_query_latency_seconds_count +leveldb_datastore_query_latency_seconds_sum +leveldb_datastore_query_total +leveldb_datastore_scrub_errors_total +leveldb_datastore_scrub_latency_seconds_bucket +leveldb_datastore_scrub_latency_seconds_count +leveldb_datastore_scrub_latency_seconds_sum +leveldb_datastore_scrub_total +leveldb_datastore_sync_errors_total +leveldb_datastore_sync_latency_seconds_bucket +leveldb_datastore_sync_latency_seconds_count +leveldb_datastore_sync_latency_seconds_sum +leveldb_datastore_sync_total diff --git a/test/sharness/t0119-prometheus.sh b/test/sharness/t0119-prometheus.sh index fef204e23..4daf8281b 100755 --- a/test/sharness/t0119-prometheus.sh +++ b/test/sharness/t0119-prometheus.sh @@ -57,4 +57,28 @@ test_expect_success "make sure initial metrics added by setting ResourceMgr.Enab diff -u ../t0119-prometheus-data/prometheus_metrics_added_by_enabling_rcmgr rcmgr_metrics ' +# Reinitialize ipfs with --profile=flatfs-measure and check metrics. + +test_expect_success "remove ipfs directory" ' + rm -rf .ipfs mountdir ipfs ipns +' + +test_init_ipfs_measure + +test_launch_ipfs_daemon + +test_expect_success "collect metrics" ' + curl "$API_ADDR/debug/metrics/prometheus" > raw_metrics +' +test_kill_ipfs_daemon + +test_expect_success "filter metrics and find ones added by enabling flatfs-measure profile" ' + sed -ne "s/^\([a-z0-9_]\+\).*/\1/p" raw_metrics | LC_ALL=C sort > filtered_metrics && + grep -v -x -f ../t0119-prometheus-data/prometheus_metrics filtered_metrics | LC_ALL=C sort | uniq > measure_metrics +' + +test_expect_success "make sure initial metrics added by initializing with flatfs-measure profile haven't changed" ' + diff -u ../t0119-prometheus-data/prometheus_metrics_added_by_measure_profile measure_metrics +' + test_done