Skip to content

Commit

Permalink
maint: add debug telemetry (#136)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?

- As an effort to fix #114, add some useful debug fields

## Short description of the changes
- Add telemetry for raw request / response timestamp
- Add telemetry for request ID

## How to verify that this has the expected result
<img width="1010" alt="Screenshot 2023-08-30 at 1 30 12 PM"
src="https://github.com/honeycombio/honeycomb-ebpf-agent/assets/8810222/e29446f2-a5c7-44e6-a851-1e6b2ca75258">

---------

Co-authored-by: Robb Kidd <[email protected]>
  • Loading branch information
pkanal and robbkidd authored Aug 30, 2023
1 parent 770937b commit 129317e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
15 changes: 8 additions & 7 deletions assemblers/http_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
)

type HttpEvent struct {
RequestId string
Request *http.Request
Response *http.Response
Timestamp time.Time
Duration time.Duration
SrcIp string
DstIp string
RequestId string
Request *http.Request
Response *http.Response
RequestTimestamp time.Time
ResponseTimestamp time.Time
Duration time.Duration
SrcIp string
DstIp string
}
15 changes: 8 additions & 7 deletions assemblers/http_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ func (h *httpReader) processEvent(ident string, entry *entry) {
}

h.parent.events <- HttpEvent{
RequestId: ident,
Request: entry.request,
Response: entry.response,
Timestamp: entry.requestTimestamp,
Duration: eventDuration,
SrcIp: h.srcIp,
DstIp: h.dstIp,
RequestId: ident,
Request: entry.request,
Response: entry.response,
RequestTimestamp: entry.requestTimestamp,
ResponseTimestamp: entry.responseTimestamp,
Duration: eventDuration,
SrcIp: h.srcIp,
DstIp: h.dstIp,
}
}
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,16 @@ func sendHttpEventToHoneycomb(event assemblers.HttpEvent, k8sClient *utils.Cache
ev := libhoney.NewEvent()

// common attributes
ev.Timestamp = event.Timestamp
ev.Timestamp = event.RequestTimestamp
ev.AddField("httpEvent_handled_at", time.Now())
ev.AddField("httpEvent_handled_latency_ms", time.Now().Sub(event.Timestamp).Milliseconds())
ev.AddField("meta.httpEvent_request_handled_latency_ms", time.Now().Sub(event.RequestTimestamp).Milliseconds())
ev.AddField("meta.httpEvent_response_handled_latency_ms", time.Now().Sub(event.ResponseTimestamp).Milliseconds())
ev.AddField("goroutine_count", runtime.NumGoroutine())
ev.AddField("duration_ms", event.Duration.Milliseconds())
ev.AddField("http.request.timestamp", event.RequestTimestamp)
ev.AddField("http.response.timestamp", event.ResponseTimestamp)
ev.AddField("http.request.id", event.RequestId)

ev.AddField(string(semconv.NetSockHostAddrKey), event.SrcIp)
ev.AddField("destination.address", event.DstIp)

Expand Down

0 comments on commit 129317e

Please sign in to comment.