chromium/third_party/grpc/src/src/cpp/server/backend_metric_recorder.cc

//
// Copyright 2023 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#include "src/cpp/server/backend_metric_recorder.h"

#include <inttypes.h>

#include <functional>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>

#include <grpc/support/log.h>
#include <grpcpp/ext/call_metric_recorder.h>
#include <grpcpp/ext/server_metric_recorder.h>

#include "src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h"
#include "src/core/lib/debug/trace.h"

BackendMetricData;

namespace {
// All utilization values must be in [0, 1].
bool IsUtilizationValid(double utilization) {}

// QPS must be in [0, infy).
bool IsQpsValid(double qps) {}

grpc_core::TraceFlag grpc_backend_metric_trace(false, "backend_metric");
}  // namespace

namespace grpc {
namespace experimental {

std::unique_ptr<ServerMetricRecorder> ServerMetricRecorder::Create() {}

ServerMetricRecorder::ServerMetricRecorder()
    :{}

void ServerMetricRecorder::UpdateBackendMetricDataState(
    std::function<void(BackendMetricData*)> updater) {}

void ServerMetricRecorder::SetCpuUtilization(double value) {}

void ServerMetricRecorder::SetMemoryUtilization(double value) {}

void ServerMetricRecorder::SetQps(double value) {}

void ServerMetricRecorder::SetNamedUtilization(string_ref name, double value) {}

void ServerMetricRecorder::SetAllNamedUtilization(
    std::map<string_ref, double> named_utilization) {}

void ServerMetricRecorder::ClearCpuUtilization() {}

void ServerMetricRecorder::ClearMemoryUtilization() {}

void ServerMetricRecorder::ClearQps() {}

void ServerMetricRecorder::ClearNamedUtilization(string_ref name) {}

grpc_core::BackendMetricData ServerMetricRecorder::GetMetrics() const {}

std::shared_ptr<const ServerMetricRecorder::BackendMetricDataState>
ServerMetricRecorder::GetMetricsIfChanged() const {}

}  // namespace experimental

experimental::CallMetricRecorder&
BackendMetricState::RecordCpuUtilizationMetric(double value) {}

experimental::CallMetricRecorder&
BackendMetricState::RecordMemoryUtilizationMetric(double value) {}

experimental::CallMetricRecorder& BackendMetricState::RecordQpsMetric(
    double value) {}

experimental::CallMetricRecorder& BackendMetricState::RecordUtilizationMetric(
    string_ref name, double value) {}

experimental::CallMetricRecorder& BackendMetricState::RecordRequestCostMetric(
    string_ref name, double value) {}

BackendMetricData BackendMetricState::GetBackendMetricData() {}

}  // namespace grpc