openzipkin / zipkin-browser-extension

Chrome and Firefox browser extensions for Zipkin
Apache License 2.0
25 stars 13 forks source link

client-side annotations #6

Open codefromthecrypt opened 8 years ago

codefromthecrypt commented 8 years ago

We're currently tagging outbound requests with a trace/span id. I wonder if we can configure a zipkin url and post json of the client-side of the trace?

eirslett commented 8 years ago

I'm not sure I understand what you mean...?

codefromthecrypt commented 8 years ago

In the current code, before we send a request, we add the trace id, like X-B3-TraceId: 9d30188d40a191d3. Let's say we started a stopwatch at the same time. If we added a hook after receiving the response, we could post the following to zipkin /api/v1/spans

[
{
  "traceId": "9d30188d40a191d3",
  "name": "get",
  "id": "9d30188d40a191d3",
  "timestamp": START_MICROS,
  "duration": END_MICROS-START_MICROS,
  "annotations": [
    {
      "endpoint": {
        "serviceName": "zipkin-chrome-extension",
        "ipv4": "MY_IP"
      },
      "timestamp": START_MICROS,
      "value": "cs"
    },
    {
      "endpoint": {
        "serviceName": "zipkin-chrome-extension",
        "ipv4": "MY_IP"
      },
      "timestamp": END_MICROS,
      "value": "cr"
    }
  ]
}
]

Obviously, we could batch up spans and post them at the same time, etc.