Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
2e6c1822
Commit
2e6c1822
authored
9 years ago
by
Alistair Veitch
Browse files
Options
Downloads
Patches
Plain Diff
add missing CENSUS_API annotations
parent
75d5c0f0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/grpc/census.h
+53
-45
53 additions, 45 deletions
include/grpc/census.h
with
53 additions
and
45 deletions
include/grpc/census.h
+
53
−
45
View file @
2e6c1822
...
@@ -59,15 +59,15 @@ enum census_features {
...
@@ -59,15 +59,15 @@ enum census_features {
* census_initialize() will return a non-zero value. It is an error to call
* census_initialize() will return a non-zero value. It is an error to call
* census_initialize() more than once (without an intervening
* census_initialize() more than once (without an intervening
* census_shutdown()). */
* census_shutdown()). */
int
census_initialize
(
int
features
);
CENSUS_API
int
census_initialize
(
int
features
);
void
census_shutdown
(
void
);
CENSUS_API
void
census_shutdown
(
void
);
/** Return the features supported by the current census implementation (not all
/** Return the features supported by the current census implementation (not all
* features will be available on all platforms). */
* features will be available on all platforms). */
int
census_supported
(
void
);
CENSUS_API
int
census_supported
(
void
);
/** Return the census features currently enabled. */
/** Return the census features currently enabled. */
int
census_enabled
(
void
);
CENSUS_API
int
census_enabled
(
void
);
/**
/**
A Census Context is a handle used by Census to represent the current tracing
A Census Context is a handle used by Census to represent the current tracing
...
@@ -145,16 +145,16 @@ typedef struct {
...
@@ -145,16 +145,16 @@ typedef struct {
tags used in its creation.
tags used in its creation.
@return A new, valid census_context.
@return A new, valid census_context.
*/
*/
census_context
*
census_context_create
(
const
census_context
*
base
,
CENSUS_API
census_context
*
census_context_create
(
const
census_tag
*
tags
,
int
ntags
,
const
census_context
*
base
,
const
census_tag
*
tags
,
int
ntags
,
census_context_status
const
**
status
);
census_context_status
const
**
status
);
/* Destroy a context. Once this function has been called, the context cannot
/* Destroy a context. Once this function has been called, the context cannot
be reused. */
be reused. */
void
census_context_destroy
(
census_context
*
context
);
CENSUS_API
void
census_context_destroy
(
census_context
*
context
);
/* Get a pointer to the original status from the context creation. */
/* Get a pointer to the original status from the context creation. */
const
census_context_status
*
census_context_get_status
(
CENSUS_API
const
census_context_status
*
census_context_get_status
(
const
census_context
*
context
);
const
census_context
*
context
);
/* Structure used for iterating over the tegs in a context. API clients should
/* Structure used for iterating over the tegs in a context. API clients should
...
@@ -168,17 +168,18 @@ typedef struct {
...
@@ -168,17 +168,18 @@ typedef struct {
}
census_context_iterator
;
}
census_context_iterator
;
/* Initialize a census_tag_iterator. Must be called before first use. */
/* Initialize a census_tag_iterator. Must be called before first use. */
void
census_context_initialize_iterator
(
const
census_context
*
context
,
CENSUS_API
void
census_context_initialize_iterator
(
census_context_iterator
*
iterator
);
const
census_context
*
context
,
census_context_iterator
*
iterator
);
/* Get the contents of the "next" tag in the context. If there are no more
/* Get the contents of the "next" tag in the context. If there are no more
tags, returns 0 (and 'tag' contents will be unchanged), otherwise returns 1.
tags, returns 0 (and 'tag' contents will be unchanged), otherwise returns 1.
*/
*/
int
census_context_next_tag
(
census_context_iterator
*
iterator
,
census_tag
*
tag
);
CENSUS_API
int
census_context_next_tag
(
census_context_iterator
*
iterator
,
census_tag
*
tag
);
/* Get a context tag by key. Returns 0 if the key is not present. */
/* Get a context tag by key. Returns 0 if the key is not present. */
int
census_context_get_tag
(
const
census_context
*
context
,
const
char
*
key
,
CENSUS_API
int
census_context_get_tag
(
const
census_context
*
context
,
census_tag
*
tag
);
const
char
*
key
,
census_tag
*
tag
);
/* Tag set encode/decode functionality. These functionas are intended
/* Tag set encode/decode functionality. These functionas are intended
for use by RPC systems only, for purposes of transmitting/receiving contexts.
for use by RPC systems only, for purposes of transmitting/receiving contexts.
...
@@ -200,14 +201,17 @@ int census_context_get_tag(const census_context *context, const char *key,
...
@@ -200,14 +201,17 @@ int census_context_get_tag(const census_context *context, const char *key,
[buffer, buffer + *print_buf_size) and binary tags into
[buffer, buffer + *print_buf_size) and binary tags into
[returned-ptr, returned-ptr + *bin_buf_size) (and the returned
[returned-ptr, returned-ptr + *bin_buf_size) (and the returned
pointer should be buffer + *print_buf_size) */
pointer should be buffer + *print_buf_size) */
char
*
census_context_encode
(
const
census_context
*
context
,
char
*
buffer
,
CENSUS_API
char
*
census_context_encode
(
const
census_context
*
context
,
size_t
buf_size
,
size_t
*
print_buf_size
,
char
*
buffer
,
size_t
buf_size
,
size_t
*
bin_buf_size
);
size_t
*
print_buf_size
,
size_t
*
bin_buf_size
);
/* Decode context buffers encoded with census_context_encode(). Returns NULL
/* Decode context buffers encoded with census_context_encode(). Returns NULL
if there is an error in parsing either buffer. */
if there is an error in parsing either buffer. */
census_context
*
census_context_decode
(
const
char
*
buffer
,
size_t
size
,
CENSUS_API
census_context
*
census_context_decode
(
const
char
*
buffer
,
const
char
*
bin_buffer
,
size_t
bin_size
);
size_t
size
,
const
char
*
bin_buffer
,
size_t
bin_size
);
/* Distributed traces can have a number of options. */
/* Distributed traces can have a number of options. */
enum
census_trace_mask_values
{
enum
census_trace_mask_values
{
...
@@ -217,10 +221,10 @@ enum census_trace_mask_values {
...
@@ -217,10 +221,10 @@ enum census_trace_mask_values {
/** Get the current trace mask associated with this context. The value returned
/** Get the current trace mask associated with this context. The value returned
will be the logical or of census_trace_mask_values values. */
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. */
/** 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
/* The concept of "operation" is a fundamental concept for Census. In an RPC
system, and operation typcially represents a single RPC, or a significant
system, and operation typcially represents a single RPC, or a significant
...
@@ -268,7 +272,7 @@ typedef struct {
...
@@ -268,7 +272,7 @@ typedef struct {
@return A timestamp representing the operation start time.
@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
Represent functions to map RPC name ID to service/method names. Census
...
@@ -320,7 +324,7 @@ typedef struct {
...
@@ -320,7 +324,7 @@ typedef struct {
@return A new census context.
@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_context
*
context
,
int64_t
rpc_name_id
,
const
census_rpc_name_info
*
rpc_name_info
,
const
char
*
peer
,
int
trace_mask
,
const
census_rpc_name_info
*
rpc_name_info
,
const
char
*
peer
,
int
trace_mask
,
const
census_timestamp
*
start_time
);
const
census_timestamp
*
start_time
);
...
@@ -328,7 +332,8 @@ census_context *census_start_client_rpc_op(
...
@@ -328,7 +332,8 @@ census_context *census_start_client_rpc_op(
/**
/**
Add peer information to a context representing a client RPC operation.
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
Start a server RPC operation. Returns a new context to be used in future
...
@@ -348,7 +353,7 @@ void census_set_rpc_client_peer(census_context *context, const char *peer);
...
@@ -348,7 +353,7 @@ void census_set_rpc_client_peer(census_context *context, const char *peer);
@return A new census context.
@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
char
*
buffer
,
int64_t
rpc_name_id
,
const
census_rpc_name_info
*
rpc_name_info
,
const
char
*
peer
,
int
trace_mask
,
const
census_rpc_name_info
*
rpc_name_info
,
const
char
*
peer
,
int
trace_mask
,
census_timestamp
*
start_time
);
census_timestamp
*
start_time
);
...
@@ -378,8 +383,9 @@ census_context *census_start_server_rpc_op(
...
@@ -378,8 +383,9 @@ census_context *census_start_server_rpc_op(
@return A new census context.
@return A new census context.
*/
*/
census_context
*
census_start_op
(
census_context
*
context
,
const
char
*
family
,
CENSUS_API
census_context
*
census_start_op
(
census_context
*
context
,
const
char
*
name
,
int
trace_mask
);
const
char
*
family
,
const
char
*
name
,
int
trace_mask
);
/**
/**
End an operation started by any of the census_start_*_op*() calls. The
End an operation started by any of the census_start_*_op*() calls. The
...
@@ -390,7 +396,7 @@ census_context *census_start_op(census_context *context, const char *family,
...
@@ -390,7 +396,7 @@ census_context *census_start_op(census_context *context, const char *family,
@param status status associated with the operation. Not interpreted by
@param status status associated with the operation. Not interpreted by
census.
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_START_OP ((uint32_t)0)
#define CENSUS_TRACE_RECORD_END_OP ((uint32_t)1)
#define CENSUS_TRACE_RECORD_END_OP ((uint32_t)1)
...
@@ -402,8 +408,8 @@ void census_end_op(census_context *context, int status);
...
@@ -402,8 +408,8 @@ void census_end_op(census_context *context, int status);
@param buffer Pointer to buffer to use
@param buffer Pointer to buffer to use
@param n Number of bytes in buffer
@param n Number of bytes in buffer
*/
*/
void
census_trace_print
(
census_context
*
context
,
uint32_t
type
,
CENSUS_API
void
census_trace_print
(
census_context
*
context
,
uint32_t
type
,
const
char
*
buffer
,
size_t
n
);
const
char
*
buffer
,
size_t
n
);
/** Trace record. */
/** Trace record. */
typedef
struct
{
typedef
struct
{
...
@@ -424,7 +430,7 @@ typedef struct {
...
@@ -424,7 +430,7 @@ typedef struct {
while scanning is ongoing.
while scanning is ongoing.
@returns 0 on success, non-zero on failure (e.g. if a scan is already 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
/** 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
stable until the next census_get_trace_record() call (if the consume
...
@@ -435,10 +441,10 @@ int census_trace_scan_start(int consume);
...
@@ -435,10 +441,10 @@ int census_trace_scan_start(int consume);
census_trace_scan_start()), 0 if there is no more trace data (and
census_trace_scan_start()), 0 if there is no more trace data (and
trace_record will not be modified) or 1 otherwise.
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() */
/** End a scan previously started by census_trace_scan_start() */
void
census_trace_scan_end
();
CENSUS_API
void
census_trace_scan_end
();
/* Core stats collection API's. The following concepts are used:
/* Core stats collection API's. The following concepts are used:
* Aggregation: A collection of values. Census supports the following
* Aggregation: A collection of values. Census supports the following
...
@@ -469,8 +475,8 @@ typedef struct {
...
@@ -469,8 +475,8 @@ typedef struct {
}
census_value
;
}
census_value
;
/* Record new usage values against the given context. */
/* Record new usage values against the given context. */
void
census_record_values
(
census_context
*
context
,
census_value
*
values
,
CENSUS_API
void
census_record_values
(
census_context
*
context
,
size_t
nvalues
);
census_value
*
values
,
size_t
nvalues
);
/** Type representing a particular aggregation */
/** Type representing a particular aggregation */
typedef
struct
census_aggregation_ops
census_aggregation_ops
;
typedef
struct
census_aggregation_ops
census_aggregation_ops
;
...
@@ -502,24 +508,25 @@ typedef struct census_view census_view;
...
@@ -502,24 +508,25 @@ typedef struct census_view census_view;
*/
*/
/* TODO(aveitch): consider if context is the right argument type to pass in
/* TODO(aveitch): consider if context is the right argument type to pass in
tags. */
tags. */
census_view
*
census_view_create
(
uint32_t
metric_id
,
const
census_context
*
tags
,
CENSUS_API
census_view
*
census_view_create
(
const
census_
aggregation
*
ag
gregation
s
,
uint32_t
metric_id
,
const
census_
context
*
t
ags
,
size_t
naggregations
);
const
census_aggregation
*
aggregations
,
size_t
naggregations
);
/** Destroy a previously created view. */
/** 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 */
/** 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. */
/** 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. */
/** Get tags associated with view. */
const
census_context
*
census_view_tags
(
const
census_view
*
view
);
CENSUS_API
const
census_context
*
census_view_tags
(
const
census_view
*
view
);
/** Get aggregation descriptors associated with a 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
/** Holds all the aggregation data for a particular view instantiation. Forms
part of the data returned by census_view_data(). */
part of the data returned by census_view_data(). */
...
@@ -538,10 +545,11 @@ typedef struct {
...
@@ -538,10 +545,11 @@ typedef struct {
@param view View from which to get data.
@param view View from which to get data.
@return Full set of data for all aggregations for the view.
@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 */
/** 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
#ifdef __cplusplus
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment