pcp
[Top] [All Lists]

Re: [pcp] pcp updates: pmdajson counter metrics

To: Lukas Berk <lberk@xxxxxxxxxx>, David Smith <dsmith@xxxxxxxxxx>
Subject: Re: [pcp] pcp updates: pmdajson counter metrics
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Thu, 10 Dec 2015 00:58:27 -0500 (EST)
Cc: pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <87poyf59qh.fsf@xxxxxxxxxx>
References: <87poyf59qh.fsf@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: pd6vtWUdYLAAANhCZjKCX9WqzZvifQ==
Thread-topic: pcp updates: pmdajson counter metrics
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

<Prev in Thread] Current Thread [Next in Thread>