summaryrefslogtreecommitdiffstats
path: root/metrics
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2018-10-04 11:35:34 +0000
committerArne Juul <arnej@yahoo-inc.com>2018-10-07 17:29:35 +0000
commit16c8199bfee0e9e27acef98700fd516451787ceb (patch)
treebace7169ab8f7f225347bbed1f83f5f3790df286 /metrics
parentf958dcf8bc346e883eaccde054b1d0e84da85688 (diff)
use repo for descriptions
Diffstat (limited to 'metrics')
-rw-r--r--metrics/src/vespa/metrics/metric.cpp15
-rw-r--r--metrics/src/vespa/metrics/metric.h8
2 files changed, 10 insertions, 13 deletions
diff --git a/metrics/src/vespa/metrics/metric.cpp b/metrics/src/vespa/metrics/metric.cpp
index 30d063dac1f..355957d11da 100644
--- a/metrics/src/vespa/metrics/metric.cpp
+++ b/metrics/src/vespa/metrics/metric.cpp
@@ -66,7 +66,7 @@ Metric::Metric(const String& name,
MetricSet* owner)
: _name(Repo::metricId(name)),
_mangledName(_name),
- _description(description),
+ _description(Repo::descriptionId(description)),
_tags(legacyTagStringToKeyedTags(tags)),
_owner(nullptr) // Set later by registry
{
@@ -81,7 +81,7 @@ Metric::Metric(const String& name,
MetricSet* owner)
: _name(Repo::metricId(name)),
_mangledName(_name),
- _description(description),
+ _description(Repo::descriptionId(description)),
_tags(std::move(dimensions)),
_owner(nullptr)
{
@@ -222,8 +222,7 @@ Metric::addMemoryUsage(MemoryConsumption& mc) const
{
++mc._metricCount;
mc._metricName += mc.getStringMemoryUsage(getName(), mc._metricNameUnique);
- mc._metricDescription += mc.getStringMemoryUsage(
- _description, mc._metricDescriptionUnique);
+ mc._metricDescription += mc.getStringMemoryUsage(getDescription(), mc._metricDescriptionUnique);
mc._metricTagCount += _tags.size();
// XXX figure out what we actually want to report from tags here...
// XXX we don't care about unique strings since they don't matter anymore.
@@ -232,13 +231,9 @@ Metric::addMemoryUsage(MemoryConsumption& mc) const
}
void
-Metric::updateNames(NameHash& hash) const
+Metric::updateNames(NameHash&) const
{
- Metric& m(const_cast<Metric&>(*this));
- hash.updateName(m._description);
- // Tags use vespalib::string which isn't refcounted under the hood and
- // use small string optimizations, meaning the implicit ref sharing hack
- // won't work for them anyway.
+ // not relevant anymore
}
void
diff --git a/metrics/src/vespa/metrics/metric.h b/metrics/src/vespa/metrics/metric.h
index a272c54a10f..c1adc15c28d 100644
--- a/metrics/src/vespa/metrics/metric.h
+++ b/metrics/src/vespa/metrics/metric.h
@@ -131,7 +131,7 @@ public:
}
vespalib::string getPath() const;
std::vector<String> getPathVector() const;
- const String& getDescription() const { return _description; }
+ const vespalib::string& getDescription() const { return Repo::description(_description); }
const Tags& getTags() const { return _tags; }
/** Return whether there exists a tag with a key equal to 'tag' */
bool hasTag(const String& tag) const;
@@ -223,7 +223,9 @@ public:
}
/** Used by sum metric to alter description of cloned metric for sum. */
- void setDescription(const String& d) { _description = d; }
+ void setDescription(const vespalib::string& d) {
+ _description = Repo::descriptionId(d);
+ }
/** Used by sum metric to alter tag of cloned metric for sum. */
void setTags(Tags tags) {
_tags = std::move(tags);
@@ -296,7 +298,7 @@ private:
protected:
MetricNameId _name;
MetricNameId _mangledName;
- String _description;
+ DescriptionId _description;
std::vector<Tag> _tags;
MetricSet* _owner;