-
Notifications
You must be signed in to change notification settings - Fork 21
Example of using custom endpoint instead of ocAgent binary #174
Comments
Great question here. This is definitely a gap in our current docs. At a high level, what you need to do is add a new endpoint to you app and simply forward whatever JSON payload comes in from the OpenCensus Web library and pass it on to the OpenCensus Agent (which accepts HTTP/JSON via grpc-gateway). I don't have an ETA for it, but I agree this is important and will plan to do it. |
Also a PR is welcome if you get to it first and can find an easy way to integrate it into the current user interaction example! What language are you using in your server, is it Node.js? |
Dave, thanks for your reply. May I ask you a followup? Is OC Agent binary absolutely necessary for OpenCensus WEB? We were planning to use OC Web with OC library embedded into our application. Is this scenario supported? We use Asp.Net Core app. Yes, if I'm able to make this work properly first, I'll certainly send a PR. Thanks again for your help. |
You're right - it is not necessary to use the OC Agent binary. You could export the trace spans in your Asp.Net Core app using the OpenCensus .Net library. The challenge there is that you would need to write the code to ingest the JSON blob from OpenCensus web and format it as spans for the OpenCensus .Net library, which might take some work. The reason I implemented the suggestion with the OC Agent is that people write servers in different languages, so for us to be able to do this in general without the OC Agent, we would need that same translation code for Go, Python, Java, etc. But if you're interested in pursuing that route, here is an auto-generated Open API/Swagger description of the JSON format that OpenCensus Web uses to send to the agent. It is ultimately based on a proto files. That translation code would ideally be extractable as a library to gradually move to the place where we could have similar code for every language to not require the OC Agent. Since your app is in Asp.Net, don't feel like you need to do a PR for the Node example, but if you are motivated to do so, that would be helpful. An Asp.Net example would also be super cool! |
I'll take a look at Open API reference you provide. Thank you! |
The current documentation and examples point out that instead of using OpenCensus Agent, we could alternatively expose a custom endpoint on Frontend web server to collect the traces and export these via OpenCensus library.
However, there is no example of how to parse and forward the data received from OpenCensus WEB (JS).
E.g. docs say the following:
We also suggest that you create an endpoint in the server that receives the HTTP/JSON traces and proxies to the OpenCensus Agent.
However, there is no information about the format of these JSON trances, or maybe I cannot find these easily.
The text was updated successfully, but these errors were encountered: