Giter Site home page Giter Site logo

Example's root_id about proxy-wasm-cpp-sdk HOT 5 OPEN

proxy-wasm avatar proxy-wasm commented on May 26, 2024
Example's root_id

from proxy-wasm-cpp-sdk.

Comments (5)

bianpengyuan avatar bianpengyuan commented on May 26, 2024

Empty root id should also be valid. I think it is something else that makes the example not working.. Most likely tool chain. I have a pending #71 to update both tool chain and the example to use bazel. Have not yet got time to finish that.

Meanwhile, you can reference this guide: https://github.com/istio-ecosystem/wasm-extensions/blob/master/doc/write-a-wasm-extension-with-cpp.md, which will be blog posted with 1.9.

from proxy-wasm-cpp-sdk.

esnible avatar esnible commented on May 26, 2024

I'm not trying to get into an argument with you. I have retested it, and can confirm.

Using myproject.cc with static RegisterContextFactory register_ExampleContext(CONTEXT_FACTORY(ExampleContext), "my_root_id"); works; using it with static RegisterContextFactory register_ExampleContext(CONTEXT_FACTORY(ExampleContext)); doesn't.

When using "my_root_id" my Istio EnvoyFilter contained

          value:
            config:
              root_id: "my_root_id"

when using no string parameter to register_ExampleContext() my EnvoyFilter contained

          value:
            config:
              root_id: ""

The logs only appear when I use a non-empty root id. I will try to troubleshoot this to see if it is a problem with Istio, Envoy, or this SDK.

from proxy-wasm-cpp-sdk.

bianpengyuan avatar bianpengyuan commented on May 26, 2024

@esnible could you skip adding root_id? Not sure if that makes a difference.

from proxy-wasm-cpp-sdk.

esnible avatar esnible commented on May 26, 2024

Further investigation. If I use root_id: "my_root_id" vs root_id: "" in my EnvoyFilter Pilot generates six nearly identical type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm and they are ACK'd and make it to Envoy's config_dump.

Istio and Envoy seem to have a disconnect between empty and null root_id. I created istio/istio#30473 to discuss. XDS generates a "" root ID, and Envoy ignores it.

In both cases Envoy's logs show

2021-01-28T16:28:03.570764Z	trace	envoy wasm	[host->vm] proxy_on_context_create(2, 0)
2021-01-28T16:28:03.570848Z	trace	envoy wasm	[vm->host] env.proxy_get_property(2544, 14, 5247632, 5247628)
2021-01-28T16:28:03.571720Z	trace	envoy wasm	[vm<-host] env.proxy_get_property return: 0
2021-01-28T16:28:03.571758Z	trace	envoy wasm	[host<-vm] proxy_on_context_create return: void

with only the context ID varying.

I will do a further experiment trying to put a null value into the root_id.

from proxy-wasm-cpp-sdk.

esnible avatar esnible commented on May 26, 2024

Further information:

If I don't include a root_id in my EnvoyFilter it works. So you are correct, there is nothing wrong with the lack of one in your README. You can close this issue, although I would recommend putting a root_id into the example as an enhancement to avoid people falling into the same pit I am falling in.

I learned one more weird thing. I also tried root_id: ~ which SHOULD set root_id to the nil pointer rather than the empty string.

When I did that, Envoy logged some unexpected things.

2021-01-28T17:00:01.308172Z	debug	envoy wasm	expr_evaluate value error: No value with name "downstream_peer" found in Activation
2021-01-28T17:00:01.308191Z	trace	envoy wasm	wasm log: [extensions/stats/plugin.cc:607]::report() Failed to evaluate expression: <downstream_peer.cluster_id>

I have no clue if that is a problem with Envoy, or this library, or the config Istio generates. If that log info is troubling please follow-up.

from proxy-wasm-cpp-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.