Hi Lukas,
----- Lukas Berk <lberk@xxxxxxxxxx> wrote:
> Hi,
>
> Changes committed to git://git.pcp.io/lberk/pcp master
>
> Lukas Berk (1):
> pmdajson - support PM_SEM_COUNTER metrics
>
> qa/1052 | 48
> +++++++++++++++++++++++++++++++++--------
> qa/1052.out | 46 ++++++++++++++++++++++++++++++++++++++-
> src/pmdas/json/pmdajson.python | 36 ++++++++++++++++++++++++++++++
> 3 files changed, 120 insertions(+), 10 deletions(-)
>
Looks good to me - thanks. I think we'll need a README update
(src/pmdas/json/README that is) to document the new keyword(s)
too, and...
diff --git a/src/pmdas/json/pmdajson.python b/src/pmdas/json/pmdajson.python
index fdd5f45..dd36737 100644
--- a/src/pmdas/json/pmdajson.python
+++ b/src/pmdas/json/pmdajson.python
@@ -633,6 +633,24 @@ class JsonSource(object):
metric_info.units = value
#
+ # 'semantics' (optional): Type check and save it.
+ #
+ if 'semantics' in item:
[...]
+ if value == "instant":
+ metric_info.sem = c_api.PM_SEM_INSTANT
+ elif value == "counter" and metric_info.type !=
c_api.PM_TYPE_STRING:
+ metric_info.sem = c_api.PM_SEM_COUNTER
I suggest accepting "instantaneous" as a synonym for "instant"
and we may as well support "discrete" while you are in there?
Also, if someone wants a counter-semantics string, I'd just
let 'em (rather than silently dropping it) - we don't make a
restriction like that in the C/python APIs, *shrug* - it'd be
a pretty strange metric though.
cheers.
--
Nathan
|