Skip to content

xray: aws xray tracer span data bug fix - #17171

Merged
mattklein123 merged 7 commits into
envoyproxy:mainfrom
suniltheta:xray_extension_bug_344
Jul 21, 2021
Merged

mattklein123 merged 7 commits into
envoyproxy:mainfrom
suniltheta:xray_extension_bug_344

Conversation

@suniltheta

@suniltheta suniltheta commented Jun 28, 2021 •

Copy link
Copy Markdown
Contributor

Commit Message: fix AWS X-Ray tracer bug where span error was not properly reported.
Additional Description: Remove 'error' tag in the trace span from getting reported inside annotations section of xray tracer segment data and instead move it inside "Errors and faults" section as per the xray documentation. Bug description available at aws/aws-app-mesh-roadmap#344 .
Risk Level: Low
Testing: Unit tests added
Docs Changes: No
Release Notes: Bug info
Platform Specific Features: No

Update xray segment data to contain  error, fault & throttle tag in the
"Errors and exceptions" section as per the xray documentation at
https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html

Signed-off-by: Sunil Narasimhamurthy <[email protected]>
throttle is seen

Signed-off-by: Sunil Narasimhamurthy <[email protected]>
@suniltheta
suniltheta requested a review from mattklein123 as a code owner June 28, 2021 15:26
@lizan
lizan requested a review from tonya11en June 28, 2021 17:58
@lizan

lizan commented Jun 28, 2021

Copy link
Copy Markdown
Member

/assign-from @envoyproxy/first-pass-reviewers

@repokitteh-read-only

Copy link
Copy Markdown

@envoyproxy/first-pass-reviewers assignee is @tonya11en

🐱

Caused by: a #17171 (comment) was created by @lizan.

see: more, trace.

@suniltheta

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #17171 (comment) was created by @suniltheta.

see: more, trace.

@suniltheta

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Check envoy-presubmit isn't fully completed, but will still attempt retrying.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #17171 (comment) was created by @suniltheta.

see: more, trace.

@suniltheta

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #17171 (comment) was created by @suniltheta.

see: more, trace.

@suniltheta

Copy link
Copy Markdown
Contributor Author

Hi @tonya11en this PR is ready for review. Thank you for your time.

@tonya11en

Copy link
Copy Markdown
Member

Sorry, I'm on vacation until 7/12. I can take a look as soon as I get back.

@suniltheta

Copy link
Copy Markdown
Contributor Author

Sorry about that, no hurry. This can wait.

string origin = 9;
string parent_id = 6;
google.protobuf.Struct aws = 10;
bool error = 11;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some 1-liner comments explaining what each message is. I know there's a link to the documentation there, but it's still seems appropriate to have some information here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines +211 to +232
auto on_send = [&](const std::string& json) {
ASSERT_FALSE(json.empty());
daemon::Segment s;
MessageUtil::loadFromJson(json, s, ProtobufMessage::getNullValidationVisitor());
ASSERT_FALSE(s.trace_id().empty());
ASSERT_FALSE(s.id().empty());
ASSERT_TRUE(s.parent_id().empty());
ASSERT_STREQ(expected_span_name, s.name().c_str());
ASSERT_STREQ(expected_origin_name, s.origin().c_str());
ASSERT_STREQ(expected_aws_key_value, s.aws().fields().at("key").string_value().c_str());
ASSERT_STREQ(expected_http_method,
s.http().request().fields().at("method").string_value().c_str());
ASSERT_STREQ(expected_http_url, s.http().request().fields().at("url").string_value().c_str());
ASSERT_STREQ(
expected_user_agent,
s.http().request().fields().at(Tracing::Tags::get().UserAgent).string_value().c_str());
ASSERT_FALSE(s.fault()); /*server error*/
ASSERT_TRUE(s.error()); /*client error*/
ASSERT_TRUE(s.throttle()); /*request throttled*/
ASSERT_DOUBLE_EQ(expected_status_code,
s.http().response().fields().at(Tracing::Tags::get().Status).number_value());
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to dedup this across some of the tests? Seems like you can capture a struct with the expected values and pass it into a func with all the common assertions.

Also, why ASSERT vs. EXPECT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were 6 checked that was common across all these functions. As you suggested I created a func and extracted out the repeated code.

Yes actually EXPECT makes more sense, and I have transformed most of the ASSERT into EXPECT.


auto on_send = [&](const std::string& json) {
ASSERT_FALSE(json.empty());
daemon::Segment s;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to also validate this proto?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes true, I added validate on this proto in the new revision. Thanks for this tip.

@tonya11en tonya11en left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks and sorry for the delay

@suniltheta

Copy link
Copy Markdown
Contributor Author

Hi @lizan, can you help merge this PR?

@mattklein123
mattklein123 merged commit 5c08797 into envoyproxy:main Jul 21, 2021
@suniltheta
suniltheta deleted the xray_extension_bug_344 branch August 20, 2021 15:54
leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
Update xray segment data to contain  error, fault & throttle tag in the
"Errors and exceptions" section as per the xray documentation at
https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html

Signed-off-by: Sunil Narasimhamurthy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants