Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 3 | * Copyright 2017 gRPC authors. |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 4 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 5 | * 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. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 8 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 10 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 11 | * 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. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 16 | * |
| 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 Tibrewal | a7e6d65 | 2017-09-20 18:56:37 -0700 | [diff] [blame] | 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 30 | typedef struct grpc_grpclb_client_stats grpc_grpclb_client_stats; |
| 31 | |
Mark D. Roth | e775180 | 2017-07-27 12:31:45 -0700 | [diff] [blame] | 32 | typedef struct { |
| 33 | char* token; |
| 34 | int64_t count; |
| 35 | } grpc_grpclb_drop_token_count; |
| 36 | |
| 37 | typedef struct { |
| 38 | grpc_grpclb_drop_token_count* token_counts; |
| 39 | size_t num_entries; |
| 40 | } grpc_grpclb_dropped_call_counts; |
| 41 | |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 42 | grpc_grpclb_client_stats* grpc_grpclb_client_stats_create(); |
| 43 | grpc_grpclb_client_stats* grpc_grpclb_client_stats_ref( |
| 44 | grpc_grpclb_client_stats* client_stats); |
| 45 | void grpc_grpclb_client_stats_unref(grpc_grpclb_client_stats* client_stats); |
| 46 | |
| 47 | void grpc_grpclb_client_stats_add_call_started( |
| 48 | grpc_grpclb_client_stats* client_stats); |
| 49 | void grpc_grpclb_client_stats_add_call_finished( |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 50 | bool finished_with_client_failed_to_send, bool finished_known_received, |
| 51 | grpc_grpclb_client_stats* client_stats); |
| 52 | |
Mark D. Roth | e775180 | 2017-07-27 12:31:45 -0700 | [diff] [blame] | 53 | // This method is not thread-safe; caller must synchronize. |
| 54 | void 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. |
| 58 | void grpc_grpclb_client_stats_get_locked( |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 59 | grpc_grpclb_client_stats* client_stats, int64_t* num_calls_started, |
| 60 | int64_t* num_calls_finished, |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 61 | int64_t* num_calls_finished_with_client_failed_to_send, |
Mark D. Roth | e775180 | 2017-07-27 12:31:45 -0700 | [diff] [blame] | 62 | int64_t* num_calls_finished_known_received, |
| 63 | grpc_grpclb_dropped_call_counts** drop_token_counts); |
| 64 | |
| 65 | void grpc_grpclb_dropped_call_counts_destroy( |
| 66 | grpc_grpclb_dropped_call_counts* drop_entries); |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 67 | |
Yash Tibrewal | a7e6d65 | 2017-09-20 18:56:37 -0700 | [diff] [blame] | 68 | #ifdef __cplusplus |
| 69 | } |
| 70 | #endif |
| 71 | |
Mark D. Roth | 09e458c | 2017-05-02 08:13:26 -0700 | [diff] [blame] | 72 | #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H \ |
| 73 | */ |