Skip to content

Commit 40f2733

Browse files
committed
PMM-9870 improve help.
1 parent af4feb9 commit 40f2733

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

exporter/collstats_collector_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,22 @@ func TestCollStatsCollector(t *testing.T) {
5858

5959
// The last \n at the end of this string is important
6060
expected := strings.NewReader(`
61-
# HELP mongodb_collstats_latencyStats_commands_latency collstats.latencyStats.commands.
61+
# HELP mongodb_collstats_latencyStats_commands_latency collstats.latencyStats.commands.latency
6262
# TYPE mongodb_collstats_latencyStats_commands_latency untyped
6363
mongodb_collstats_latencyStats_commands_latency{collection="testcol_00",database="testdb"} 0
6464
mongodb_collstats_latencyStats_commands_latency{collection="testcol_01",database="testdb"} 0
6565
mongodb_collstats_latencyStats_commands_latency{collection="testcol_02",database="testdb"} 0
66-
# HELP mongodb_collstats_latencyStats_transactions_ops collstats.latencyStats.transactions.
66+
# HELP mongodb_collstats_latencyStats_transactions_ops collstats.latencyStats.transactions.ops
6767
# TYPE mongodb_collstats_latencyStats_transactions_ops untyped
6868
mongodb_collstats_latencyStats_transactions_ops{collection="testcol_00",database="testdb"} 0
6969
mongodb_collstats_latencyStats_transactions_ops{collection="testcol_01",database="testdb"} 0
7070
mongodb_collstats_latencyStats_transactions_ops{collection="testcol_02",database="testdb"} 0
71-
# HELP mongodb_collstats_storageStats_indexSizes collstats.storageStats.indexSizes.
71+
# HELP mongodb_collstats_storageStats_indexSizes collstats.storageStats.indexSizes
7272
# TYPE mongodb_collstats_storageStats_indexSizes untyped
7373
mongodb_collstats_storageStats_indexSizes{collection="testcol_00",database="testdb",index_name="_id_"} 4096
7474
mongodb_collstats_storageStats_indexSizes{collection="testcol_01",database="testdb",index_name="_id_"} 4096
7575
mongodb_collstats_storageStats_indexSizes{collection="testcol_02",database="testdb",index_name="_id_"} 4096
76-
# HELP mongodb_collstats_storageStats_capped collstats.storageStats.
76+
# HELP mongodb_collstats_storageStats_capped collstats.storageStats.capped
7777
# TYPE mongodb_collstats_storageStats_capped untyped
7878
mongodb_collstats_storageStats_capped{collection="testcol_00",database="testdb"} 0
7979
mongodb_collstats_storageStats_capped{collection="testcol_01",database="testdb"} 0

exporter/dbstats_collector_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ func TestDBStatsCollector(t *testing.T) {
6161
logger := logrus.New()
6262
c := newDBStatsCollector(ctx, client, logger, false, ti, []string{dbName}, false)
6363
expected := strings.NewReader(`
64-
# HELP mongodb_dbstats_collections dbstats.
64+
# HELP mongodb_dbstats_collections dbstats.collections
6565
# TYPE mongodb_dbstats_collections untyped
6666
mongodb_dbstats_collections{database="testdb"} 3
67-
# HELP mongodb_dbstats_indexes dbstats.
67+
# HELP mongodb_dbstats_indexes dbstats.indexes
6868
# TYPE mongodb_dbstats_indexes untyped
6969
mongodb_dbstats_indexes{database="testdb"} 3
70-
# HELP mongodb_dbstats_objects dbstats.
70+
# HELP mongodb_dbstats_objects dbstats.objects
7171
# TYPE mongodb_dbstats_objects untyped
7272
mongodb_dbstats_objects{database="testdb"} 30` + "\n")
7373

exporter/diagnostic_data_collector_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func TestDiagnosticDataCollector(t *testing.T) {
4444

4545
client := tu.DefaultTestClient(ctx, t)
4646
logger := logrus.New()
47+
logger.SetLevel(logrus.DebugLevel)
4748
ti := labelsGetterMock{}
4849

4950
dbBuildInfo, err := retrieveMongoDBBuildInfo(ctx, client, logger.WithField("component", "test"))
@@ -58,10 +59,10 @@ func TestDiagnosticDataCollector(t *testing.T) {
5859

5960
// The last \n at the end of this string is important
6061
expectedString := fmt.Sprintf(`
61-
# HELP mongodb_oplog_stats_wt_btree_fixed_record_size %s.btree.
62+
# HELP mongodb_oplog_stats_wt_btree_fixed_record_size %s.btree.fixed-record size
6263
# TYPE mongodb_oplog_stats_wt_btree_fixed_record_size untyped
6364
mongodb_oplog_stats_wt_btree_fixed_record_size 0
64-
# HELP mongodb_oplog_stats_wt_transaction_update_conflicts %s.transaction.
65+
# HELP mongodb_oplog_stats_wt_transaction_update_conflicts %s.transaction.update conflicts
6566
# TYPE mongodb_oplog_stats_wt_transaction_update_conflicts untyped
6667
mongodb_oplog_stats_wt_transaction_update_conflicts 0`, prefix, prefix)
6768
expected := strings.NewReader(expectedString + "\n")
@@ -211,6 +212,7 @@ func TestAllDiagnosticDataCollectorMetrics(t *testing.T) {
211212
client := tu.DefaultTestClient(ctx, t)
212213

213214
logger := logrus.New()
215+
logger.SetLevel(logrus.DebugLevel)
214216
ti := newTopologyInfo(ctx, client, logger)
215217

216218
dbBuildInfo, err := retrieveMongoDBBuildInfo(ctx, client, logger.WithField("component", "test"))

exporter/indexstats_collector_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func TestIndexStatsCollector(t *testing.T) {
6868

6969
// The last \n at the end of this string is important
7070
expected := strings.NewReader(`
71-
# HELP mongodb_indexstats_accesses_ops indexstats.accesses.
71+
# HELP mongodb_indexstats_accesses_ops indexstats.accesses.ops
7272
# TYPE mongodb_indexstats_accesses_ops untyped
7373
mongodb_indexstats_accesses_ops{collection="testcol_00",database="testdb",key_name="_id_"} 0
7474
mongodb_indexstats_accesses_ops{collection="testcol_00",database="testdb",key_name="idx_01"} 0
@@ -118,7 +118,7 @@ func TestDescendingIndexOverride(t *testing.T) {
118118

119119
// The last \n at the end of this string is important
120120
expected := strings.NewReader(`
121-
# HELP mongodb_indexstats_accesses_ops indexstats.accesses.
121+
# HELP mongodb_indexstats_accesses_ops indexstats.accesses.ops
122122
# TYPE mongodb_indexstats_accesses_ops untyped
123123
mongodb_indexstats_accesses_ops{collection="testcol_00",database="testdb",key_name="_id_"} 0
124124
mongodb_indexstats_accesses_ops{collection="testcol_00",database="testdb",key_name="f1_1"} 0

exporter/metrics.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ var (
154154
"storageStats.indexDetails.": "index_name",
155155
"config.image_collection.stats.storageStats.indexDetails.": "index_name",
156156
"config.transactions.stats.storageStats.indexDetails.": "index_name",
157-
"config.image_collection.stats.storageStats.indexSizes.": "index_name",
158157
"collstats.storageStats.indexDetails.": "index_name",
159158
}
160159

@@ -282,7 +281,7 @@ func rawToPrometheusMetric(rm *rawMetric) (prometheus.Metric, error) {
282281
// the help would be empty.
283282
func metricHelp(prefix, name string) string {
284283
if _, ok := nodeToPDMetrics[prefix]; ok {
285-
return prefix
284+
return strings.TrimSuffix(prefix, ".")
286285
}
287286
if prefix != "" {
288287
return prefix + name

exporter/profile_status_collector_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestProfileCollector(t *testing.T) {
5252
c := newProfileCollector(ctx, client, logrus.New(), false, ti, 30)
5353

5454
expected := strings.NewReader(`
55-
# HELP mongodb_profile_slow_query_count profile_slow_query.
55+
# HELP mongodb_profile_slow_query_count profile_slow_query.count
5656
# TYPE mongodb_profile_slow_query_count counter
5757
mongodb_profile_slow_query_count{database="admin"} 0
5858
mongodb_profile_slow_query_count{database="config"} 0

0 commit comments

Comments
 (0)