Metrics: store entity title on lazy-create (#30196)
This commit is contained in:
parent
0fa8b97daf
commit
a8361b575b
21 changed files with 209 additions and 142 deletions
16
cmd/setup.go
16
cmd/setup.go
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue