Skip to content

Commit

Permalink
getter for startTime
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatali committed Nov 19, 2019
1 parent 93bc749 commit fdbc7b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions runtime/server_http_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ func (req *ServerHTTPRequest) Context() context.Context {
return req.httpRequest.Context()
}

// StartTime returns the request's start time.
func (req *ServerHTTPRequest) StartTime() time.Time {
return req.startTime
}

// start the request, emit metrics etc
func (req *ServerHTTPRequest) start() {
if req.started {
Expand Down
1 change: 1 addition & 0 deletions runtime/server_http_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2323,6 +2323,7 @@ func TestSpanCreated(t *testing.T) {
req *zanzibar.ServerHTTPRequest,
res *zanzibar.ServerHTTPResponse,
) {
assert.NotEmpty(t, req.StartTime(), "startTime is not initialized")
span := req.GetSpan()
assert.NotNil(t, span)
res.WriteJSONBytes(200, nil, []byte(`{"ok":true}`))
Expand Down

0 comments on commit fdbc7b5

Please sign in to comment.