Skip to content

Commit

Permalink
Use destination service name in stackdriver metric label (envoyproxy#…
Browse files Browse the repository at this point in the history
…2502)

* use destination service name in stackdriver metric label

* add todo

* fix merge mistake
  • Loading branch information
bianpengyuan authored and istio-testing committed Nov 1, 2019
1 parent 6a8fc0d commit a1d4120
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions extensions/common/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void populateHTTPRequestInfo(bool outbound, RequestInfo* request_info) {
request_info->destination_service_host =
getHeaderMapValue(HeaderMapType::RequestHeaders, kAuthorityHeaderKey)
->toString();
// TODO: what is the proper fallback for destination service name?
} else {
// cluster name follows Istio convention, so extract out service name.
extractServiceName(request_info->destination_service_host,
Expand Down
4 changes: 2 additions & 2 deletions extensions/stackdriver/metric/record.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void record(bool is_outbound, const ::wasm::common::NodeInfo &local_node_info,
{serviceAuthenticationPolicyKey(),
::Wasm::Common::AuthenticationPolicyString(
request_info.service_auth_policy)},
{destinationServiceNameKey(), request_info.destination_service_host},
{destinationServiceNameKey(), request_info.destination_service_name},
{destinationServiceNamespaceKey(), peer_node_info.namespace_()},
{destinationPortKey(), std::to_string(request_info.destination_port)},
{responseCodeKey(), std::to_string(request_info.response_code)},
Expand All @@ -65,7 +65,7 @@ void record(bool is_outbound, const ::wasm::common::NodeInfo &local_node_info,
{serviceAuthenticationPolicyKey(),
::Wasm::Common::AuthenticationPolicyString(
request_info.service_auth_policy)},
{destinationServiceNameKey(), request_info.destination_service_host},
{destinationServiceNameKey(), request_info.destination_service_name},
{destinationServiceNamespaceKey(), local_node_info.namespace_()},
{destinationPortKey(), std::to_string(request_info.destination_port)},
{responseCodeKey(), std::to_string(request_info.response_code)},
Expand Down
2 changes: 1 addition & 1 deletion testdata/stackdriver/client_request_count.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ metric:
destination_owner: kubernetes://api/apps/v1/namespaces/default/deployment/ratings-v1
destination_port: '{{ .Vars.ServerPort }}'
destination_principal: "{{ .Vars.DestinationPrincipal }}"
destination_service_name: 127.0.0.1:{{ .Vars.ClientPort }}
destination_service_name: "" # TODO: destination name is not filled
destination_service_namespace: default
destination_workload_name: ratings-v1
destination_workload_namespace: default
Expand Down
2 changes: 1 addition & 1 deletion testdata/stackdriver/server_request_count.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ metric:
destination_owner: kubernetes://api/apps/v1/namespaces/default/deployment/ratings-v1
destination_port: '{{ .Vars.ServerPort }}'
destination_principal: "{{ .Vars.DestinationPrincipal }}"
destination_service_name: server.default.svc.cluster.local
destination_service_name: server
destination_service_namespace: default
destination_workload_name: ratings-v1
destination_workload_namespace: default
Expand Down

0 comments on commit a1d4120

Please sign in to comment.