Skip to content

Commit

Permalink
fix(server): fix db dataSize monitor (#1955)
Browse files Browse the repository at this point in the history
  • Loading branch information
0fatal committed May 28, 2024
1 parent 7ba5e2d commit bf304e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/src/database/monitor/monitor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class DedicatedDatabaseMonitorService {
)
const dataSize = await this.query(
region,
`sum(mongodb_dbstats_dataSize{pod=~"${dbName}-mongo.+"}) by (database)`,
`sum(mongodb_dbstats_dataSize{pod=~"${dbName}-mongo.+",rs_state="1"}) by (database)`,
{
labels: ['database'],
},
Expand Down
2 changes: 1 addition & 1 deletion server/src/monitor/monitor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const getQuery =
case MonitorMetric.databaseUsage:
return {
instant: true,
query: `sum(mongodb_dbstats_dataSize{database="${opts.appid}"})`,
query: `sum(mongodb_dbstats_dataSize{database="${opts.appid}",rs_state="1"})`,
}
case MonitorMetric.storageUsage:
return {
Expand Down

0 comments on commit bf304e4

Please sign in to comment.