Skip to content

Commit

Permalink
Merge pull request #141 from LNOpenMetrics/macros/update_cache
Browse files Browse the repository at this point in the history
meta: remove some logs and prepare the last rc3
  • Loading branch information
vincenzopalazzo committed May 16, 2023
2 parents c149c77 + 71f6d9f commit b0c28e6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
14 changes: 8 additions & 6 deletions internal/metrics/metrics_one.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,19 +776,21 @@ func (instance *RawLocalScore) getChannelInfo(lightning cln4go.Client,
paymentInfo.Direction = ChannelDirections[1]
}

// FIXME: make a double check on how to find a direction of a payment.
//
/// if the direction is valid and if the direction
// is different from the channel direction we skip this
// forwarding from the counting
if channelInfo.Direction != "UNKNOWN" &&
paymentInfo.Direction != channelInfo.Direction {
log.GetInstance().Infof("New forwarding found but in the wrong direction, %s -> %s", forward.InChannel, forward.OutChannel)
log.GetInstance().Infof("Information on the our channel Channel id %s with %s", *channel.ShortChannelId, channelInfo.Alias)
log.GetInstance().Infof("Channel direction calculated %s", channelInfo.Direction)
//log.GetInstance().Infof("New forwarding found but in the wrong direction, %s -> %s", forward.InChannel, forward.OutChannel)
//log.GetInstance().Infof("Information on the our channel Channel id %s with %s", *channel.ShortChannelId, channelInfo.Alias)
//log.GetInstance().Infof("Channel direction calculated %s", channelInfo.Direction)
continue
}
log.GetInstance().Infof("New forwarding found but in the correct direction, %s -> %s", forward.InChannel, forward.OutChannel)
log.GetInstance().Infof("Information on the our channel Channel id %s with %s", *channel.ShortChannelId, channelInfo.Alias)
log.GetInstance().Infof("Channel direction calculated %s", channelInfo.Direction)
//log.GetInstance().Infof("New forwarding found but in the correct direction, %s -> %s", forward.InChannel, forward.OutChannel)
//log.GetInstance().Infof("Information on the our channel Channel id %s with %s", *channel.ShortChannelId, channelInfo.Alias)
//log.GetInstance().Infof("Channel direction calculated %s", channelInfo.Direction)

channelInfo.Forwards = append(channelInfo.Forwards, paymentInfo)

Expand Down
2 changes: 1 addition & 1 deletion internal/plugin/cln4go_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (self *LNMetricsInfoRPC[T]) Call(plugin *cln4go.Plugin[T], payload map[stri
goInfo := sysinfo.Go()
resp := info{
Name: "go-lnmetrics.reporter",
Version: "v0.0.5-rc2",
Version: "v0.0.6-rc3",
LangVersion: goInfo.Version,
Architecture: goInfo.Arch,
MaxProcs: goInfo.MaxProcs,
Expand Down
6 changes: 4 additions & 2 deletions internal/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ func (plugin *MetricsPlugin) updateAndUploadMetric(metric metrics.Metric) {
log.GetInstance().Info("Calling update and upload metric")
plugin.callUpdateOnMetricNoMsg(metric)
if err := metric.UploadOnRepo(plugin.Server, plugin.GetRpc()); err != nil {
log.GetInstance().Error(fmt.Sprintf("Error %s", err))
log.GetInstance().Errorf("Error %s", err)
}
log.GetInstance().Info("Metrics shipped!")
}

// RegisterRecurrentEvt Register internal recurrent methods
Expand All @@ -123,7 +124,8 @@ func (plugin *MetricsPlugin) RegisterRecurrentEvt(after string) {
_, err := plugin.Cron.AddFunc(after, func() {
log.GetInstance().Info("Update and Uploading metrics")
for _, metric := range plugin.Metrics {
go plugin.updateAndUploadMetric(metric)
// FIXME: we can do this in parallel, but not now :)
plugin.updateAndUploadMetric(metric)
}
})
if err != nil {
Expand Down

0 comments on commit b0c28e6

Please sign in to comment.