Skip to content

tracing: proper child span support in gRPC client#1885

Merged
mattklein123 merged 7 commits intomasterfrom
async_span_new
Oct 19, 2017
Merged

tracing: proper child span support in gRPC client#1885
mattklein123 merged 7 commits intomasterfrom
async_span_new

Conversation

@mattklein123
Copy link
Copy Markdown
Member

  • Remove finalizer concept as it isn't needed and requires extra
    allocations.
  • Plumb tracing through into gRPC client and wire up in ratelimit
    client.
  • Do not require null allocation for span in connection manager
    if tracing is not configured.
  • Remove propagating x-request-id for ratelimit requests as we
    now have proper tracing support. If this is requested in the
    future we should make request ID a part of Tracing::Span
    itself.

Signed-off-by: Matt Klein mklein@lyft.com

- Remove finalizer concept as it isn't needed and requires extra
  allocations.
- Plumb tracing through into gRPC client and wire up in ratelimit
  client.
- Do not require null allocation for span in connection manager
  if tracing is not configured.
- Remove propagating x-request-id for ratelimit requests as we
  now have proper tracing support. If this is requested in the
  future we should make request ID a part of Tracing::Span
  itself.

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Copy Markdown
Member Author

@objectiser @goaway @rshriram

@objectiser this will conflict with your PR I think. We can merge yours first.

Signed-off-by: Matt Klein <mklein@lyft.com>
Copy link
Copy Markdown
Member

@rshriram rshriram left a comment

Choose a reason for hiding this comment

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

Nice. Is it possible to apply this to the xDS calls as well ?

Copy link
Copy Markdown
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

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

Just some comments about the tags.


struct {
const std::string STATUS = "status";
const std::string GRPC_STATUS = "grpc-status";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this be changed to grpc.status_code to be consistent with the http equivalent?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sure will do

void cancel() override { this->resetStream(); }
void cancel() override {
current_span_->setTag(TracingConfig::get().TagStrings.STATUS,
TracingConfig::get().TagStrings.CANCELED);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this record the status in grpc.status_code (TagStrings.GRPC_STATUS) as discussed above, and use the GRPC status code value i.e. CANCELLED?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I thought about this, but my thinking is that this is a local cancel, not a remote cancel, so we shouldn't confuse it with gRPC remote cancellation?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good point - best to keep separate.

callbacks_.onFailure(Status::Internal, EMPTY_STRING);
return;
current_span_->setTag(TracingConfig::get().TagStrings.ERROR,
TracingConfig::get().TagStrings.TRUE);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should also record the status, TagStrings.GRPC_STATUS, status) (status in text form).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We do store the numeric status above. Are you suggesting a new tag name with spelled out status?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, ignore - storing the integer is fine.

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Copy Markdown
Member Author

@objectiser updated

Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
@goaway
Copy link
Copy Markdown
Contributor

goaway commented Oct 19, 2017

LGTM. Basically what I was going for sans the finalizer overhead, which I agree ends up being an improvement.


current_span_ = parent_span.spawnChild(TracingConfig::get(),
"async " + parent.remote_cluster_name_ + " egress",
ProdSystemTimeSource::instance_.currentTime());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reminds me that we need to upgrade lightstep to add monotonic time to tracing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah we do need to do this. I think that entire driving is being worked on so hopefully we can get it swapped out with the OT driver update.

class AsyncClientTracingConfig : public Tracing::Config {
public:
// Tracing::Config
Tracing::OperationName operationName() const override { return Tracing::OperationName::Egress; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

missing cov for :265-:268

danielhochman
danielhochman previously approved these changes Oct 19, 2017
Copy link
Copy Markdown
Contributor

@danielhochman danielhochman left a comment

Choose a reason for hiding this comment

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

lgtm, minor nit

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Copy Markdown
Member Author

@danielhochman @goaway updated

@mattklein123 mattklein123 merged commit 22f5202 into master Oct 19, 2017
@mattklein123 mattklein123 deleted the async_span_new branch October 19, 2017 21:50
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
* Reduce log level for jwt filter (envoyproxy#1866)

* Update_Dependencies (envoyproxy#1873)

* Correctly clean up headers used for payload from JWT authentication (envoyproxy#1879)

* Correctly clean up headers used for payload from JWT authentication

* Clang

* Update_Dependencies (envoyproxy#1883)

* destination.principal derivation fix (envoyproxy#1884)

* fix attribute extraction

Signed-off-by: Kuat Yessenov <kuat@google.com>

* seed mock

Signed-off-by: Kuat Yessenov <kuat@google.com>

* merge 1.0 to master

* Update API SHA (envoyproxy#1891)

* add needed dependencies for circle ci
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Description: Assign an int to each log level for consumption.
Risk Level: low
Testing: ci
Docs Changes: n/a
Release Notes: n/a
[Optional Fixes #Issue] n/a
[Optional Deprecated:] n/a

Signed-off-by: Jingwei Hao <jingwei.hao@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Description: Assign an int to each log level for consumption.
Risk Level: low
Testing: ci
Docs Changes: n/a
Release Notes: n/a
[Optional Fixes #Issue] n/a
[Optional Deprecated:] n/a

Signed-off-by: Jingwei Hao <jingwei.hao@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.com>
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.

5 participants