address comments

pull/2493/head
Alistair Veitch 9 years ago
parent 635899d062
commit 851032a7ae
  1. 2
      build.json
  2. 12
      include/grpc/census.h
  3. 6
      src/core/census/record_stat.c
  4. 24
      src/core/census/rpc_stat_id.h

@ -19,7 +19,7 @@
], ],
"headers": [ "headers": [
"src/core/census/context.h", "src/core/census/context.h",
"src/core/census/resource_id.h" "src/core/census/rpc_stat_id.h"
], ],
"src": [ "src": [
"src/core/census/context.c", "src/core/census/context.c",

@ -100,8 +100,16 @@ int census_context_deserialize(const char *buffer, census_context **context);
* future census calls will result in undefined behavior. */ * future census calls will result in undefined behavior. */
void census_context_destroy(census_context *context); void census_context_destroy(census_context *context);
/* Record a new value against the given stats ID and context. */ /* A census statistic to be recorded comprises two parts: an ID for the
void census_record_stat(census_context *context, int resource_id, double value); * particular statistic and the value to be recorded against it. */
typedef struct {
int id;
double value;
} census_stat;
/* Record new stats against the given context. */
void census_record_stat(census_context *context, census_stat *stats,
size_t nstats);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -32,7 +32,7 @@
*/ */
#include <grpc/census.h> #include <grpc/census.h>
#include "src/core/census/resource_id.h" #include "src/core/census/rpc_stat_id.h"
void census_record_stat(census_context *context, int resource_id, void census_record_stat(census_context *context, census_stat *stats,
double value) {} size_t nstats) {}

@ -31,18 +31,16 @@
* *
*/ */
#ifndef CENSUS_RESOURCE_ID_H #ifndef CENSUS_RPC_STAT_ID_H
#define CENSUS_RESOURCE_ID_H #define CENSUS_RPC_STAT_ID_H
/* Resource ID's used for census measurements. */ /* Stats ID's used for RPC measurements. */
#define RESOURCE_INVALID 0 /* Make default be invalid. */ #define CENSUS_INVALID_STAT_ID 0 /* ID 0 is always invalid */
#define RESOURCE_RPC_CLIENT_REQUESTS 1 /* Count of client requests sent. */ #define CENSUS_RPC_CLIENT_REQUESTS 1 /* Count of client requests sent. */
#define RESOURCE_RPC_SERVER_REQUESTS 2 /* Count of server requests sent. */ #define CENSUS_RPC_SERVER_REQUESTS 2 /* Count of server requests sent. */
#define RESOURCE_RPC_CLIENT_ERRORS 3 /* Client error counts. */ #define CENSUS_RPC_CLIENT_ERRORS 3 /* Client error counts. */
#define RESOURCE_RPC_SERVER_ERRORS 4 /* Server error counts. */ #define CENSUS_RPC_SERVER_ERRORS 4 /* Server error counts. */
#define RESOURCE_RPC_CLIENT_LATENCY 5 /* Client side request latency. */ #define CENSUS_RPC_CLIENT_LATENCY 5 /* Client side request latency. */
#define RESOURCE_RPC_SERVER_LATENCY 6 /* Server side request latency. */ #define CENSUS_RPC_SERVER_LATENCY 6 /* Server side request latency. */
#define RESOURCE_RPC_CLIENT_CPU 7 /* Client CPU processing time. */
#define RESOURCE_RPC_SERVER_CPU 8 /* Server CPU processing time. */
#endif /* CENSUS_RESOURCE_ID_H */ #endif /* CENSUS_RPC_STAT_ID_H */
Loading…
Cancel
Save