From ec63e1c5cb6e11c2fe9d9b8a6e48debe7f3509da Mon Sep 17 00:00:00 2001
From: Levente Pap <levente.pap@iota.org>
Date: Wed, 15 Jul 2020 16:09:14 +0200
Subject: [PATCH] Add messageCount and solidMessageCOunt to /info webapi
 endpoint

---
 plugins/webapi/info/plugin.go | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/plugins/webapi/info/plugin.go b/plugins/webapi/info/plugin.go
index a64f121b..264db20a 100644
--- a/plugins/webapi/info/plugin.go
+++ b/plugins/webapi/info/plugin.go
@@ -7,6 +7,7 @@ import (
 
 	"github.com/iotaledger/goshimmer/plugins/autopeering/local"
 	"github.com/iotaledger/goshimmer/plugins/banner"
+	"github.com/iotaledger/goshimmer/plugins/metrics"
 	"github.com/iotaledger/goshimmer/plugins/sync"
 	"github.com/iotaledger/goshimmer/plugins/webapi"
 	"github.com/iotaledger/hive.go/node"
@@ -84,12 +85,15 @@ func getInfo(c echo.Context) error {
 	sort.Strings(disabledPlugins)
 
 	return c.JSON(http.StatusOK, Response{
-		Version:         banner.AppVersion,
-		Synced:          sync.Synced(),
-		IdentityID:      local.GetInstance().Identity.ID().String(),
-		PublicKey:       local.GetInstance().PublicKey().String(),
-		EnabledPlugins:  enabledPlugins,
-		DisabledPlugins: disabledPlugins,
+		Version:           banner.AppVersion,
+		Synced:            sync.Synced(),
+		IdentityID:        local.GetInstance().Identity.ID().String(),
+		PublicKey:         local.GetInstance().PublicKey().String(),
+		RequestQueueSize:  int(metrics.MessageRequestQueueSize()),
+		SolidMessageCount: int(metrics.MessageSolidCountIter()),
+		TotalMessageCount: int(metrics.MessageTotalCountDBIter()),
+		EnabledPlugins:    enabledPlugins,
+		DisabledPlugins:   disabledPlugins,
 	})
 }
 
@@ -103,6 +107,12 @@ type Response struct {
 	IdentityID string `json:"identityID,omitempty"`
 	// public key of the node encoded in base58
 	PublicKey string `json:"publicKey,omitempty"`
+	// RequestQueueSize is the number of messages a node is trying to request from neighbors.
+	RequestQueueSize int `json:"requestQueueSize,omitempty"`
+	// SolidMessageCount is the number of solid messages in the node's database.
+	SolidMessageCount int `json:"solidMessageCount,omitempty"`
+	// TotalMessageCount is the number of messages in the node's database.
+	TotalMessageCount int `json:"totalMessageCount,omitempty"`
 	// list of enabled plugins
 	EnabledPlugins []string `json:"enabledPlugins,omitempty"`
 	// list if disabled plugins
-- 
GitLab