Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add owner tag to generic spectator metrics #77

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The number of measurements that have either been sent to an Atlas backend or dro

* `id`: One of `sent` or `dropped`.
* `error`: The type of error that occurred, one of `http-error`, `validation`, or `other`.
* `owner`: `spectatord`
* Common Infrastructure

### spectator.registrySize
Expand All @@ -20,6 +21,7 @@ The number of measurements stored in the registry.

**Dimensions:**

* `owner`: `spectatord`
* Common Infrastructure

### spectatord.parsedCount
Expand Down
1 change: 1 addition & 0 deletions spectator/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace detail {
template <typename R>
auto get_counter(R* registry, Tags tags) -> std::shared_ptr<Counter> {
static constexpr auto kSpectatorMeasurements = "spectator.measurements";
tags.add("owner", "spectatord");
return registry->GetCounter(kSpectatorMeasurements, std::move(tags));
}
} // namespace detail
Expand Down
2 changes: 1 addition & 1 deletion spectator/registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Registry::Registry(std::unique_ptr<Config> config,
meter_ttl_{absl::ToInt64Nanoseconds(config->meter_ttl)},
config_{std::move(config)},
logger_{std::move(logger)},
registry_size_{GetDistributionSummary("spectator.registrySize")},
registry_size_{GetDistributionSummary("spectator.registrySize", Tags{{"owner", "spectatord"}})},
publisher_(this) {
if (meter_ttl_ == 0) {
meter_ttl_ = int64_t(15) * 60 * 1000 * 1000 * 1000;
Expand Down
2 changes: 1 addition & 1 deletion spectator/registry_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ TEST(Registry, DistSummary_Size) {
r.GetCounter("bar")->Increment();
// we have 4 measurements from the timer + 1 from the counter
r.Measurements();
EXPECT_DOUBLE_EQ(r.GetDistributionSummary("spectator.registrySize")->TotalAmount(), 5.0);
EXPECT_DOUBLE_EQ(r.GetDistributionSummary("spectator.registrySize", Tags{{"owner", "spectatord"}})->TotalAmount(), 5.0);
}

TEST(Registry, DeleteMeters) {
Expand Down