Skip to content

Commit

Permalink
📈 Add completed_create_index_total metric
Browse files Browse the repository at this point in the history
Signed-off-by: Rintaro Okamura <[email protected]>
  • Loading branch information
rinx committed May 20, 2020
1 parent ee45ba7 commit 73da3c2
Showing 1 changed file with 39 additions and 12 deletions.
51 changes: 39 additions & 12 deletions internal/observability/metrics/agent/ngt/ngt.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,42 @@ import (
)

type ngtMetrics struct {
ngt service.NGT
indexCount metrics.Int64Measure
uncommittedIndexCount metrics.Int64Measure
insertVCacheCount metrics.Int64Measure
deleteVCacheCount metrics.Int64Measure
isIndexing metrics.Int64Measure
ngt service.NGT
indexCount metrics.Int64Measure
uncommittedIndexCount metrics.Int64Measure
insertVCacheCount metrics.Int64Measure
deleteVCacheCount metrics.Int64Measure
completedCreateIndexTotal metrics.Int64Measure
isIndexing metrics.Int64Measure
}

func New(n service.NGT) metrics.Metric {
return &ngtMetrics{
ngt: n,
indexCount: *metrics.Int64(metrics.ValdOrg+"/ngt/index_count", "NGT index count", metrics.UnitDimensionless),
uncommittedIndexCount: *metrics.Int64(metrics.ValdOrg+"/ngt/uncommitted_index_count", "NGT uncommitted index count", metrics.UnitDimensionless),
insertVCacheCount: *metrics.Int64(metrics.ValdOrg+"/ngt/insert_vcache_count", "NGT insert vcache count", metrics.UnitDimensionless),
deleteVCacheCount: *metrics.Int64(metrics.ValdOrg+"/ngt/delete_vcache_count", "NGT delete vcache count", metrics.UnitDimensionless),
isIndexing: *metrics.Int64(metrics.ValdOrg+"/ngt/is_indexing", "currently indexing or not", metrics.UnitDimensionless),
ngt: n,
indexCount: *metrics.Int64(
metrics.ValdOrg+"/ngt/index_count",
"NGT index count",
metrics.UnitDimensionless),
uncommittedIndexCount: *metrics.Int64(
metrics.ValdOrg+"/ngt/uncommitted_index_count",
"NGT uncommitted index count",
metrics.UnitDimensionless),
insertVCacheCount: *metrics.Int64(
metrics.ValdOrg+"/ngt/insert_vcache_count",
"NGT insert vcache count",
metrics.UnitDimensionless),
deleteVCacheCount: *metrics.Int64(
metrics.ValdOrg+"/ngt/delete_vcache_count",
"NGT delete vcache count",
metrics.UnitDimensionless),
completedCreateIndexTotal: *metrics.Int64(
metrics.ValdOrg+"/ngt/completed_create_index_total",
"the cumulative count of completed create index execution",
metrics.UnitDimensionless),
isIndexing: *metrics.Int64(
metrics.ValdOrg+"/ngt/is_indexing",
"currently indexing or not",
metrics.UnitDimensionless),
}
}

Expand All @@ -55,6 +75,7 @@ func (n *ngtMetrics) Measurement(ctx context.Context) ([]metrics.Measurement, er
n.uncommittedIndexCount.M(int64(n.ngt.InsertVCacheLen() + n.ngt.DeleteVCacheLen())),
n.insertVCacheCount.M(int64(n.ngt.InsertVCacheLen())),
n.deleteVCacheCount.M(int64(n.ngt.DeleteVCacheLen())),
n.completedCreateIndexTotal.M(int64(n.ngt.NumberOfCreateIndexExecution())),
n.isIndexing.M(isIndexing),
}, nil
}
Expand Down Expand Up @@ -89,6 +110,12 @@ func (n *ngtMetrics) View() []*metrics.View {
Measure: &n.deleteVCacheCount,
Aggregation: metrics.LastValue(),
},
&metrics.View{
Name: "ngt_completed_create_index_total",
Description: "the cumulative count of completed create index execution",
Measure: &n.completedCreateIndexTotal,
Aggregation: metrics.LastValue(),
},
&metrics.View{
Name: "ngt_is_indexing",
Description: "currently indexing or not",
Expand Down

0 comments on commit 73da3c2

Please sign in to comment.