Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic exporters for smartpireadout
#8
(10.05.2017, 21:57)TriCX Wrote: In my opinion readout.go should be kept clean and short.
Putting the implementation of data exporters into this file blows up and creates a mess.
It should be separated into different files.
Then we need some functions to call.
I belief we can manage to define an interface, which fits it all
- at least for periodic data publication.

The interface may introduce a slice to handle an undefined number of data elements.
Each data element itself (currently voltages, currents, and so on) could be represented by a struct.
This struct contains all relevant data, such as
- value
- unit
- tmie series or accumulated flag
- accuracy
- whatever

Best,
TriCX

Sure, but did you look at the patch I linked that does move the Prometheus changes out to a separate file?

As far as defining a struct that represents all the data, I totally agree, I've been thinking about this design a bit, and have already refactored much of the ReadoutValues() function such that it will be much easier to change the return function, or simply drop the ReadoutValues() function entirely.

I've also been thinking about changing the way the main readout.go loop works.  Rather than sample the data every 5 seconds, we can reduce that to a 1 second loop, and each exporter can select how often it wants to get updates.
Reply


Messages In This Thread
RE: Dynamic exporters for smartpireadout - by SuperQ - 10.05.2017, 22:53

Forum Jump:


Users browsing this thread: 2 Guest(s)