iand675 / hs-opentelemetry

OpenTelemetry support for the Haskell programming language
https://iankduncan.com/projects/opentelemetry
BSD 3-Clause "New" or "Revised" License
73 stars 34 forks source link

Avoid build-time code generation #158

Closed michaelpj closed 3 days ago

michaelpj commented 1 week ago

I think we should seriously consider avoiding any build-time code generation. At the moment that's mostly hs-opentelemetry-otlp, but there is also https://github.com/iand675/hs-opentelemetry/pull/142 which I think is desirable.

Why?

  1. It requires custom setups. Custom setups are generally harder for tooling to deal with, cost you parallelism, etc. The general feeling of the cabal developers is that they wish they didn't exist :joy:
  2. It puts more requirements onto our users. Notably, currently users need to have protoc around in order to build hs-opentelemetry-otlp. Cabal does not know this, it is quite opaque to users.

There is an easy way to avoid this: just do the codegen manually and check in the result. It's ugly, and involves checking in generated code, but it's robust and not too painful if the input doesn't change that often (which I don't think it does).

I also note that the last release of hs-opentelemetry-otlp did not use a custom setup, so this is going to be a new breaking requirement for our users. We already have people complaining about that.

Overall, I would prefer to revert https://github.com/iand675/hs-opentelemetry/pull/122 before we release, and ideally commit to not doing this in the future.

cc @iand675 and @evanlauer1 , who are likely to have opinions.

michaelpj commented 5 days ago

@marinelli has a PR up reverting to checked in generated code. I'll leave it a while in case anyone has any objections, otherwise I'll merge that.

develop7 commented 4 days ago

There is an easy way to avoid this: just do the codegen manually and check in the result. It's ugly, and involves checking in generated code, but it's robust and not too painful if the input doesn't change that often (which I don't think it does).

Did a quick glance at https://github.com/open-telemetry/opentelemetry-proto/commits/main/ and it gets updated every few months or so, which doesn't seem often enough to warrant a custom setup.

michaelpj commented 3 days ago

We're back to manual generation for now.