nix-otel icon indicating copy to clipboard operation
nix-otel copied to clipboard

wip: Add settings for the things that used to be env-vars

Open lf- opened this issue 3 years ago • 1 comments

broken since the settings don't seem to be applying properly.

@lheckemann

lf- avatar Oct 22 '22 13:10 lf-

So what's happening currently is, I think:

  • Nix reads config files
    • Plugins setting is loaded
    • nix-otel settings are loaded and not recognised
  • Plugin is loaded by initPlugins()
    • nix-otel plugin is loaded
      • [with the change I've made] OtelConfig is instantiated
      • GlobalConfig::Register is instantiated, registering settings
      • PluginInstance is instantiated, initialising the plugin
    • initPlugins reapplies unknown settings, leading to the settings being actually set

IOW, the instantiation of the plugin happens before the settings are available. We need a way to pass the parameters into the Rust side after initialisation -- and a way to deal with them not being available yet...

I'm extremely unfamiliar with Rust/C++ FFI. Additionally, I'm not sure there's any way in which Nix communicates to a plugin that settings are fully loaded, so we might even need to add a hook inside Nix for that :/

And as if that weren't already enough Fun, I think I've discovered a bug in Nix's settings handling as far as plugins and command-line options are given. Usually, command-line settings like --option otel-otlp-endpoint foo override settings in nix.conf. But apparently, they don't for settings defined by plugins!?

Maybe we should stick with environment variables.

lheckemann avatar Oct 24 '22 11:10 lheckemann