HttpClient log

Edit
Update time: 2024-09-18

HttpClient Log Format

After integrating tracer-httpclient-plugin, SOFATracer outputs the link data requested by HttpClient in JSON data by default.

HttpClient digest log (httpclient-digest.log)

The data is output in JSON format. Each key meaning is as follows:

Key Meaning
Time log printing time
Local.app Current application name
traceId TraceId
spanId SpanId
Request.url Request URL
Method Request HTTP method
Result.code HTTP call returns status code
req.size.bytes Request body size
resp.size.bytes Response body size
Time.cost.milliseconds Request time (ms)
Current.thread.name Thread name
Remote.app Name of the called application
Baggage Transparently transmitted baggage data

Example:

{"time":"2018-09-27 21:58:43.067","local.app":"HttpClientDemo","traceId":"0a0fe8801538056723034100235072","spanId":"0","request.url":"http://localhost:8080/httpclient","method":"GET","result.code":"200","req.size.bytes":0,"resp.size.bytes":-1,"time.cost.milliseconds":33,"current.thread.name":"I/O dispatcher 1","remote.app":"","baggage":""}

Note: The application name can be passed in as a parameter when constructing an HttpClient instance via SofaTracerHttpClientBuilder.

HttpClient statistical Log (httpclient-stat.log)

stat.key is the collection of statistical keywords in this period, which uniquely determines a set of statistical data, including local.app, request.url, and method field.

Key Meaning
time Log printing time
stat.key local.app Current application name
request.url Request URL
method Request HTTP method
count Number of requests in this period
total.cost.milliseconds Total duration (ms) for requests in this period
success Request result: Y means success (the result code starting with 1 and 2 indicates success, and 302 indicates that the redirection is successful, and others indicate failure); N indicates failure
load.test Pressure test mark: T indicates pressure test; F indicates non-pressure test

Example:

{"time":"2018-09-27 21:59:42.233","stat.key":{"request.url":"http://localhost:8080/httpclient","local.app":"HttpClientDemo","method":"GET"},"count":2,"total.cost.milliseconds":562,"success":"true","load.test":"F"}