diff --git a/internal/observability/metrics/mem/mem.go b/internal/observability/metrics/mem/mem.go index 513e9eeced9..d817e1fe97b 100644 --- a/internal/observability/metrics/mem/mem.go +++ b/internal/observability/metrics/mem/mem.go @@ -1,16 +1,18 @@ +// // Copyright (C) 2019-2023 vdaas.org vald team // // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// https://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// package mem import ( @@ -603,7 +605,10 @@ func (mm *memMetrics) Register(m metrics.Meter) error { runtime.ReadMemStats(&mstats) for i, instrument := range instruments { - instrument.(asyncint64.Gauge).Observe(ctx, mInfo[i].Value()) + g, ok := instrument.(asyncint64.Gauge) + if ok { + g.Observe(ctx, mInfo[i].Value()) + } } }, )