Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ void RequestContext::FillOperationInfo(service_control::OperationInfo *info) {
info->operation_name = kUnrecognizedOperation;
}
info->operation_id = operation_id_;
if (check_response_info_.is_api_key_valid) {
if (check_response_info_.is_api_key_valid &&
check_response_info_.service_is_activated) {
info->api_key = api_key_;
}
info->producer_project_id = service_context()->project_id();
Expand Down
15 changes: 7 additions & 8 deletions contrib/endpoints/src/api_manager/service_control/proto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -956,14 +956,13 @@ Status Proto::FillReportRequest(const ReportRequestInfo& info,
}
}

// Not to send consumer metrics for following cases:
// 1) api_key is not provided, or
// 2) the service is not activated for the consumer project,
bool send_consumer_metric = true;
if (info.api_key.empty() ||
!info.check_response_info.service_is_activated) {
send_consumer_metric = false;
}
// Not to send consumer metrics if api_key is empty.
// api_key is empty in one of following cases:
// 1) api_key is not provided,
// 2) api_key is invalid determined by the server from the Check call.
// 3) the service is not activated for the consumer project.
bool send_consumer_metric = !info.api_key.empty();

// Populate all metrics.
for (auto it = metrics_.begin(), end = metrics_.end(); it != end; it++) {
const SupportedMetric* m = *it;
Expand Down