Skip to content
This repository was archived by the owner on Oct 8, 2022. It is now read-only.

Conversation

@GregoryAlbouy
Copy link
Member

@GregoryAlbouy GregoryAlbouy commented Jan 30, 2022

Description

Implement and add profiling features to the request benchmarks.

Instead of measuring the total duration only, we now have access to a timestamp for each step of an http request.
This will allow for more insightful data for the user.

Example

  • Local request (http)

    ./bin/benchttp -requests 1 -url "http://localhost:9999"
    
    Output
    [
      {
        "Cost": 0,
        "Code": 200,
        "Bytes": 0,
        "Error": null,
        "Profile": [
          {
            "Name": "GetConn",
            "Time": 70
          },
          {
            "Name": "DNSStart",
            "Time": 38155
          },
          {
            "Name": "DNSDone",
            "Time": 836820
          },
          {
            "Name": "ConnectStart",
            "Time": 866851
          },
          {
            "Name": "ConnectDone",
            "Time": 1072322
          },
          {
            "Name": "ConnectStart",
            "Time": 1125989
          },
          {
            "Name": "ConnectDone",
            "Time": 1257758
          },
          {
            "Name": "GotConn",
            "Time": 1290506
          },
          {
            "Name": "WroteHeaders",
            "Time": 1358900
          },
          {
            "Name": "WroteRequest",
            "Time": 1361062
          },
          {
            "Name": "GotFirstResponseByte",
            "Time": 1473155
          },
          {
            "Name": "PutIdleConn",
            "Time": 1528966
          }
        ]
      }
    ]
    
  • Remote request (https)

    ./bin/benchttp -requests 1 -url "https://example.com"
    
    Output
    [
      {
        "Cost": 0,
        "Code": 200,
        "Bytes": 1256,
        "Error": null,
        "Profile": [
          {
            "Name": "GetConn",
            "Time": 74
          },
          {
            "Name": "DNSStart",
            "Time": 42508
          },
          {
            "Name": "DNSDone",
            "Time": 10587412
          },
          {
            "Name": "ConnectStart",
            "Time": 10655260
          },
          {
            "Name": "ConnectDone",
            "Time": 89404642
          },
          {
            "Name": "TLSHandshakeStart",
            "Time": 89554213
          },
          {
            "Name": "TLSHandshakeDone",
            "Time": 414801212
          },
          {
            "Name": "GotConn",
            "Time": 415041317
          },
          {
            "Name": "WroteHeaders",
            "Time": 415092642
          },
          {
            "Name": "WroteRequest",
            "Time": 415092837
          },
          {
            "Name": "GotFirstResponseByte",
            "Time": 497572965
          }
        ]
      }
    ]
    

Changes

Notes

@GregoryAlbouy GregoryAlbouy marked this pull request as draft January 30, 2022 19:06
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@3d072c5). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #23   +/-   ##
=======================================
  Coverage        ?   82.12%           
=======================================
  Files           ?        6           
  Lines           ?      179           
  Branches        ?        0           
=======================================
  Hits            ?      147           
  Misses          ?       21           
  Partials        ?       11           
Flag Coverage Δ
unittests 82.12% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d072c5...5afcbe8. Read the comment docs.

- implement tracer for http client
- add request events to the records
@GregoryAlbouy GregoryAlbouy changed the title feat: implement request profiler feat: implement request tracer Jan 31, 2022
@GregoryAlbouy GregoryAlbouy marked this pull request as ready for review January 31, 2022 20:02
c1-ra
c1-ra previously approved these changes Feb 1, 2022
Copy link
Contributor

@c1-ra c1-ra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

moreirathomas
moreirathomas previously approved these changes Feb 1, 2022
Copy link
Member

@moreirathomas moreirathomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small misc nitpicks.
Otherwise good !

- typos
- casing
- Record.Error: add json:omitempty
Copy link
Contributor

@c1-ra c1-ra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@GregoryAlbouy GregoryAlbouy merged commit ae12d2b into main Feb 1, 2022
@moreirathomas moreirathomas deleted the feat/profile-request branch February 3, 2022 10:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants