Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples Exporting Traces to Collector. #771

Closed
contractormarketplace opened this issue May 25, 2021 · 7 comments
Closed

Examples Exporting Traces to Collector. #771

contractormarketplace opened this issue May 25, 2021 · 7 comments

Comments

@contractormarketplace
Copy link

We are trying to build a proof of concept application that will export traces to the collector. We did NOT find any examples that export traces to collector. Are there any sample apps that will export traces to collector? Can you please provide references.

@ahayworth
Copy link
Contributor

Hi @contractormarketplace -

One place to look would be the instrumentation/ directory in this repo - most of the auto-instrumentation libraries ship with runnable examples that will export traces. It may vary by example file, but in general you could point any of those examples at an OTLP collector and the traces would end up there (instead of in your console).

I've played around with the idea of sample applications as well, and here's a ruby / protobuf example: https://github.com/ahayworth/hipster-shop/tree/master/src/cartservice . It's not up to the latest ruby API, but the gist of it should be the same. (Note that the cartservice.rb file contains a whole service, not just the instrumentation bits - but I trust you can see where opentelemetry is being used, etc).

If you have any specific questions, please let us know - we are always looking to improve documentation. 😄

@contractormarketplace
Copy link
Author

Hi @ahayworth ,
I am new to Ruby but thanks to your guidance I found a simple application in instrumentation/http_client.

I did the following :-
sudo gem install opentelemetry-instrumentation-http_client

opentelemetry-ruby/instrumentation/http_client/example$
ruby trace_demonstration.rb

And ended up with the following error :
Traceback (most recent call last):
1: from trace_demonstration.rb:5:in <main>' trace_demonstration.rb:5:in require': cannot load such file -- httpclient (LoadError)

We have an instance of collector running on our servers and listening on port 55680, are there any environment variables that need to be set to transfer the traces over to the server?

@arielvalentin
Copy link
Contributor

arielvalentin commented May 26, 2021

@contractormarketplace if I understand your need you are looking for an example of how to configure the SDK to export to open-telemetry-collector using OTLP. Is that correct?

@contractormarketplace
Copy link
Author

@arielvalentin , yes that is correct.

Basically, we have a server in our intranet that runs the collector listening on port 55680. We are trying to send traces (not metrics) to the collector.

@ahayworth
Copy link
Contributor

Traceback (most recent call last):
1: from trace_demonstration.rb:5:in <main>' trace_demonstration.rb:5:in require': cannot load such file -- httpclient (LoadError)

This error implies that your local ruby installation cannot find the httpclient gem; which you'll also need to install.

@contractormarketplace
Copy link
Author

I did the following :-
sudo gem install httpclient
And then ran the application ruby trace_demonstration.rb
But ran into the same error...

@ahayworth
Copy link
Contributor

I believe using sudo may be putting things in your system-wide ruby installation; and so you may need to run the example script with sudo as well.

Since you said you're new to ruby, I think you may wish to consult some of the bundler documentation, and general how-tos on getting a working ruby environment. I would start here:

For now I'll close out this issue, since I think this is related to your overall ruby installation not working correctly and that's out of scope for this project. However, please re-open it if you find something specific that we can help out with for opentelemetry!

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

No branches or pull requests

3 participants