-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xray tracer: set subsegment type for child spans #2
Conversation
Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com>
/** | ||
* Gets this Span's type. | ||
*/ | ||
const std::string& type() const { return type_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also considered using a boolean isChild to mark a given span, but this works too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what you have is more flexible.
@@ -347,6 +347,7 @@ TEST_F(XRayTracerTest, ChildSpanHasParentInfo) { | |||
// Hex encoded 64 bit identifier | |||
EXPECT_STREQ("00000000000003e7", s.parent_id().c_str()); | |||
EXPECT_EQ(expected_->span_name, s.name().c_str()); | |||
EXPECT_EQ(Subsegment, s.type().c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we update the test to check that type()
is not set for a parent span?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Had one minor suggestion.
Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also include a note in docs/root/version_history/current.rst
? Probably under Minor Behavior Changes
@@ -26,6 +26,7 @@ namespace Tracers { | |||
namespace XRay { | |||
|
|||
constexpr auto XRayTraceHeader = "x-amzn-trace-id"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you change this also to constexpr absl::string_view
?
* xray tracer: set subsegment type for child spans Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * adds test coverage Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com>
Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> xray tracer: set subsegment type for child spans (#2) * xray tracer: set subsegment type for child spans Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * adds test coverage Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> Xray subsegment (#3) * xray tracer: set subsegment type for child spans Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * adds test coverage Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * updates xray subsegment name to use operation name (instead of parent's span name) Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * updates doc Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * updates doc Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> Xray subsegment (#4) * xray tracer: set subsegment type for child spans Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * adds test coverage Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * updates xray subsegment name to use operation name (instead of parent's span name) Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * updates doc Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * updates doc Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> * adds to spell check dictionary Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com> fixes spellcheck Signed-off-by: Rex Chang <58710378+rexnp@users.noreply.github.com>
Signed-off-by: Rex Chang 58710378+rexnp@users.noreply.github.com
Commit Message: xray tracer: sets the xray segment with type "subsegment" from child spans.
xray doc: https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html#api-segmentdocuments-subsegments
Additional Description:
Risk Level: low
Testing: unit test, manual setup verifying new xray behavior
Docs Changes: N/A
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue] aws/aws-app-mesh-roadmap#354
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]
Here's a piece of the output with this change and using the same howto-ecs-basics walkthrough:
in particular looking at the trace with
"name": "howto-ecs-basics/howto-ecs-basics-front-node"
, which is emitted by Envoy, it now contains a subsegment for the egress call tocds_egress_howto-ecs-basics_howto-ecs-basics-color-node_http_8080
. Now, the only thing that remains is the fact that the name of this subsegment is the same as its parenthowto-ecs-basics/howto-ecs-basics-front-node
. We'll have to confirm what the intended behavior is.