Code Monkey home page Code Monkey logo

Comments (27)

spider0061 avatar spider0061 commented on May 13, 2024

@juntao Can you please provide an example of logging and tracing calls in the WasmEdge codebase. I have got the idea that I have to replace logging and tracing statements with the OpenTelemetry agent. But I am unable to locate the statements.
Thanks

from wasmedge.

juntao avatar juntao commented on May 13, 2024

from wasmedge.

spider0061 avatar spider0061 commented on May 13, 2024

Run a WasmEdge app and you will see logs printed in the console. You can locate in the source code where they are. Thanks. Cheers Michael
On Fri, Aug 20, 2021 at 7:46 AM Ashutosh Sharma @.***> wrote: @juntao https://github.com/juntao Can you please provide an example of logging and tracing calls in the WasmEdge codebase. I have got the idea that I have to replace logging and tracing statements with the OpenTelemetry agent. But I am unable to locate the statements. Thanks — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#365 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACUNVWLVS36LM67U3RWBLT5ZFDHANCNFSM5CPG5WLA .
-- Michael Yuan, PhD Fast, safe, portable and serverless Rust programs on Node.js, or as a FaaS http://SecondState.io http://cloud.secondstate.io

@juntao I have found that log statements are defined in log.cpp and we are using spdlog tag. I was running this simple command ./wasmedge --reactor examples/fibonacci.wasm fib 10 10. To find where are the log statements when FunctionType doesnot match located. I was able to find that the error tag is: MismatchCategory::FunctionType. But can you please point me to the file where the types are actuallly matched. I have used grep command as well and went through the returned files but it didn't work.
Thanks

from wasmedge.

juntao avatar juntao commented on May 13, 2024

@spider0061 This is a coding challenge. You are supposed to figure out how WasmEdge works with logging today. ;)

That said, you do not have to replace existing logging statements. You can use OpenTelemetry to demonstrate how to add new logging capabilities to this project.

from wasmedge.

CruxBox avatar CruxBox commented on May 13, 2024

Hi,
I have added some trace and logging stub to the interpreter code and maybe this would suffice for the challenge.

My repo link: https://github.com/CruxBox/WasmEdge

And the screenshot I took after I ran the example 'add.wasm' program:
Screenshot from 2021-08-22 00-42-27

As part of the challenege I had to build OpenTelemetry, build WasmEdge, link them so I could use the OTel library, and make appropriate changes in the interpreter code.
Note that the Tracer output is not very detailed but that could be changed.
Also, OTel has 3 types of logging: Errors, Debug, Info.
I chose to go with Debug but I have a screenshot of testing Error too if you'd like.
If there is anything you want me to add/modify let me know.

Thanks,

from wasmedge.

William-Mou avatar William-Mou commented on May 13, 2024

Hi,

I have compiled and installed open-telemetry and WasmEdge successfully today. I have done some code to experiment with the feasibility of embedding a C++ agent into WasmEdge.

Although the code is not perfect, Uphold the "Release early, release often" philosophy, the following is my GitHub link. There is a screenshot of the logging messages in the img folder.

https://github.com/William-Mou/WasmEdge/tree/mou/dev

opentelemetry

I learned a lot from these two Cloud Native projects. Thank You!

from wasmedge.

sonder-joker avatar sonder-joker commented on May 13, 2024

Hi,

I think I understad the log system. The main file for log is log.cpp and log.h. They generate use overload to generate error message and then goto spdlog system. If I want hack, the easy way is to hack those files(What I have make). However, there are some sparate file use spdlog directly by string literal. For those may need directly hack spdlog code in original place.

But I have spand one entirely day to try install opentelemetry-cpp. I try use cmake's FetchContent_Declare to pull it as an git submodule, but it just error at benchmark.cmake generate(follow INSTALL.md. I finially install it success by off the cmake option about opentelemetry-cpp test(-DBUILD_TESTING=OFF). However, FetchContent_Declare work not as same as the spdlog I copied (I'm not familiar with cmake before). Finally I have to make install it in docker and target link it to WasmEdge Common(Too inelegant) and compile it. And finally success run it.

Durning this try, I leran a lot knowledge about cmake. And also have a understand about WasmEdge's log system. I don't know if the apply time pass when I finish issue, but it's still a happy journey about learn.
image
repo : https://github.com/sonder-joker/WasmEdge/

from wasmedge.

XingZYu avatar XingZYu commented on May 13, 2024

Hi,

I guess the main task in this challenge is how to embed a tool/agent into WasmEdge.
So following the basic idea of log.h and log.cc, I add tracer.h and tracer.cc to embed a OpenTelemetry tracer with WasmEdge CLI. In this approach we can use OpenTelemetry to trace and log messages. To demonstrate, I just put a simple trace in the main function.

https://github.com/XingZYu/WasmEdge

image

Thanks,

from wasmedge.

st9540808 avatar st9540808 commented on May 13, 2024

Hi WasmEdge team,

I embedded an opentelemetry logging into wasmedger.cpp. Specifically inside the code path of reactor mode. Therefore, it will log whenever wasmedge CLI is called with reactor mode. It might not be the most elegant way to do it, but I managed to do the challenge with the minimum change to the code base.

Screenshot from 2021-08-23 21-59-35

github link: https://github.com/st9540808/WasmEdge

from wasmedge.

pavani-17 avatar pavani-17 commented on May 13, 2024

Hi,
I have added logging in Wasmedge using Open Telemetry. I have installed Open Telemetry in the docker image and have added Open Telemetry in cmake using this. I have added the logging commands in tools/wasmedge/wasmedger.cpp file. I hope this would be enough for the challenge. Happy to make any additional changes required.

The link to my repo: WasmedgeLogging

Attached is a picture showing the logging when add.wasm is executed:
Screenshot from 2021-08-24 22-42-09

from wasmedge.

himanshutiwariji avatar himanshutiwariji commented on May 13, 2024

Hi,
repo link - https://github.com/himanshutiwariji/WasmEdge.git

Thank you , Have a good day

from wasmedge.

SAtacker avatar SAtacker commented on May 13, 2024

No matter what I do , this is always present when linked against opentelemetry

tools/wasmedge/CMakeFiles/wasmedge.dir/build.make:83: *** target pattern contains no '%'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:2818: tools/wasmedge/CMakeFiles/wasmedge.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 91%] Linking CXX executable wasmedgeInterpreterCoreTests
[ 91%] Built target wasmedgeMemLimitTests
[ 91%] Built target wasmedgeASTTests
[ 91%] Built target wasmedgec
[ 91%] Built target wasmedgeExternrefTests
[ 91%] Built target wasmedgeInterpreterCoreTests
[ 91%] Built target wasmedgeAOTCoreTests
[ 91%] Built target wasmedge_c
make: *** [Makefile:163: all] Error 2
satacker@ubuntu:~/WasmEdge/build$ 

Complete Traceback
https://pastebin.com/sZ967jgd

Edit: The problem is in opentelemetry-cpp cmake pkg-config

tools/wasmedge/wasmedge: opentelemetry-cpp::version-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::common-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::trace-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::logs-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::ostream_log_exporter-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::ostream_span_exporter-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::zpages-NOTFOUND

from wasmedge.

spider0061 avatar spider0061 commented on May 13, 2024

No matter what I do , this is always present when linked against opentelemetry

tools/wasmedge/CMakeFiles/wasmedge.dir/build.make:83: *** target pattern contains no '%'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:2818: tools/wasmedge/CMakeFiles/wasmedge.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 91%] Linking CXX executable wasmedgeInterpreterCoreTests
[ 91%] Built target wasmedgeMemLimitTests
[ 91%] Built target wasmedgeASTTests
[ 91%] Built target wasmedgec
[ 91%] Built target wasmedgeExternrefTests
[ 91%] Built target wasmedgeInterpreterCoreTests
[ 91%] Built target wasmedgeAOTCoreTests
[ 91%] Built target wasmedge_c
make: *** [Makefile:163: all] Error 2
satacker@ubuntu:~/WasmEdge/build$ 

Complete Traceback
https://pastebin.com/sZ967jgd

Edit: The problem is in opentelemetry-cpp cmake pkg-config

tools/wasmedge/wasmedge: opentelemetry-cpp::version-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::common-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::trace-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::logs-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::ostream_log_exporter-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::ostream_span_exporter-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::zpages-NOTFOUND

I have been facing the exact error since 5 days and it is not resolved yet. I have tried a lot of solutions but none of them worked.

from wasmedge.

SAtacker avatar SAtacker commented on May 13, 2024

No matter what I do , this is always present when linked against opentelemetry

tools/wasmedge/CMakeFiles/wasmedge.dir/build.make:83: *** target pattern contains no '%'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:2818: tools/wasmedge/CMakeFiles/wasmedge.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 91%] Linking CXX executable wasmedgeInterpreterCoreTests
[ 91%] Built target wasmedgeMemLimitTests
[ 91%] Built target wasmedgeASTTests
[ 91%] Built target wasmedgec
[ 91%] Built target wasmedgeExternrefTests
[ 91%] Built target wasmedgeInterpreterCoreTests
[ 91%] Built target wasmedgeAOTCoreTests
[ 91%] Built target wasmedge_c
make: *** [Makefile:163: all] Error 2
satacker@ubuntu:~/WasmEdge/build$ 

Complete Traceback
https://pastebin.com/sZ967jgd
Edit: The problem is in opentelemetry-cpp cmake pkg-config

tools/wasmedge/wasmedge: opentelemetry-cpp::version-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::common-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::trace-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::logs-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::ostream_log_exporter-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::ostream_span_exporter-NOTFOUND
tools/wasmedge/wasmedge: opentelemetry-cpp::zpages-NOTFOUND

I have been facing the exact error since 5 days and it is not resolved yet. I have tried a lot of solutions but none of them worked.

Instead of using whatever is given in opentelemetry-cpp docs try the following after installing opentelemetry-cpp

find_package(opentelemetry-cpp CONFIG REQUIRED)

...


target_include_directories(wasmedge 
  PRIVATE 
  ${OPENTELEMETRY_CPP_INCLUDE_DIRS}
  ${OPENTELEMETRY_CPP_LIBRARY_DIRS}
)

target_link_libraries(wasmedge
  PRIVATE
  wasmedgeVM
  ${OPENTELEMETRY_CPP_LIBRARY_DIRS}  
)

from wasmedge.

SAtacker avatar SAtacker commented on May 13, 2024

To be more generic wasmedge can be any CMake target variable
On a side note: Apologies for making this challenge discussion deviate from its main point but I wonder why docker users didn't face this.

from wasmedge.

spider0061 avatar spider0061 commented on May 13, 2024

Hello Mentors,

For the past few days I was facing error in linking opentelemetry with wasmedge. I even contacted the opentelemetry team regarding this as none of the other developers was facing the inevitable error 2. I was finally able to resolve it and here is the screenshot of the changes that I made:
Screenshot from 2021-08-26 12-06-19
In the beginning I thought that it was an easy challenge, indeed it was an easy challenge but I was not aware that I will fall into this much trouble while linking opentelemetry. I have learned about wasmedge and how it is used to run wasm progroms. I also got introduced to webassembly and how webassembly can be a revolutionary step in web development.
I have learned about host modules and functions and currently I am working on them only.
I would like to thank mentors and this challenge really taught me a lot of things and finally I was able to complete it.
Repository Link: https://github.com/spider0061/WasmEdge

Thanks and Regards
Ashutosh Sharma

from wasmedge.

vaibhavarora102 avatar vaibhavarora102 commented on May 13, 2024

hi here's the coding challenge solution on GitHub link: https://github.com/vaibhavarora102/WasmEdge

it was indeed very refreshing, and warming up the task. Looking forward to mentors' guidance in the LFX mentorship program.

from wasmedge.

OliverShang avatar OliverShang commented on May 13, 2024

Hi,

I've spent a few days in linking opentelemetry with wasmedge and building opentelemetry from source, a lot of problems occurred during compiling. I even started a issue in opentelemetry-cpp about build errors, and found out the dependency benchmark should be compiled in PIC(Position Independent Code) mode. At least finally it worked. I embedded an opentelemetry logging into wasmedger.cpp, and learned a lot about wasm in this challenge. Hope I did not miss the deadline.

Repo: https://github.com/OliverShang/WasmEdge

Thanks,

from wasmedge.

ZiNai avatar ZiNai commented on May 13, 2024

