Skip to content

Commit b9914e6

Browse files
committed
Increase counters on method calls
1 parent a6262aa commit b9914e6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

plugin/plugin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ func (p *CachePlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *g
6565
func (p *Plugin) GetPluginConfig(
6666
_ context.Context, _ *structpb.Struct,
6767
) (*structpb.Struct, error) {
68+
GetPluginConfigCounter.Inc()
6869
return structpb.NewStruct(PluginConfig)
6970
}
7071

7172
// OnTrafficFromClient is called when a request is received by GatewayD from the client.
7273
func (p *Plugin) OnTrafficFromClient(
7374
ctx context.Context, req *structpb.Struct,
7475
) (*structpb.Struct, error) {
76+
OnTrafficFromClientCounter.Inc()
7577
req, err := postgres.HandleClientMessage(req, p.Logger)
7678
if err != nil {
7779
p.Logger.Info("Failed to handle client message", "error", err)
@@ -147,6 +149,7 @@ func (p *Plugin) OnTrafficFromClient(
147149
func (p *Plugin) OnTrafficFromServer(
148150
ctx context.Context, resp *structpb.Struct,
149151
) (*structpb.Struct, error) {
152+
OnTrafficFromServerCounter.Inc()
150153
resp, err := postgres.HandleServerMessage(resp, p.Logger)
151154
if err != nil {
152155
p.Logger.Info("Failed to handle server message", "error", err)
@@ -221,6 +224,7 @@ func (p *Plugin) OnTrafficFromServer(
221224
}
222225

223226
func (p *Plugin) OnClosed(ctx context.Context, req *structpb.Struct) (*structpb.Struct, error) {
227+
OnClosedCounter.Inc()
224228
client := cast.ToStringMapString(sdkPlugin.GetAttr(req, "client", nil))
225229
if client != nil {
226230
if err := p.RedisClient.Del(ctx, client["remote"]).Err(); err != nil {

0 commit comments

Comments
 (0)