Skip to content
This repository has been archived by the owner on Aug 17, 2020. It is now read-only.

TTFB swapped with overall request Elapsed Time #89

Merged
merged 3 commits into from
Jan 5, 2017

Conversation

zeph
Copy link
Member

@zeph zeph commented Dec 12, 2016

the overall elapsed time shall be associated to the 4th int64 time measurement as by this structure

type RequestResult struct {
	Time             int64  `json:"time"`
	Host             string `json:"host"`
	Type             string `json:"type"`
	Status           int    `json:"status"`
	ElapsedFirstByte int64  `json:"elapsed-first-byte"`
	ElapsedLastByte  int64  `json:"elapsed-last-byte"`
	Elapsed          int64  `json:"elapsed"`
	Bytes            int    `json:"bytes"`
	Timeout          bool   `json:"timeout"`
	ConnectionError  bool   `json:"connection-error"`
	State            string `json:"state"`
}

@zeph zeph changed the title this, according to main(lambda.go).RequestResult fields order, is pre… TTFB swapped with overall request Elapsed Time Dec 12, 2016
@jcxplorer
Copy link
Member

Whoops, I guess we should use named fields to prevent these bugs. Would you like to add those before I merge? 🙂

@zeph
Copy link
Member Author

zeph commented Dec 22, 2016

@jcxplorer I don't know named fields yet, these hacks are my learning by writing golang experience ;) ...I'll have a look at them if you think they are the best way to implement them

@jcxplorer
Copy link
Member

What I meant is that you can use the field names explicitly, like so:

result := RequestResult{
    Time: start.Sub(loadTestStartTime).Nanoseconds(),
    Host: req.URL.Host,
    Type: req.Method,

That way the order doesn't matter, which would have prevented this bug 🙂

@zeph
Copy link
Member Author

zeph commented Jan 5, 2017

@jcxplorer done, please have a look

@jcxplorer
Copy link
Member

Brilliant, thanks for this!

@jcxplorer jcxplorer merged commit abf1234 into goadapp:master Jan 5, 2017
@zeph zeph deleted the elapsed_wrong branch January 6, 2017 21:09
@zeph
Copy link
Member Author

zeph commented Jan 6, 2017

@jcxplorer you are welcome

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants