Code Monkey home page Code Monkey logo

Comments (2)

carolabadeer avatar carolabadeer commented on June 27, 2024

Hi @jasonterando, thanks for contributing this instrumentation! The implementation looks good so far, I think it's on the right track and follows the structure of the current instrumentations in this package. The main point I wanted to call out was the possibility of supporting the new fetch API as well as node-fetch, which I see you were one step ahead on :)

Not sure if you had the time to skim through some of the automatic vs. manual mode documentation we have, so I'll leave a few references that would hopefully help clarify the difference. There's a simple explanation in the express package that says:

The AWS X-Ray SDK Core has two modes - manual and automatic. 
Automatic mode uses the cls-hooked package and automatically tracks the current 
segment and subsegment. This is the default mode. 
Manual mode requires that you pass around the segment reference.

References:

  1. cls-hooked package docs (used in automatic mode to create/update/maintain context. This allows for retrieving the current segment at any time, for example, using AWSXRay.getSegment(), since it is stored in the context created using the cls-hooked package. These docs have a few simple examples on how context works behind the scenes. The idea is, in manual mode (with no context), you would have to manually mimic the behavior of a context by setting the current segment yourself so that the SDK knows which segment is currently active.
  2. X-Ray Node SDK docs
    a. Automatic and manual mode
    b. Developing custom solutions using automatic mode
    c. Capture subsegments within chained native Promise using automatic mode. There is a PR linked in this section which has some very interesting discussions regarding the axios instrumentation and the way cls-hooked handles Promises (which is very important for fetch/node-fetch)
    d. Automatic mode examples
    e. Manual mode examples

Hope this helps, please feel free to ask any follow-up questions on this issue. Looking forward to the PR!

from aws-xray-sdk-node.

jasonterando avatar jasonterando commented on June 27, 2024

Ok, after reading through the links you sent, I think I have something that's workable. I've submitted a PR, but your pipelines are very angry about Lerna on any NodeJS version past 14. If I need to adjust package.json (or anything else) let me know.

from aws-xray-sdk-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.