This effectively solves the issue reported by Nathan last week, where:
pminfo -f -a qa/archives/rattle
reports a bunch of errors due to the operands of globally defined derived
metrics being not present in the archive. See the detailed commit message below.
Ideally this would have been reviewed by Ken, but he's currently away. Nathan
and I a pretty confident this approach is a good solution, so I've committed
the patch to master, along with a bunch of associated QA updates.
Changes committed to git://git.pcp.io/pcp.git master
Mark Goodwin (2):
libpcp: omit invalid derived metrics in pmGetChildren for current context
qa: updates for new derived metrics diags
qa/225.out | 115 +++++++++++++++++++++++++++---------------------
qa/247.out | 57 ++++++++++-------------
qa/249.out | 71 +++++++++++++++++++++++++++++
qa/260.out | 6 ++
qa/263.out | 44 +++++++++++++++++-
qa/275.out | 23 ++++++++-
qa/334.out | 5 ++
qa/351.out | 1
qa/407.out | 7 --
qa/431.out | 8 ---
qa/773.out | 4 +
src/libpcp/src/derive.c | 98 +++++++++++++++++++++++++++++++++-------
src/libpcp/src/derive.h | 6 +-
src/libpcp/src/pmns.c | 14 ++---
14 files changed, 332 insertions(+), 127 deletions(-)
Details ...
commit 601234b7abb0f7e74b46ec43b18784ba6248d917
Author: Mark Goodwin <mgoodwin@xxxxxxxxxx>
Date: Mon Apr 25 22:32:54 2016 +1000
qa: updates for new derived metrics diags
Updated : qa/225.out qa/247.out qa/249.out qa/260.out qa/263.out
qa/275.out qa/334.out qa/351.out qa/407.out qa/431.out qa/773.out
commit 4a99f57b7c69e9d4680faff1ae7f1d750d791d59
Author: Mark Goodwin <mgoodwin@xxxxxxxxxx>
Date: Mon Apr 25 21:48:26 2016 +1000
libpcp: omit invalid derived metrics in pmGetChildren for current context
Derived metrics can be invalid for several reasons, most commonly
when one or more operands are unavailable from the current context
(especially with archives that do not contain the required operand
metrics). For example: pminfo -f -a qa/archives/rattle
returns errors for the globally defined derived metrics whose
operand metrics are not present in that archive.
This patch adds the current context from pmGetChildren() as a new
parameter to the call to __dmchildren(), thus allowing __dmchildren
to check for missing or invalid operands (which have expr == NULL)
in the per-context control structure for each derived metric.
Therefore we can effectively omit invalid derived metrics from the
pmns for each context. We do the same for pmTraversePMNS() with
it's call to __dmtraverse.
For the case where pmGetChildren() or pmTraversePMNS() has been
called from the PMCS (e.g. by pmcd where __pmGetInternalState()
== PM_STATE_PMCS), pmGetChildren omits all derived metrics in
the returned offspring.
For the case where pmGetChildren() or pmTraversePMNS() is called
without a current context, we only include anon derived metrics,
which are present in the global 'registered' control structure
and assumed to be always valid (e.g. event.missed, etc).
This patch also adds some additional pmDebug | TRACE_DERIVED
diagnostics, e.g. when an invalid derived metric is omitted from
the offspring returned by pmGetChildren or pmTraversePMNS, and
so there are associated QA updates following in the next commit.
modified: src/libpcp/src/derive.c
modified: src/libpcp/src/derive.h
modified: src/libpcp/src/pmns.c
|