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

Question: How to import otlp_http_exporter in a bazel project? #1032

Closed
miiila opened this issue Oct 25, 2021 · 6 comments · Fixed by #1046
Closed

Question: How to import otlp_http_exporter in a bazel project? #1032

miiila opened this issue Oct 25, 2021 · 6 comments · Fixed by #1046

Comments

@miiila
Copy link

miiila commented Oct 25, 2021

Hey everybody, I have a question about importing otlp_http_exporter in a bazel project. I tried adding following into my WORKSPACE file:

# https://github.com/open-telemetry/opentelemetry-cpp
new_git_repo
    name = "opentelemetry-cpp",
    commit = "096c08b6b6dbd8645eebdccc8c06b83fa7a50cd3",
    remote = "https://github.com/open-telemetry/opentelemetry-cpp",
)

Then I added "@opentelemetry-cpp//exporters/otlp:otlp_http_exporter" into deps in my BUILD file. I also tried experimenting with various strip_prefix and build_file rules, but the best outcome was an error no such package '@github_nlohmann_json//'.

May I ask for a help/guidance how to use opentelemetry-cpp as a dependency in a another bazel project? Reproducible example would be great.

Thank you in advance.

@lalitb
Copy link
Member

lalitb commented Oct 25, 2021

As mentioned here: https://github.com/open-telemetry/opentelemetry-cpp/blob/main/INSTALL.md#build-instructions-using-bazel, bazel support is experimental, so any contribution here to make it complete are welcome :) cc @jsuereth

@jlisee
Copy link

jlisee commented Oct 27, 2021

You need to call opentelemetry_cpp_deps from the bazel/repository.bzl

Your WORKSPACE file (if this snippet works it needs to be added to the INSTALL doc as listed above):

# https://github.com/open-telemetry/opentelemetry-cpp
new_git_repo
    name = "opentelemetry-cpp",
    commit = "096c08b6b6dbd8645eebdccc8c06b83fa7a50cd3",
    remote = "https://github.com/open-telemetry/opentelemetry-cpp",
)

load("@opentelemetry-cpp//bazel:repository.bzl", "opentelemetry_cpp_deps")

opentelemetry_cpp_deps()

Either that or pull in all the external repositories it needs yourself directly.

@lalitb
Copy link
Member

lalitb commented Oct 27, 2021

Thanks, @jlisee. This is how httpd instrumentation uses it too: https://github.com/open-telemetry/opentelemetry-cpp-contrib/blob/main/instrumentation/httpd/WORKSPACE. Will test it once, and update INSTALL doc.

@miiila
Copy link
Author

miiila commented Oct 28, 2021

@jlisee Thank you very much! I will try this as soon as I can and post results here.

@miiila
Copy link
Author

miiila commented Oct 29, 2021

@lalitb @jlisee I have some updates :-) First of all - thank you again @jlisee for your suggestions. Provided solution works with two caveats:

@lalitb
Copy link
Member

lalitb commented Oct 29, 2021

but I am bit scared by the CLA I need to sign and I want to check it more to understand what I am signing

@miiila - OpenTelemetry is hosted under CNCF ( https://www.cncf.io/, just like Kubernetes), and signing CLA is a pre-requisite for any contribution as a company, employee, or individual for CNCF hosted projects. As an individual, this is what you would sign for: https://github.com/cncf/cla/blob/master/individual-cla.pdf

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 a pull request may close this issue.

3 participants