Skip to content

Commit

Permalink
[Functions] Minor logging improvements (#10774)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolekk authored Sep 25, 2023
1 parent 4d63757 commit fe7ae1b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion core/services/gateway/handlers/functions/allowlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package functions

import (
"context"
"encoding/hex"
"fmt"
"math/big"
"sync"
Expand Down Expand Up @@ -177,7 +178,7 @@ func (a *onchainAllowlist) updateFromContractV1(ctx context.Context, blockNum *b
if err != nil {
return errors.Wrap(err, "unexpected error during functions_router.GetAllowListId")
}
a.lggr.Debugw("successfully fetched allowlist route ID", "id", tosID)
a.lggr.Debugw("successfully fetched allowlist route ID", "id", hex.EncodeToString(tosID[:]))
if tosID == [32]byte{} {
return errors.New("allowlist route ID has not been set")
}
Expand Down
6 changes: 6 additions & 0 deletions core/services/ocr2/plugins/functions/reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ var (
Help: "Metric to track number of reporting plugin Report calls",
}, []string{"jobID"})

promReportingPluginsReportNumObservations = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "functions_reporting_plugin_report_num_observations",
Help: "Metric to track number of observations available in the report phase",
}, []string{"jobID"})

promReportingAcceptReports = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "functions_reporting_plugin_accept",
Help: "Metric to track number of accepting reports",
Expand Down Expand Up @@ -265,6 +270,7 @@ func (r *functionsReporting) Report(ctx context.Context, ts types.ReportTimestam
"oracleID": r.genericConfig.OracleID,
"nObservations": len(obs),
})
promReportingPluginsReportNumObservations.WithLabelValues(r.jobID.String()).Set(float64(len(obs)))

queryProto := &encoding.Query{}
err := proto.Unmarshal(query, queryProto)
Expand Down
7 changes: 4 additions & 3 deletions core/services/ocr2/plugins/s4/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,10 @@ func (c *plugin) Report(_ context.Context, ts types.ReportTimestamp, _ types.Que

promReportingPluginsReportRowsCount.WithLabelValues(c.config.ProductName).Set(float64(len(reportRows)))
c.logger.Debug("S4StorageReporting Report", commontypes.LogFields{
"epoch": ts.Epoch,
"round": ts.Round,
"nReportRows": len(reportRows),
"epoch": ts.Epoch,
"round": ts.Round,
"nReportRows": len(reportRows),
"nObservations": len(aos),
})

return true, report, nil
Expand Down
4 changes: 2 additions & 2 deletions core/services/ocr2/plugins/threshold/decryption_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (dq *decryptionQueue) GetRequests(requestCountLimit int, totalBytesLimit in
pendingRequest, exists := dq.pendingRequests[string(ciphertextId)]

if !exists {
dq.lggr.Debugf("pending decryption request for ciphertextId %s expired", ciphertextId)
dq.lggr.Debugf("decryption request for ciphertextId %s already processed or expired", ciphertextId)
indicesToRemove[i] = struct{}{}
continue
}
Expand Down Expand Up @@ -232,7 +232,7 @@ func (dq *decryptionQueue) SetResult(ciphertextId decryptionPlugin.CiphertextId,

// Cache plaintext result in completedRequests map for cacheTimeoutMs to account for delayed Decrypt() calls
timer := time.AfterFunc(dq.completedRequestsCacheTimeout, func() {
dq.lggr.Debugf("expired decryption result for ciphertextId %s from completedRequests cache", ciphertextId)
dq.lggr.Debugf("removing completed decryption result for ciphertextId %s from cache", ciphertextId)
dq.mu.Lock()
delete(dq.completedRequests, string(ciphertextId))
dq.mu.Unlock()
Expand Down

0 comments on commit fe7ae1b

Please sign in to comment.