Skip to content

Commit

Permalink
Issue #22 - Fall back to long/short text is short/long text is not av…
Browse files Browse the repository at this point in the history
…ailable.
  • Loading branch information
pcolby committed May 9, 2014
1 parent 88f3415 commit 80dbeec
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions include/pcp-cpp/pmda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,12 +1135,15 @@ class pmda {
virtual int on_text(int ident, int type, char **buffer, pmdaExt *pmda)
{
try {
const bool oneLine = ((type & PM_TEXT_ONELINE) == PM_TEXT_ONELINE);
const bool get_one_line = ((type & PM_TEXT_ONELINE) == PM_TEXT_ONELINE);
if ((type & PM_TEXT_PMID) == PM_TEXT_PMID) {
const metric_description &description =
supported_metrics.at(pmid_cluster(ident)).at(pmid_item(ident));
const std::string &text =
oneLine
const std::string &text = get_one_line
? description.short_description.empty()
? description.verbose_description
: description.short_description
: description.verbose_description.empty()
? description.short_description
: description.verbose_description;
if (text.empty()) {
Expand All @@ -1151,8 +1154,11 @@ class pmda {
} else if ((type & PM_TEXT_INDOM) == PM_TEXT_INDOM) {
const pcp::instance_info &info =
instance_domains.at(pmInDom_domain(ident))->at(pmInDom_serial(ident));
const std::string &text =
oneLine
const std::string &text = get_one_line
? info.short_description.empty()
? info.verbose_description
: info.short_description
: info.verbose_description.empty()
? info.short_description
: info.verbose_description;
if (text.empty()) {
Expand Down

0 comments on commit 80dbeec

Please sign in to comment.