Skip to content

ENH: Add HttpClientRequest label ... typically for grouping / using with metrics collection and reporting #27

Closed
@rbygrave

Description

@rbygrave

Set a label on the request

    HttpResponse<String> res = clientContext.request()
      .label("client_hello_retry")  // <!-- HERE
      .path("hello/retry")
      .GET()
      .asString();

Have a RequestIntercept implementation that reads the label() and uses it for metrics collection

  static class MyIntercept implements RequestIntercept {
    
    @Override
    public void afterResponse(HttpResponse<?> response, HttpClientRequest request) {
     
      long responseTimeMicros = request.responseTimeMicros();
      String label = request.label();

     // use label and responseTimeMicros to collect metrics to the metrics library
    }
  }

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions