Skip to content

scope tracker: attach scope trackers to Http:Client and PlatformBridgeFilter#1498

Merged
junr03 merged 31 commits intomainfrom
scope-tracker
Jun 28, 2021
Merged

scope tracker: attach scope trackers to Http:Client and PlatformBridgeFilter#1498
junr03 merged 31 commits intomainfrom
scope-tracker

Conversation

@junr03
Copy link
Copy Markdown
Member

@junr03 junr03 commented May 31, 2021

Description: scope tracker - attach scope trackers to Http:Client and PlatformBridgeFilter
Risk Level: med - changing crash clean up routine
Testing: example app. Integration test pending.

Signed-off-by: Jose Nino jnino@lyft.com

…eFilter

Signed-off-by: Jose Nino <jnino@lyft.com>
Jose Nino added 3 commits June 2, 2021 12:07
Signed-off-by: Jose Nino <jnino@lyft.com>
fmt
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Jose Nino added 2 commits June 3, 2021 15:56
Signed-off-by: Jose Nino <jnino@lyft.com>
fmt
Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03
Copy link
Copy Markdown
Member Author

junr03 commented Jun 3, 2021

@goaway updated! re: using the ostream arg, I opened #1497. I want to land this and then think about that if you are ok with that.

@junr03
Copy link
Copy Markdown
Member Author

junr03 commented Jun 3, 2021

note: this PR depends on envoyproxy/envoy#16709 and envoyproxy/envoy#16738

Jose Nino added 10 commits June 11, 2021 10:26
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
fix
Signed-off-by: Jose Nino <jnino@lyft.com>
fix
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Http::TestResponseTrailerMapImpl response_trailers{{"x-test-trailer", "test trailer"}};
EXPECT_EQ(Http::FilterTrailersStatus::Continue, filter_->encodeTrailers(response_trailers));

checkFilterState("NullImplementation", "0",
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.

Will add throughout the rest of the test suite once we are finalized on all the state we want to keep track of and dump.

}

void ProvisionalDispatcher::pushTrackedObject(const ScopeTrackedObject* object) {
if (event_dispatcher_) {
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.

This access is not inherently threadsafe, though it will likely only be called from a valid context. Still, we might want to have a safety check in these calls (like we do with deferredDelete).

Copy link
Copy Markdown
Member Author

@junr03 junr03 Jun 16, 2021

Choose a reason for hiding this comment

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

currently scopes are only created in the threading context of the event dispatcher. I removed all if statements and put in asserts like in deferred delete

}
}

bool ProvisionalDispatcher::trackedObjectStackIsEmpty() const {
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.

When does this get called?

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.

Based on your check below, we might want to lock here, depending on the usage.

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.

This actually never gets currently called. I could change usage to NOT_REACHED. But for now I changed to isThreadSafe assertion.

@goaway
Copy link
Copy Markdown
Contributor

goaway commented Jun 15, 2021

Overall looks good, just some concerns around threadsafety when accessing the underlying dispatcher.

Jose Nino added 4 commits June 16, 2021 09:42
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Jose Nino added 4 commits June 17, 2021 10:10
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
EXPECT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().Status()->value().getStringView());
}
// TEST_P(PlatformBridgeIntegrationTest, MultipleFilters) {
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.

@goaway given how request and responses are passed in threading contexts in the integration text framework, I am having trouble getting the filters to run in the thread of their own dispatcher without stalling the test.

If you are ok with it, could we maybe land this PR, and I can untangle the threading issue in this integration test in a subsequent PR?

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 can open a ticket to track

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.

Yes, please open a tracking issue/ticket.

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.

fmt
Signed-off-by: Jose Nino <jnino@lyft.com>

// Encode response headers.
EXPECT_CALL(dispatcher_, pushTrackedObject(_));
EXPECT_CALL(dispatcher_, popTrackedObject(_));
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.

Don't need to block on this, but we might just want to adopt NiceMock behavior for these calls so we don't have to count them everywhere in tests.

goaway
goaway previously approved these changes Jun 17, 2021
Jose Nino added 3 commits June 17, 2021 18:45
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Jose Nino added 3 commits June 20, 2021 14:37
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
@goaway
Copy link
Copy Markdown
Contributor

goaway commented Jun 21, 2021

Nice work!

@junr03 junr03 merged commit ce87d01 into main Jun 28, 2021
@junr03 junr03 deleted the scope-tracker branch June 28, 2021 18:05
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.

2 participants