This commit is contained in:
matst80
2024-11-15 09:28:58 +01:00
parent 7795fc9c39
commit 00d65035d0
3 changed files with 9 additions and 32 deletions

View File

@@ -3,9 +3,6 @@ package main
import (
"fmt"
"strings"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
func (id CartId) String() string {
@@ -54,33 +51,6 @@ func NewRemoteGrain(id CartId, host string) (*RemoteGrain, error) {
}, nil
}
var (
remoteCartLatency = promauto.NewCounter(prometheus.CounterOpts{
Name: "cart_remote_grain_calls_total_latency",
Help: "The total latency of remote grains",
})
remoteCartCallsTotal = promauto.NewCounter(prometheus.CounterOpts{
Name: "cart_remote_grain_calls_total",
Help: "The total number of calls to remote grains",
})
)
// var start time.Time
// func MeasureLatency(fn func() (*CallResult, error)) (*CallResult, error) {
// start = time.Now()
// data, err := fn()
// if err != nil {
// return data, err
// }
// elapsed := time.Since(start).Milliseconds()
// go func() {
// remoteCartLatency.Add(float64(elapsed))
// remoteCartCallsTotal.Inc()
// }()
// return data, nil
// }
func (g *RemoteGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPayload, error) {
data, err := GetData(message.Write)