Replies: 1 comment
-
|
Das Problem scheint weniger an deiner Plugin-Struktur zu liegen, sondern eher daran, wie der Reflection-Schritt beim Build funktioniert. Offenbar wird der Runtime-Code während nexus build erneut geladen, wodurch prom-client versucht, dieselbe Metrik ein zweites Mal zu registrieren. Da der Registry-Mechanismus von prom-client doppelte Namen absichtlich verhindert, kommt es zum Fehler. Dein Singleton-Ansatz umgeht das zwar, aber langfristig wäre eine Prüfung sinnvoll, ob die Initialisierung der Metriken vom Plugin-Ladevorgang getrennt werden kann. Eine alternative Lösung wäre auch, vor der Registrierung zu prüfen, ob die Metrik bereits https://legianocasino-at.com/ existiert. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When authoring my haysclark/nexus-plugin-reporting-example I encountered an error when I stopped using
nexus devand tried usingnexus build.The reporting plugin I authored uses prom-client, which keeps track of all the Metric Names used, and validates that no string is re-used. Clearly the nexus:build starting reflection step is running the code a 2nd time, resulting in the error. Currently, I have workaround the issue by creating a Singleton object that contains all the reporting methods and injecting that instance into my
/lib/schema/index.tsfile. It works... but at its core, it's a hack to circumvent the build issue.Is this issue a limitation with the reflection build step that could be tweaked? Or am I doing something wrong with the way I structured my plug-in?
I have published the erroring code in the reflection-failed branch of my repo.
Cheers.
Beta Was this translation helpful? Give feedback.
All reactions