MrAlias / otel-schema

Playground to prototype and investigate configuration schema proposals for OpenTelemetry
Apache License 2.0
2 stars 7 forks source link

Javascript configuration prototype #49

Open martinkuba opened 1 year ago

martinkuba commented 1 year ago

For this prototype, I have converted the yaml configuration file to JSON since it is easier to read in JS. There are various yaml libraries, so I can change it to yaml if needed.

For dynamic loading of modules, I have used the import() function. It is an async operation, which means that applying the configuration would by async. This in turn means that potentially some data may be missed during startup (if the app creates spans/metrics/logs immediately on startup). Alternatively, we could use require(), which is a synchronous call.

The mapping of processor/exporter/etc. names to packages/classes will have to be hard-coded (or mapped somewhere).