Convert atomic Int64 to native type when logging value (#9938)

The atomic Int64 type wasn't able to be represented when logging
via go-kit log and ended up as `"unsupported value type"`.

Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
This commit is contained in:
Nick Pillitteri 2021-12-06 16:25:22 -05:00 committed by GitHub
parent 3563db20e0
commit 084bd70708
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -686,17 +686,18 @@ func (h *Head) ApplyConfig(cfg *config.Config) error {
} }
// Head uses opts.MaxExemplars in combination with opts.EnableExemplarStorage // Head uses opts.MaxExemplars in combination with opts.EnableExemplarStorage
// to decide if it should pass exemplars along to it's exemplar storage, so we // to decide if it should pass exemplars along to its exemplar storage, so we
// need to update opts.MaxExemplars here. // need to update opts.MaxExemplars here.
prevSize := h.opts.MaxExemplars.Load() prevSize := h.opts.MaxExemplars.Load()
h.opts.MaxExemplars.Store(cfg.StorageConfig.ExemplarsConfig.MaxExemplars) h.opts.MaxExemplars.Store(cfg.StorageConfig.ExemplarsConfig.MaxExemplars)
newSize := h.opts.MaxExemplars.Load()
if prevSize == h.opts.MaxExemplars.Load() { if prevSize == newSize {
return nil return nil
} }
migrated := h.exemplars.(*CircularExemplarStorage).Resize(h.opts.MaxExemplars.Load()) migrated := h.exemplars.(*CircularExemplarStorage).Resize(newSize)
level.Info(h.logger).Log("msg", "Exemplar storage resized", "from", prevSize, "to", h.opts.MaxExemplars, "migrated", migrated) level.Info(h.logger).Log("msg", "Exemplar storage resized", "from", prevSize, "to", newSize, "migrated", migrated)
return nil return nil
} }