aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/census.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc/census.h')
-rw-r--r--include/grpc/census.h99
1 files changed, 53 insertions, 46 deletions
diff --git a/include/grpc/census.h b/include/grpc/census.h
index f4130c7e6a..70d4f80efb 100644
--- a/include/grpc/census.h
+++ b/include/grpc/census.h
@@ -59,15 +59,15 @@ enum census_features {
* census_initialize() will return a non-zero value. It is an error to call
* census_initialize() more than once (without an intervening
* census_shutdown()). */
-int census_initialize(int features);
-void census_shutdown(void);
+CENSUS_API int census_initialize(int features);
+CENSUS_API void census_shutdown(void);
/** Return the features supported by the current census implementation (not all
* features will be available on all platforms). */
-int census_supported(void);
+CENSUS_API int census_supported(void);
/** Return the census features currently enabled. */
-int census_enabled(void);
+CENSUS_API int census_enabled(void);
/**
Context is a handle used by census to represent the current tracing and
@@ -90,8 +90,8 @@ typedef struct census_context census_context;
*
* TODO(aveitch): determine how best to communicate required/max buffer size
* so caller doesn't have to guess. */
-size_t census_context_serialize(const census_context *context, char *buffer,
- size_t buf_size);
+CENSUS_API size_t census_context_serialize(const census_context *context,
+ char *buffer, size_t buf_size);
/* Distributed traces can have a number of options. */
enum census_trace_mask_values {
@@ -101,10 +101,10 @@ enum census_trace_mask_values {
/** Get the current trace mask associated with this context. The value returned
will be the logical or of census_trace_mask_values values. */
-int census_trace_mask(const census_context *context);
+CENSUS_API int census_trace_mask(const census_context *context);
/** Set the trace mask associated with a context. */
-void census_set_trace_mask(int trace_mask);
+CENSUS_API void census_set_trace_mask(int trace_mask);
/* The concept of "operation" is a fundamental concept for Census. In an RPC
system, and operation typcially represents a single RPC, or a significant
@@ -152,7 +152,7 @@ typedef struct {
@return A timestamp representing the operation start time.
*/
-census_timestamp census_start_rpc_op_timestamp(void);
+CENSUS_API census_timestamp census_start_rpc_op_timestamp(void);
/**
Represent functions to map RPC name ID to service/method names. Census
@@ -204,7 +204,7 @@ typedef struct {
@return A new census context.
*/
-census_context *census_start_client_rpc_op(
+CENSUS_API census_context *census_start_client_rpc_op(
const census_context *context, int64_t rpc_name_id,
const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask,
const census_timestamp *start_time);
@@ -212,7 +212,8 @@ census_context *census_start_client_rpc_op(
/**
Add peer information to a context representing a client RPC operation.
*/
-void census_set_rpc_client_peer(census_context *context, const char *peer);
+CENSUS_API void census_set_rpc_client_peer(census_context *context,
+ const char *peer);
/**
Start a server RPC operation. Returns a new context to be used in future
@@ -232,7 +233,7 @@ void census_set_rpc_client_peer(census_context *context, const char *peer);
@return A new census context.
*/
-census_context *census_start_server_rpc_op(
+CENSUS_API census_context *census_start_server_rpc_op(
const char *buffer, int64_t rpc_name_id,
const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask,
census_timestamp *start_time);
@@ -262,8 +263,9 @@ census_context *census_start_server_rpc_op(
@return A new census context.
*/
-census_context *census_start_op(census_context *context, const char *family,
- const char *name, int trace_mask);
+CENSUS_API census_context *census_start_op(census_context *context,
+ const char *family, const char *name,
+ int trace_mask);
/**
End an operation started by any of the census_start_*_op*() calls. The
@@ -274,7 +276,7 @@ census_context *census_start_op(census_context *context, const char *family,
@param status status associated with the operation. Not interpreted by
census.
*/
-void census_end_op(census_context *context, int status);
+CENSUS_API void census_end_op(census_context *context, int status);
#define CENSUS_TRACE_RECORD_START_OP ((uint32_t)0)
#define CENSUS_TRACE_RECORD_END_OP ((uint32_t)1)
@@ -286,8 +288,8 @@ void census_end_op(census_context *context, int status);
@param buffer Pointer to buffer to use
@param n Number of bytes in buffer
*/
-void census_trace_print(census_context *context, uint32_t type,
- const char *buffer, size_t n);
+CENSUS_API void census_trace_print(census_context *context, uint32_t type,
+ const char *buffer, size_t n);
/** Trace record. */
typedef struct {
@@ -308,7 +310,7 @@ typedef struct {
while scanning is ongoing.
@returns 0 on success, non-zero on failure (e.g. if a scan is already ongoing)
*/
-int census_trace_scan_start(int consume);
+CENSUS_API int census_trace_scan_start(int consume);
/** Get a trace record. The data pointed to by the trace buffer is guaranteed
stable until the next census_get_trace_record() call (if the consume
@@ -319,10 +321,10 @@ int census_trace_scan_start(int consume);
census_trace_scan_start()), 0 if there is no more trace data (and
trace_record will not be modified) or 1 otherwise.
*/
-int census_get_trace_record(census_trace_record *trace_record);
+CENSUS_API int census_get_trace_record(census_trace_record *trace_record);
/** End a scan previously started by census_trace_scan_start() */
-void census_trace_scan_end();
+CENSUS_API void census_trace_scan_end();
/* A Census tag set is a collection of key:value string pairs; these form the
basis against which Census metrics will be recorded. Keys are unique within
@@ -392,16 +394,16 @@ typedef struct {
tag set and status of the tags used in its creation.
@return A new, valid census_tag_set.
*/
-census_tag_set *census_tag_set_create(
+CENSUS_API census_tag_set *census_tag_set_create(
const census_tag_set *base, const census_tag *tags, int ntags,
census_tag_set_create_status const **status);
/* Destroy a tag set created by census_tag_set_create(). Once this function
has been called, the tag set cannot be reused. */
-void census_tag_set_destroy(census_tag_set *tags);
+CENSUS_API void census_tag_set_destroy(census_tag_set *tags);
/* Get a pointer to the original status from the creation of this tag set. */
-const census_tag_set_create_status *census_tag_set_get_create_status(
+CENSUS_API const census_tag_set_create_status *census_tag_set_get_create_status(
const census_tag_set *tags);
/* Structure used for tag set iteration. API clients should not use or
@@ -416,18 +418,19 @@ typedef struct {
/* Initialize a tag set iterator. Must be called before first use of the
iterator. */
-void census_tag_set_initialize_iterator(const census_tag_set *tags,
- census_tag_set_iterator *iterator);
+CENSUS_API void census_tag_set_initialize_iterator(
+ const census_tag_set *tags, census_tag_set_iterator *iterator);
/* Get the contents of the "next" tag in the tag set. If there are no more
tags in the tag set, returns 0 (and 'tag' contents will be unchanged),
otherwise returns 1. */
-int census_tag_set_next_tag(census_tag_set_iterator *iterator, census_tag *tag);
+CENSUS_API int census_tag_set_next_tag(census_tag_set_iterator *iterator,
+ census_tag *tag);
/* Get a tag by its key. Returns 0 if the key is not present in the tag
set. */
-int census_tag_set_get_tag_by_key(const census_tag_set *tags, const char *key,
- census_tag *tag);
+CENSUS_API int census_tag_set_get_tag_by_key(const census_tag_set *tags,
+ const char *key, census_tag *tag);
/* Tag set encode/decode functionality. These functionas are intended
for use by RPC systems only, for purposes of transmitting/receiving tag
@@ -449,17 +452,19 @@ int census_tag_set_get_tag_by_key(const census_tag_set *tags, const char *key,
[buffer, buffer + *print_buf_size) and binary tags into
[returned-ptr, returned-ptr + *bin_buf_size) (and the return value
should be buffer + *print_buf_size) */
-char *census_tag_set_encode(const census_tag_set *tags, char *buffer,
- size_t buf_size, size_t *print_buf_size,
- size_t *bin_buf_size);
+CENSUS_API char *census_tag_set_encode(const census_tag_set *tags, char *buffer,
+ size_t buf_size, size_t *print_buf_size,
+ size_t *bin_buf_size);
/* Decode tag set buffers encoded with census_tag_set_encode_*(). Returns NULL
if there is an error in parsing either buffer. */
-census_tag_set *census_tag_set_decode(const char *buffer, size_t size,
- const char *bin_buffer, size_t bin_size);
+CENSUS_API census_tag_set *census_tag_set_decode(const char *buffer,
+ size_t size,
+ const char *bin_buffer,
+ size_t bin_size);
/* Get a contexts tag set. */
-census_tag_set *census_context_tag_set(census_context *context);
+CENSUS_API census_tag_set *census_context_tag_set(census_context *context);
/* Core stats collection API's. The following concepts are used:
* Aggregation: A collection of values. Census supports the following
@@ -490,8 +495,8 @@ typedef struct {
} census_value;
/* Record new usage values against the given context. */
-void census_record_values(census_context *context, census_value *values,
- size_t nvalues);
+CENSUS_API void census_record_values(census_context *context,
+ census_value *values, size_t nvalues);
/** Type representing a particular aggregation */
typedef struct census_aggregation_ops census_aggregation_ops;
@@ -521,24 +526,25 @@ typedef struct census_view census_view;
@return A new census view
*/
-census_view *census_view_create(uint32_t metric_id, const census_tag_set *tags,
- const census_aggregation *aggregations,
- size_t naggregations);
+CENSUS_API census_view *census_view_create(
+ uint32_t metric_id, const census_tag_set *tags,
+ const census_aggregation *aggregations, size_t naggregations);
/** Destroy a previously created view. */
-void census_view_delete(census_view *view);
+CENSUS_API void census_view_delete(census_view *view);
/** Metric ID associated with a view */
-size_t census_view_metric(const census_view *view);
+CENSUS_API size_t census_view_metric(const census_view *view);
/** Number of aggregations associated with view. */
-size_t census_view_naggregations(const census_view *view);
+CENSUS_API size_t census_view_naggregations(const census_view *view);
/** Get tags associated with view. */
-const census_tag_set *census_view_tags(const census_view *view);
+CENSUS_API const census_tag_set *census_view_tags(const census_view *view);
/** Get aggregation descriptors associated with a view. */
-const census_aggregation *census_view_aggregrations(const census_view *view);
+CENSUS_API const census_aggregation *census_view_aggregrations(
+ const census_view *view);
/** Holds all the aggregation data for a particular view instantiation. Forms
part of the data returned by census_view_data(). */
@@ -557,10 +563,11 @@ typedef struct {
@param view View from which to get data.
@return Full set of data for all aggregations for the view.
*/
-const census_view_data *census_view_get_data(const census_view *view);
+CENSUS_API const census_view_data *census_view_get_data(
+ const census_view *view);
/** Reset all view data to zero for the specified view */
-void census_view_reset(census_view *view);
+CENSUS_API void census_view_reset(census_view *view);
#ifdef __cplusplus
}