blob: 3697c6f0e003d3193a7ed6cad87b3a593d356341 [file] [log] [blame]
Alistair Veitch4aaba752016-06-02 17:11:46 -07001/*
Jan Tattermusch7897ae92017-06-07 22:57:36 +02002 * Copyright 2016 gRPC authors.
Alistair Veitch4aaba752016-06-02 17:11:46 -07003 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Alistair Veitch4aaba752016-06-02 17:11:46 -07007 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02008 * http://www.apache.org/licenses/LICENSE-2.0
Alistair Veitch4aaba752016-06-02 17:11:46 -07009 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Alistair Veitch4aaba752016-06-02 17:11:46 -070015 *
16 */
17
Alistair Veitchf183ece2016-07-26 13:46:16 -070018#include "src/core/ext/census/base_resources.h"
Alistair Veitch0cf4def2016-06-07 08:59:30 -070019
Alistair Veitch4aaba752016-06-02 17:11:46 -070020#include <stdio.h>
21#include <string.h>
22
23#include <grpc/census.h>
24#include <grpc/support/log.h>
25
Alistair Veitchf183ece2016-07-26 13:46:16 -070026#include "src/core/ext/census/resource.h"
Alistair Veitch4aaba752016-06-02 17:11:46 -070027
28// Add base RPC resource definitions for use by RPC runtime.
29//
30// TODO(aveitch): All of these are currently hardwired definitions encoded in
31// the code in this file. These should be converted to use an external
32// configuration mechanism, in which these resources are defined in a text
33// file, which is compiled to .pb format and read by still-to-be-written
34// configuration functions.
35
Alistair Veitch4aaba752016-06-02 17:11:46 -070036// Define all base resources. This should be called by census initialization.
37void define_base_resources() {
Alistair Veitch0cf4def2016-06-07 08:59:30 -070038 google_census_Resource_BasicUnit numerator =
39 google_census_Resource_BasicUnit_SECS;
Yash Tibrewal9eb86722017-09-17 23:43:30 -070040 resource r = {(char *)"client_rpc_latency", // name
41 (char *)"Client RPC latency in seconds", // description
42 0, // prefix
43 1, // n_numerators
44 &numerator, // numerators
45 0, // n_denominators
46 NULL}; // denominators
Alistair Veitch0cf4def2016-06-07 08:59:30 -070047 define_resource(&r);
Yash Tibrewald8b84a22017-09-25 13:38:03 -070048 r = {(char *)"server_rpc_latency", // name
49 (char *)"Server RPC latency in seconds", // description
50 0, // prefix
51 1, // n_numerators
52 &numerator, // numerators
53 0, // n_denominators
54 NULL}; // denominators
Alistair Veitch0cf4def2016-06-07 08:59:30 -070055 define_resource(&r);
Alistair Veitch4aaba752016-06-02 17:11:46 -070056}