aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--build.json2
-rw-r--r--include/grpc/census.h12
-rw-r--r--src/core/census/record_stat.c6
-rw-r--r--src/core/census/rpc_stat_id.h (renamed from src/core/census/resource_id.h)24
4 files changed, 25 insertions, 19 deletions
diff --git a/build.json b/build.json
index a1104c6d88..9bb27d7579 100644
--- a/build.json
+++ b/build.json
@@ -19,7 +19,7 @@
],
"headers": [
"src/core/census/context.h",
- "src/core/census/resource_id.h"
+ "src/core/census/rpc_stat_id.h"
],
"src": [
"src/core/census/context.c",
diff --git a/include/grpc/census.h b/include/grpc/census.h
index 9271d4f6a7..379783905a 100644
--- a/include/grpc/census.h
+++ b/include/grpc/census.h
@@ -100,8 +100,16 @@ int census_context_deserialize(const char *buffer, census_context **context);
* future census calls will result in undefined behavior. */
void census_context_destroy(census_context *context);
-/* Record a new value against the given stats ID and context. */
-void census_record_stat(census_context *context, int resource_id, double value);
+/* A census statistic to be recorded comprises two parts: an ID for the
+ * 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
}
diff --git a/src/core/census/record_stat.c b/src/core/census/record_stat.c
index 7d5a350c49..3dd918618b 100644
--- a/src/core/census/record_stat.c
+++ b/src/core/census/record_stat.c
@@ -32,7 +32,7 @@
*/
#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,
- double value) {}
+void census_record_stat(census_context *context, census_stat *stats,
+ size_t nstats) {}
diff --git a/src/core/census/resource_id.h b/src/core/census/rpc_stat_id.h
index 89c31df311..fc0aa6f43f 100644
--- a/src/core/census/resource_id.h
+++ b/src/core/census/rpc_stat_id.h
@@ -31,18 +31,16 @@
*
*/
-#ifndef CENSUS_RESOURCE_ID_H
-#define CENSUS_RESOURCE_ID_H
+#ifndef CENSUS_RPC_STAT_ID_H
+#define CENSUS_RPC_STAT_ID_H
-/* Resource ID's used for census measurements. */
-#define RESOURCE_INVALID 0 /* Make default be invalid. */
-#define RESOURCE_RPC_CLIENT_REQUESTS 1 /* Count of client requests sent. */
-#define RESOURCE_RPC_SERVER_REQUESTS 2 /* Count of server requests sent. */
-#define RESOURCE_RPC_CLIENT_ERRORS 3 /* Client error counts. */
-#define RESOURCE_RPC_SERVER_ERRORS 4 /* Server error counts. */
-#define RESOURCE_RPC_CLIENT_LATENCY 5 /* Client side request latency. */
-#define RESOURCE_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. */
+/* Stats ID's used for RPC measurements. */
+#define CENSUS_INVALID_STAT_ID 0 /* ID 0 is always invalid */
+#define CENSUS_RPC_CLIENT_REQUESTS 1 /* Count of client requests sent. */
+#define CENSUS_RPC_SERVER_REQUESTS 2 /* Count of server requests sent. */
+#define CENSUS_RPC_CLIENT_ERRORS 3 /* Client error counts. */
+#define CENSUS_RPC_SERVER_ERRORS 4 /* Server error counts. */
+#define CENSUS_RPC_CLIENT_LATENCY 5 /* Client side request latency. */
+#define CENSUS_RPC_SERVER_LATENCY 6 /* Server side request latency. */
-#endif /* CENSUS_RESOURCE_ID_H */
+#endif /* CENSUS_RPC_STAT_ID_H */