-
Notifications
You must be signed in to change notification settings - Fork 5.4k
stats: make the stat name of endpoint configurable #45044
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,12 +186,20 @@ void HostUtility::forEachHostMetric( | |
|
|
||
| for (auto& host_set : cluster.prioritySet().hostSetsPerPriority()) { | ||
| for (auto& host : host_set->hosts()) { | ||
| absl::string_view endpoint_observability_name = host->observabilityName(); | ||
| Network::Address::InstanceConstSharedPtr address; | ||
| if (endpoint_observability_name.empty()) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a special case: LogicHost, whose address may be updated dynamically. That will not support the My plan is to remove logic host in the future because current default host implementation also could support multiple addresses. |
||
| // Only logic host will have empty observability name for now. | ||
| address = host->address(); | ||
| endpoint_observability_name = address->asStringView(); | ||
| } | ||
|
|
||
| Stats::TagVector tags; | ||
| tags.reserve(fixed_tags.size() + 3); | ||
| tags.insert(tags.end(), fixed_tags.begin(), fixed_tags.end()); | ||
| tags.emplace_back(Stats::Tag{Envoy::Config::TagNames::get().CLUSTER_NAME, cluster_name}); | ||
| tags.emplace_back(Stats::Tag{"envoy.endpoint_address", host->address()->asString()}); | ||
| tags.emplace_back( | ||
| Stats::Tag{"envoy.endpoint_address", std::string(endpoint_observability_name)}); | ||
|
|
||
| const auto& hostname = host->hostname(); | ||
| if (!hostname.empty()) { | ||
|
|
@@ -200,10 +208,9 @@ void HostUtility::forEachHostMetric( | |
|
|
||
| auto set_metric_metadata = [&](absl::string_view metric_name, | ||
| Stats::PrimitiveMetricMetadata& metric) { | ||
| metric.setName( | ||
| absl::StrCat("cluster.", cluster_name, ".endpoint.", | ||
| Stats::Utility::sanitizeStatsName(host->address()->asStringView()), | ||
| ".", metric_name)); | ||
| metric.setName(absl::StrCat( | ||
| "cluster.", cluster_name, ".endpoint.", | ||
| Stats::Utility::sanitizeStatsName(endpoint_observability_name), ".", metric_name)); | ||
| metric.setTagExtractedName(absl::StrCat("cluster.endpoint.", metric_name)); | ||
| metric.setTags(tags); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The per-endpoint stats export two labels: the ip:port, and the hostname (if present). Which of these is this overriding? Or is it replacing both of those with a 3rd tag? Please document whatever the behavior is clearly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.