Code Monkey home page Code Monkey logo

Comments (6)

haotianw465 avatar haotianw465 commented on July 18, 2024

Hi, I answered this question in a stack overflow post here.

But I copy/paste my answer here regardless:

The node you see comes from this PR #19 for adding support to httplib. If you use patch_all httplib operations will also be captured. In your case the dependency tree is boto3 -> botocore -> vendored requests -> httplib. So your AWS subsegment will have children subsegments that representing operations executed by httplib.

The service graph however will render a "remote" subsegment as a node which is what you see. The recommended way is to explicit patch the library you want to capture to avoid unexpected behavior.

from aws-xray-sdk-python.

xplorld avatar xplorld commented on July 18, 2024

Ok I understand what happens.

However, I do not think it is a good design to leave patch_all() as it is now, for a user may imagine patch_all() is a ready-to-use one-line patch that just traces every call exactly once.

Maybe we can do something to avoid this. For example, whenever a httplib call is traced, the tracing code examines whether the xray_recorder examines current tracing environment.

  • context is segment, trace.
  • context is subsegment which is local, trace.
  • context is subsegment which is aws or remote, DO NOT trace.

from aws-xray-sdk-python.

xplorld avatar xplorld commented on July 18, 2024

Actually IMHO the SDK should ignore any new subsegment in a remote subsegment context.

from aws-xray-sdk-python.

haotianw465 avatar haotianw465 commented on July 18, 2024

Thank you for the suggestions. These are very good points. There are use cases where user want to trace both boto3 and httplib as boto3 tracing doesn't have as much granularity as httplib (retries, establishing connection etc). In that case although the service graph is not in an ideal shape due to lack of a mechanism to do custom aggregation, but trace timeline has much more information on the lowest python level information.

But yes to your point the redundant nodes are confusing. I propose to have patch_all takes a flag of supporting indirect dependency or not. By default if library A and B are both supported but A depends on B, patch_all() will not patch B. But with a flag set to True, if will patch all libraries regardless of their relationships.

Please let me know your thoughts on this.

from aws-xray-sdk-python.

xplorld avatar xplorld commented on July 18, 2024

Extra argument on patch_all is great. I'd love to see that.

from aws-xray-sdk-python.

haotianw465 avatar haotianw465 commented on July 18, 2024

This is added in release 2.0.0 with default to not do double patching.

from aws-xray-sdk-python.

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.