Hi,
I spent some time learning the basics of c++ and cmake. After that, I tried to build wasmedge based on build.md on my mac, but there were various strange problems, often stuck at 73%. So I had to try it on my Ubuntu 20.04 cloud host. And I spent a lot of time to install opentelemetry-cpp during the build.
The first time I came into contact with c++ projects. Maybe because of my lack of experience ,I feel that package management and construction are very primitive, which directly caused a very unfriendly development experience!

There is a tip
If your github network is not very good, you can try the following command.

SET URL INSTEAD

git config --global url."https://github.com.cnpmjs.org/".insteadOf https://github.com

UNSET

git config --global --remove-section url."https://github.com.cnpmjs.org/"

My Repo

My ScreenShot

Screen Shot 2021-08-27 at 3 33 49 PM

from wasmedge.

alabulei1 avatar alabulei1 commented on May 13, 2024

Hi,

I try several ways to embed OpenTelemetry like FetchContent_Declare. But it doesn't work well. Finally, I build and make opentelemetry-cpp, and set opentelemetry-cpp_DIR to the directory where contains config.cmake. Then build wasmedge in the docker. It prints log information successfully. By doing this challenge I learned a lot about cmake, especially "find_package". I enjoy solving the problem.
Thank you!

Screen Shot 2021-08-27 at 8 01 09 AM

Repository Link: https://github.com/Flpha0830/WasmEdge

Hi, could you tell me your name or email when you signed up for the LFX mentorship? I tried to search by your GitHub name and your university. However, I couldn't find you through the applications. Thanks.

from wasmedge.

SAtacker avatar SAtacker commented on May 13, 2024

In case Anyone is eager to help as the challenge seems to be over already here are my logs which tells me that I haven't installed protobuf,nlohmann-json,libcurl,grpc
However, I have installed those as we can see in

root@4b5d92daa3be:~/wasm_work/WasmEdge/build# l
s /usr/local/lib/cmake/
absl    grpc               protobuf
c-ares  opentelemetry-cpp  re2
root@4b5d92daa3be:~/wasm_work/WasmEdge/build#
 ls /usr/lib/cmake/
clang-12  nlohmann_json

from wasmedge.

PratyushD35 avatar PratyushD35 commented on May 13, 2024

Hi,
After a lot of struggles, I myself compiled and build and make OpenTelemetry and then WasmEdge. In my screenshot, I have shown both pass and fail cases. I think I have learned a lot during this small coding Challenge.
This is my Repository Link:https://github.com/PratyushD35/WasmEdge
Screenshot (30)

from wasmedge.

SAtacker avatar SAtacker commented on May 13, 2024

In case Anyone is eager to help as the challenge seems to be over already here are my logs which tells me that I haven't installed protobuf,nlohmann-json,libcurl,grpc
However, I have installed those as we can see in

root@4b5d92daa3be:~/wasm_work/WasmEdge/build# l
s /usr/local/lib/cmake/
absl    grpc               protobuf
c-ares  opentelemetry-cpp  re2
root@4b5d92daa3be:~/wasm_work/WasmEdge/build#
 ls /usr/lib/cmake/
clang-12  nlohmann_json

GitHub link - https://github.com/SAtacker/WasmEdge/tree/satacker
I have added open telemetry using examples from the docs inside the main function of wasmedge runtime

from wasmedge.

SAtacker avatar SAtacker commented on May 13, 2024

Finally, I succeeded in here
https://github.com/SAtacker/WasmEdge/tree/satacker
image

from wasmedge.

gautam-dev-maker avatar gautam-dev-maker commented on May 13, 2024

Hi,
After spending a lot of time I finally did it. There were lots of build issues , especially unmet dependencies. I installed openTelemetry depedencies using "ci" scripts and everything seems to work fine.
here is my git repository :- https://github.com/gautam-dev-maker/WasmEdge
Proof :-
Screenshot 2021-08-28 at 12 10 46 AM

from wasmedge.

chaytanyasinha avatar chaytanyasinha commented on May 13, 2024

Hello Mentors,
I am sorry for submitting at last moment but I have tried my best to do the challenge efficiently.
I have done the required changes as I installed Open Telemetry and done a few changes in wasmedger.cpp and CMakeList.cpp.
Link to my repository : https://github.com/chaytanyasinha/WasmEdge
I hope you like it!

from wasmedge.

hydai avatar hydai commented on May 13, 2024

I am closing this issue due to outdated.

from wasmedge.

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.