andrzej-kaczmarek opened a new pull request #873: sys: Add framework for 
logging aggregated data for events
URL: https://github.com/apache/mynewt-core/pull/873
 
 
   This is proposed framework for logging aggregated data for events.
   
   The idea is simple: there is an event which has multiple metrics we want to 
log. Each metric is either a simple value (overwritten each time) or data 
series (appended each time). When event is (re)started each data logged from 
now on is aggregated internally. At the end of event its contents can be 
serialized using CBOR and written to mbuf for further processing or writing to 
logging subsystem (need to add append_mbuf API to logging for this). Now event 
can be restarted and this starts again.
   
   There is no limit for number of events other than memory capacity.
   There is tentative limit for number of metrics for each event (32) due to 
internal state variabled, but can be increased in future if necessary.
   
   There is sample app which shows intended usage, however there is one thing 
that needs more explanation. Once metrics are defined, each have name and value 
type, e.g.:
   ```
   METRICS_SECT_START(my_metrics)
       METRICS_SECT_ENTRY(val1, EVENT_METRIC_TYPE_SINGLE)
       METRICS_SECT_ENTRY(u8, EVENT_METRIC_TYPE_SERIES_U8)
       METRICS_SECT_ENTRY(u16, EVENT_METRIC_TYPE_SERIES_U16)
       METRICS_SECT_ENTRY(u32, EVENT_METRIC_TYPE_SERIES_U32)
   METRICS_SECT_END;
   ```
   For data series there are separate types for storing 8, 16 and 32-bit values 
since it does make difference in terms of memory usage. For single values it 
does not really matter so internally this is always stored as 32-bit value.
   The metric name is, unfortunately, only used for serializing and accessing 
it via e.g. shell (tbd) as it does not generate any symbol to actually pass it 
to APIs. Thus, APIs identify each metric by ordinal number - as defined, 
starting from 0. I'd really like to make this smarter, but without adding to 
much extra macros or need for additional definitions in user code - have no 
idea at the moment so any comments are welcome here. As a workaround, app can 
define a simple enum with symbols corresponding to each metric and since its 
auto-numbered from 0 it can be easily rearranged as required.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to