Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prometheus metrics #148

Merged
merged 21 commits into from Apr 29, 2020
Merged

Add prometheus metrics #148

merged 21 commits into from Apr 29, 2020

Commits on Mar 2, 2020

  1. Run gofmt

    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    f6f7931 View commit details
    Browse the repository at this point in the history
  2. Add integration test for prometheus metrics

    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Co-authored-by: Sebastian <sebastian.schmieschek@digital.cabinet-office.gov.uk>
    Toby Lorne and schmie committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    fdae529 View commit details
    Browse the repository at this point in the history
  3. Add default prometheus metrics to router

    When making a request to the API with the path /metrics
    default prometheus exposition format metrics will be returned
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Co-authored-by: Sebastian <sebastian.schmieschek@digital.cabinet-office.gov.uk>
    Toby Lorne and schmie committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    2ad68f4 View commit details
    Browse the repository at this point in the history
  4. Add high level router metrics

    We add metrics for:
    
    - internal server errors
    - routing table reload attempts
    - routing table reload errors
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Co-authored-by: Sebastian <sebastian.schmieschek@digital.cabinet-office.gov.uk>
    Toby Lorne and schmie committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    dff3eaa View commit details
    Browse the repository at this point in the history
  5. Add metric for redirect handler redirect count

    so we can observe how many redirects have been handled
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Co-authored-by: Sebastian <sebastian.schmieschek@digital.cabinet-office.gov.uk>
    Toby Lorne and schmie committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    cb56d93 View commit details
    Browse the repository at this point in the history
  6. Add metric for currently count of loaded routes

    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Co-authored-by: Sebastian <sebastian.schmieschek@digital.cabinet-office.gov.uk>
    Toby Lorne and schmie committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    af5a21e View commit details
    Browse the repository at this point in the history
  7. Add metric for triemux lookup not found

    When we are given a request for which there is no entry in the trie we
    should increment a counter, so that we can track unknown entries
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Co-authored-by: Sebastian <sebastian.schmieschek@digital.cabinet-office.gov.uk>
    Co-authored-by: Chris <chris.banks@digital.cabinet-office.gov.uk>
    3 people committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    4bea3bd View commit details
    Browse the repository at this point in the history
  8. Add backend handler metric req count / resp secs

    We want to measure:
    * the number of requests
    * the duration of responses
    
    We measure the backend handlers individually, so the metrics are defined
    as prometheus vectors
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    32e5de0 View commit details
    Browse the repository at this point in the history
  9. Keep track of backend ID within backend transport

    In order for us to instrument each backend handler separately, the
    backendTransport (which is the handler) needs to know who it is, or at
    least how it should record its performance
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    5ad3181 View commit details
    Browse the repository at this point in the history
  10. Instrument backend handler req count / resp secs

    Every time the backend handler sees a request, it should increment the
    request count counter
    
    Every time the backend handler responds with a status code, we should
    record the duration of that request
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    ee1b938 View commit details
    Browse the repository at this point in the history
  11. Instrument backend handler response count

    Every time the backend handler responds with a status code, we should
    count that response
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    b443d3d View commit details
    Browse the repository at this point in the history
  12. Use a real histogram for backend handler resp secs

    Instead of implementing our own way of measuring latency and count, we
    can use a real histogram instead
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    b563e9a View commit details
    Browse the repository at this point in the history
  13. Run go mod tidy

    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    91feca2 View commit details
    Browse the repository at this point in the history
  14. Run go mod vendor

    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    eb014f6 View commit details
    Browse the repository at this point in the history
  15. Add a make task to pretty print metric names

    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Toby Lorne committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    0c29314 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2020

  1. Make metrics pass promtool

    ```
    make run
    ---
    curl http://localhost:8081/metrics | promtool check metrics
    echo $?
    => 0
    ```
    
    Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
    Co-authored-by: Philip <philip.potter@digital.cabinet-office.gov.uk>
    Toby Lorne and philandstuff committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    6b1e0e8 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2020

  1. Add comment clarifying use of stripQuery

    because of how http.Redirect works (does not necessarily take a url.URL
    but rather a string), we stripQuery using a string not a URL
    
    we do not need to catch this error because the provenance of the URL
    argument to stripquery is from a url.URL. However future contributors
    should be aware of this nuance
    
    Signed-off-by: toby lorne <toby@toby.codes>
    tlwr committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    b8f84f0 View commit details
    Browse the repository at this point in the history
  2. Use pkg http status codes in handlers

    We should use the descriptive names of the status codes, instead of the
    number
    
    This also capitalises the response body of 410 Gone because consistency
    
    Signed-off-by: toby lorne <toby@toby.codes>
    tlwr committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    c866a6b View commit details
    Browse the repository at this point in the history
  3. Move the reload route count metric inside the defer

    and add a clarifying comment to demonstrate that the metric should
    always get incremented
    
    Signed-off-by: toby lorne <toby@toby.codes>
    tlwr committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    4e1bad2 View commit details
    Browse the repository at this point in the history
  4. Add make task for checking metrics using promtool

    Signed-off-by: toby lorne <toby@toby.codes>
    tlwr committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    de41b23 View commit details
    Browse the repository at this point in the history
  5. Add metric information in README

    Signed-off-by: toby lorne <toby@toby.codes>
    tlwr committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    84aeed9 View commit details
    Browse the repository at this point in the history