openzipkin / zipkin-reporter-java

Shared library for reporting zipkin spans on transports such as http or kafka
Apache License 2.0
126 stars 70 forks source link

Create a better default for queuedMaxSpans #266

Open codefromthecrypt opened 7 months ago

codefromthecrypt commented 7 months ago

Feature

Let's make queuedMaxSpans a function of messageMaxBytes, instead of an arbitrary default.

Rationale

This will better manage the queue backlog, allowing people to use a higher messageTimeout than 1s, but still clear the queue faster when under pressure.

Example Scenario

A small json span will reach the default 500,000 byte limit by about 1500 spans. A typical one will reach much sooner (typical e.g. sleuth/micrometer which adds more than one tag, and possibly a remote endpoint).

$ echo '{
  "traceId": "4d1e00c0db9010db86154a4ba6e91385",
  "parentId": "86154a4ba6e91385",
  "id": "4d1e00c0db9010db",
  "kind": "CLIENT",
  "name": "get",
  "timestamp": 1472470996199000,
  "duration": 207000,
  "localEndpoint": {
    "serviceName": "frontend",
    "ipv6": "1.2.3.4"
  },
  "tags": {
    "http.path": "/api",
  }
}' |wc -c
     327
$ bc -e '500000/327'
1529

Prior Art