Skip to content

wasm: refactor around stats, events and WasmExtension class.#17268

Merged
mattklein123 merged 8 commits intoenvoyproxy:mainfrom
mathetake:wasm-clean-up
Jul 14, 2021
Merged

wasm: refactor around stats, events and WasmExtension class.#17268
mattklein123 merged 8 commits intoenvoyproxy:mainfrom
mathetake:wasm-clean-up

Conversation

@mathetake
Copy link
Copy Markdown
Member

@mathetake mathetake commented Jul 8, 2021

This PR refactors the Wasm codebase around host defined stats, and WasmEvent, and WasmExtension class. Notablely, we delete the WasmExtension and EnvoyExtension classes which seem unused and unnecessary abstraction, and add CreateStatsHandler and LifecycleStatsHandler classes for handling Events and host defined metrics. The primary purpose is to drive the future work for the #16726 and #16403.

Signed-off-by: Takeshi Yoneda takeshi@tetrate.io

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@mathetake mathetake marked this pull request as ready for review July 8, 2021 08:06
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@mathetake
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

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

🐱

Caused by: a #17268 (comment) was created by @mathetake.

see: more, trace.

Copy link
Copy Markdown
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

This is actually used by Istio to export more stats. See:

Having said that, it seems that those stats all refer to async fetch, which we don't use anymore, so perhaps it could be removed... cc @mandarjog @kyessenov @bianpengyuan

@mathetake
Copy link
Copy Markdown
Member Author

Thanks @PiotrSikora, I should have looked at istio/proxy, but yeah as you said, it looks like a redundant and not used anymore.

Also I realized that we could remove IstioContext there as well which I think is the reason for why factories are exposed to Istio via EnvoyWasm class and also why class IstioWasm exists there.

I am more than happy to refactor istio/proxy as well since this could bring benefits both to Envoy and Istio/proxy codebase.

@mandarjog
Copy link
Copy Markdown
Contributor

We can get rid of async fetch, it is not used anymore.
@yuval-k do you use async fetch ?

@PiotrSikora
Copy link
Copy Markdown
Contributor

We can get rid of async fetch, it is not used anymore.

That's a bit of a stretch. The fact that Istio doesn't use it anymore doesn't mean that other Envoy users are not using it.

In any case, if we want to have this discussion, could you please open a new issue? It's a breaking change that shouldn't be discussed in comments of a "random" PR.

@mandarjog
Copy link
Copy Markdown
Contributor

@PiotrSikora agreed wrt Istio, so that cannot be the reason.

however the async fetch is racy. @kyessenov @bianpengyuan can we comment on why we decided that we cannot recommend async fetch alone?

Copy link
Copy Markdown
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

LGTM, sans nits.

Comment thread source/extensions/common/wasm/stats_handler.h Outdated
Comment thread source/extensions/common/wasm/stats_handler.cc Outdated
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@mathetake
Copy link
Copy Markdown
Member Author

mathetake commented Jul 12, 2021

@mathetake
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

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

🐱

Caused by: a #17268 (comment) was created by @mathetake.

see: more, trace.

@mathetake
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

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

🐱

Caused by: a #17268 (comment) was created by @mathetake.

see: more, trace.

@mathetake
Copy link
Copy Markdown
Member Author

hmm.. looks like a deterministic but I have no idea why this affects these lines after merge main..

@PiotrSikora
Copy link
Copy Markdown
Contributor

Code coverage for source/extensions/common is lower than limit of 96.5 (96.4)
Code coverage for source/extensions/common/wasm is lower than limit of 95.3 (95.2)

you need to adjust those values in test/per_file_coverage.sh, or ideally improve the coverage.

@mathetake
Copy link
Copy Markdown
Member Author

mathetake commented Jul 12, 2021

yeah but I want to understand why the coverage drops after merging main:

I see that some lines of convertFilterDataStatus, encodeData and decodeData has started not being covered after main merge, which seems unrelated to this PR 😞

@mathetake
Copy link
Copy Markdown
Member Author

OK https://github.com/envoyproxy/envoy/pull/17280/files#diff-a2dee6268db4920c2bd9665ba1429c144cd6a9e158b8845c503fb3d5c6fa273cL410-L411 this dropped the coverage on encode/decodeData and convertFilterDataStatus, and this PR triggered the coverage CI failure somehow.

@mathetake
Copy link
Copy Markdown
Member Author

raised the PR to backfill the coverage #17292

@PiotrSikora
Copy link
Copy Markdown
Contributor

OK https://github.com/envoyproxy/envoy/pull/17280/files#diff-a2dee6268db4920c2bd9665ba1429c144cd6a9e158b8845c503fb3d5c6fa273cL410-L411 this dropped the coverage on encode/decodeData and convertFilterDataStatus, and this PR triggered the coverage CI failure somehow.

Oops, good catch! I wonder why the CI didn't catch it in that PR, though.

@kyessenov
Copy link
Copy Markdown
Contributor

Async fetch has no error recovery. If the retries fail and xDS is ACKed, the error is permanent. So it is not recommended unless the network is reliable (which is never true).

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).

🐱

Caused by: #17268 was synchronize by mathetake.

see: more, trace.

@repokitteh-read-only repokitteh-read-only Bot added the deps Approval required for changes to Envoy's external dependencies label Jul 13, 2021
Copy link
Copy Markdown
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

Thanks!

@moderation
Copy link
Copy Markdown
Contributor

/lgtm deps

@repokitteh-read-only repokitteh-read-only Bot removed the deps Approval required for changes to Envoy's external dependencies label Jul 14, 2021
@mattklein123 mattklein123 merged commit f43e9ef into envoyproxy:main Jul 14, 2021
@yuval-k
Copy link
Copy Markdown
Contributor

yuval-k commented Jul 14, 2021

We can get rid of async fetch, it is not used anymore.
@yuval-k do you use async fetch ?

we also are moving to ECDS, but are using async fetch in the interm.

@mathetake mathetake deleted the wasm-clean-up branch July 14, 2021 23:12
leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
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.

7 participants