ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
578 stars 241 forks source link

opentelemetry-erlang not compiling properly #917

Closed SoniCoder closed 3 years ago

SoniCoder commented 3 years ago

Including opentelemetry-erlang (https://github.com/open-telemetry/opentelemetry-erlang) as a dependency using normal means doesn't result in the appropriate beams getting created. This maybe because it lacks the following feature mentioned in their README: Because the OpenTelemetry OTP Applications are kept in a single repository, under the directory apps, either rebar3's git_subdir (rebar 3.14 or above is required) or mix's sparse feature must be used when using as Git dependencies in a project. The blocks below shows how in rebar3 and mix the git repo for the API and/or SDK Applications can be used.

essen commented 3 years ago

It's not lacking, we've had this in Erlang.mk for a very long time, long before Rebar.

You're looking for the git-subfolder fetch method. Something like:

dep_opentelemetry = git-subfolder https://.... master apps/app_name

See https://erlang.mk/guide/deps.html#_fetch_methods for other fetch methods Erlang.mk supports.

SoniCoder commented 3 years ago

Thanks

jek-bao-choo commented 1 year ago

For anyone searching you could use hex to get all three libraries required. The below versions are tested with Erlang/OTP v22.

PROJECT = hello_world
PROJECT_DESCRIPTION = Cowboy Hello World example
PROJECT_VERSION = 2

DEPS = cowboy opentelemetry_api opentelemetry opentelemetry_exporter opentelemetry_cowboy
dep_cowboy_commit = master

# OpenTelemetry dependencies
dep_opentelemetry_api = hex 1.0.3
dep_opentelemetry = hex 1.0.5
dep_opentelemetry_exporter = hex 1.0.4
dep_opentelemetry_cowboy = hex 0.2.1

REL_DEPS = relx

include ./erlang.mk