Skip to content

Commit

Permalink
Add StatusCode to Sent EventInfo
Browse files Browse the repository at this point in the history
Signed-off-by: Pierangelo Di Pilato <[email protected]>
  • Loading branch information
pierDipi committed Jun 14, 2024
1 parent 199a526 commit cb22810
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/eventshub/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func Start(ctx context.Context, logs *eventshub.EventLogs, clientOpts ...eventsh
span.End()

// Publish sent event info
if err := logs.Vent(env.sentInfo(event, req, err)); err != nil {
if err := logs.Vent(env.sentInfo(event, req, res, err)); err != nil {
return fmt.Errorf("cannot forward event info: %w", err)
}

Expand Down Expand Up @@ -303,7 +303,7 @@ func (g *generator) peerCertificatesReceived(counter uint64, state tls.Connectio
}
}

func (g *generator) sentInfo(event *cloudevents.Event, req *nethttp.Request, err error) eventshub.EventInfo {
func (g *generator) sentInfo(event *cloudevents.Event, req *nethttp.Request, res *nethttp.Response, err error) eventshub.EventInfo {
var eventId string
if event != nil {
eventId = event.ID()
Expand All @@ -330,6 +330,9 @@ func (g *generator) sentInfo(event *cloudevents.Event, req *nethttp.Request, err
Sequence: uint64(g.sequence),
SentId: eventId,
}
if res != nil {
sentEventInfo.StatusCode = res.StatusCode
}

sentHeaders := make(nethttp.Header)
for k, v := range req.Header {
Expand Down

0 comments on commit cb22810

Please sign in to comment.