Skip to content

Commit 9a581d9

Browse files
committed
fix: resolve compilation errors in metrics collector
- Use version.GetVersion() instead of undefined c.engProps.Version - Convert models.StatusCode to string for WithLabelValues calls
1 parent e7ff913 commit 9a581d9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

engine/internal/srv/metrics/collector.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"gitlab.com/postgres-ai/database-lab/v3/pkg/config/global"
2222
"gitlab.com/postgres-ai/database-lab/v3/pkg/log"
2323
"gitlab.com/postgres-ai/database-lab/v3/pkg/models"
24+
"gitlab.com/postgres-ai/database-lab/v3/version"
2425
)
2526

2627
// containerCPUState stores previous CPU stats for delta calculation.
@@ -82,14 +83,13 @@ func (c *Collector) Collect(ctx context.Context) {
8283
func (c *Collector) collectInstanceMetrics() {
8384
c.metrics.InstanceInfo.WithLabelValues(
8485
c.engProps.InstanceID,
85-
c.engProps.Version,
86+
version.GetVersion(),
8687
c.engProps.GetEdition(),
8788
).Set(1)
8889

8990
c.metrics.InstanceUptime.Set(time.Since(c.startedAt).Seconds())
9091

91-
statusCode := models.StatusOK
92-
c.metrics.InstanceStatus.WithLabelValues(statusCode).Set(1)
92+
c.metrics.InstanceStatus.WithLabelValues(string(models.StatusOK)).Set(1)
9393

9494
c.metrics.RetrievalStatus.WithLabelValues(
9595
string(c.retrieval.State.Mode),
@@ -181,7 +181,7 @@ func (c *Collector) collectCloneMetrics(ctx context.Context) {
181181
clone.Branch,
182182
snapshotID,
183183
poolName,
184-
clone.Status.Code,
184+
string(clone.Status.Code),
185185
protectedStr,
186186
).Set(1)
187187

0 commit comments

Comments
 (0)