Description
I have a complex Haskell repo, with a stack.yaml
and lots of sub-projects. I'd like an easy way to enable this plugin for all of them at once, but that seems to mean editing all the .cabal
files to add -fplugin OpenTelemetry.Plugin
, which is a little unwieldy. It would be nice to find a simple way to turn the plugin on across the whole project.
FWIW, I tried just passing the necessary args all in stack.yaml
's ghc-options
like this:
ghc-options:
"$locals": >-
-plugin-package opentelemetry-plugin -fplugin OpenTelemetry.Plugin
but I wasn't able to get this to work. The approach I'm currently going with is to define a cabal flag -fopentelemetry
in every .cabal
file, which passes the necessary GHC options. Then I can flip it on for all projects in stack.yaml
as follows. This requires some boilerplate in every .cabal
file though.
configure-options:
"$locals":
- -fopentelemetry
This made me I wonder, maybe I could just leave the plugin enabled all the time? AFAIK the overhead is negligible, and the build still works--the only problem is that I get a bunch of HttpExceptionRequest Request { ... }
errors in the logs if I'm not running a collector. So I was thinking the plugin could just check if a collector is available at the beginning of the compilation run, and if not, just do nothing?
Activity