Skip to content

Commit

Permalink
Add trace for ql methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ChirathB14 committed Sep 2, 2023
1 parent 39a7e91 commit 705adeb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions peer/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (t *BridgeService) Ql(ctx context.Context, argType ql.BridgeArgs, replyType
log.InfofWithContext(ctx, "Received a Ql call, method: %s", call.Method)
switch call.Method {
case "saveEvent":
ctx, span := s.tracer.Start(ctx, "ql.method.saveEvent")
defer span.End()
var d nostr.Event
err := json.Unmarshal(call.Body, &d)
if err != nil {
Expand All @@ -42,6 +44,8 @@ func (t *BridgeService) Ql(ctx context.Context, argType ql.BridgeArgs, replyType
log.InfofWithContext(ctx, "Received a saveEvent call, event: %s", d.ID)
return t.relay.Storage().SaveEvent(&d)
case "queryEvents":
ctx, span := s.tracer.Start(ctx, "ql.method.queryEvents")
defer span.End()
var d nostr.Filter
err := json.Unmarshal(call.Body, &d)
if err != nil {
Expand All @@ -60,6 +64,8 @@ func (t *BridgeService) Ql(ctx context.Context, argType ql.BridgeArgs, replyType
log.InfofWithContext(ctx, "Sending a queryEvents reply")
return nil
case "deleteEvent":
ctx, span := s.tracer.Start(ctx, "ql.method.deleteEvent")
defer span.End()
var d nostr.Event
err := json.Unmarshal(call.Body, &d)
if err != nil {
Expand Down

0 comments on commit 705adeb

Please sign in to comment.