blob: b38c076f3891ef597491ce690c81a9f1c88d6a3b [file] [log] [blame]
Mark D. Roth09e458c2017-05-02 08:13:26 -07001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2017 gRPC authors.
Mark D. Roth09e458c2017-05-02 08:13:26 -07004 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Mark D. Roth09e458c2017-05-02 08:13:26 -07008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
Mark D. Roth09e458c2017-05-02 08:13:26 -070010 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
Mark D. Roth09e458c2017-05-02 08:13:26 -070016 *
17 */
18
19#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H
20#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H
21
22#include <stdbool.h>
23
24#include <grpc/impl/codegen/grpc_types.h>
25
Yash Tibrewala7e6d652017-09-20 18:56:37 -070026#ifdef __cplusplus
27extern "C" {
28#endif
29
Mark D. Roth09e458c2017-05-02 08:13:26 -070030typedef struct grpc_grpclb_client_stats grpc_grpclb_client_stats;
31
Mark D. Rothe7751802017-07-27 12:31:45 -070032typedef struct {
33 char* token;
34 int64_t count;
35} grpc_grpclb_drop_token_count;
36
37typedef struct {
38 grpc_grpclb_drop_token_count* token_counts;
39 size_t num_entries;
40} grpc_grpclb_dropped_call_counts;
41
Mark D. Roth09e458c2017-05-02 08:13:26 -070042grpc_grpclb_client_stats* grpc_grpclb_client_stats_create();
43grpc_grpclb_client_stats* grpc_grpclb_client_stats_ref(
44 grpc_grpclb_client_stats* client_stats);
45void grpc_grpclb_client_stats_unref(grpc_grpclb_client_stats* client_stats);
46
47void grpc_grpclb_client_stats_add_call_started(
48 grpc_grpclb_client_stats* client_stats);
49void grpc_grpclb_client_stats_add_call_finished(
Mark D. Roth09e458c2017-05-02 08:13:26 -070050 bool finished_with_client_failed_to_send, bool finished_known_received,
51 grpc_grpclb_client_stats* client_stats);
52
Mark D. Rothe7751802017-07-27 12:31:45 -070053// This method is not thread-safe; caller must synchronize.
54void grpc_grpclb_client_stats_add_call_dropped_locked(
55 char* token, grpc_grpclb_client_stats* client_stats);
56
57// This method is not thread-safe; caller must synchronize.
58void grpc_grpclb_client_stats_get_locked(
Mark D. Roth09e458c2017-05-02 08:13:26 -070059 grpc_grpclb_client_stats* client_stats, int64_t* num_calls_started,
60 int64_t* num_calls_finished,
Mark D. Roth09e458c2017-05-02 08:13:26 -070061 int64_t* num_calls_finished_with_client_failed_to_send,
Mark D. Rothe7751802017-07-27 12:31:45 -070062 int64_t* num_calls_finished_known_received,
63 grpc_grpclb_dropped_call_counts** drop_token_counts);
64
65void grpc_grpclb_dropped_call_counts_destroy(
66 grpc_grpclb_dropped_call_counts* drop_entries);
Mark D. Roth09e458c2017-05-02 08:13:26 -070067
Yash Tibrewala7e6d652017-09-20 18:56:37 -070068#ifdef __cplusplus
69}
70#endif
71
Mark D. Roth09e458c2017-05-02 08:13:26 -070072#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H \
73 */