nervous-systems / eulalie

Asynchronous AWS client for Clojure & Clojurescript/Node
The Unlicense
86 stars 10 forks source link

X-Ray support #42

Open zrzka opened 7 years ago

zrzka commented 7 years ago

Description

AWS did introduce X-Ray few weeks ago (maybe months now). It would be nice to have X-Ray integrated into libraries like Hildebrand, ... These libraries are based on eulalie, so, it probably makes sense to add it here.

AWS-SDK

var ddb = AWSXRay.captureAWSClient(new AWS.DynamoDB());

You can use ddb as DynamoDB client and it will track all requests. More details.

HTTPS

var AWSXRay = require('aws-xray-sdk');
var http = AWSXRay.captureHTTPs(require('http'));

You can use http as Node's http and it will track all requests. More details.

Custom

Or you can use custom subsegments to provide whatever you want.

Discussion

I would like to have X-Ray support in your libraries. One option is to use aws-sdk directly, wrap it with X-Ray SDK and case closed. But this will lead to lot of changes everywhere.

Another option is to add X-Ray support to the eulalie directly (issuer, request, response). Sample subsegment for DynamoDB:

{
  "id": "24756640c0d0978a",
  "start_time": 1.480305974194E9,
  "end_time": 1.4803059742E9,
  "name": "DynamoDB",
  "namespace": "aws",
  "http": {
    "response": {
      "content_length": 60,
      "status": 200
    }
  },
  "aws": {
    "table_name": "scorekeep-user",
    "operation": "UpdateItem",
    "request_id": "UBQNSO5AEM8T4FDA4RQDEB94OVTDRVV4K4HIRGVJF66Q9ASUAAJG",
  }
}

Any thoughts? Any plans about aws-sdk integration? About X-Ray?