Metrics: store entity title on lazy-create (#30196)

This commit is contained in:
andig 2026-06-07 13:11:20 +02:00 • committed by GitHub
parent 0fa8b97daf
commit a8361b575b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 209 additions and 142 deletions

View file

@ -1305,12 +1305,24 @@ func configureSite(conf map[string]any, loadpoints []*core.Loadpoint, tariffs *t
func newLoadpoint(idx int, name string, other map[string]any, settingsFn func(*util.Logger) coresettings.Settings) (*core.Loadpoint, error) {
log := util.NewLoggerWithLoadpoint("lp-"+strconv.Itoa(idx), idx)
collector, err := metrics.NewCollector(metrics.Loadpoint, name)
collector, err := metrics.NewCollector(metrics.Loadpoint, name, "")
if err != nil {
return nil, err
}
return core.NewLoadpointFromConfig(log, settingsFn(log), collector, other)
lp, err := core.NewLoadpointFromConfig(log, settingsFn(log), collector, other)
if err != nil {
return lp, err
}
// lazily update entity title
if title := lp.GetTitle(); title != "" {
if err := collector.UpdateTitle(title); err != nil {
return lp, err
}
}
return lp, nil
}
func configureLoadpoints(conf globalconfig.All) error {