![]() |
Diffusion C API 6.11.5
|
Allows a client to configure metric collectors. More...
Data Structures | |
struct | diffusion_metrics_put_session_metric_collector_params_s |
Structure supplied when issuing a diffusion_metrics_put_session_metric_collector call. More... | |
struct | diffusion_metrics_put_topic_metric_collector_params_s |
Structure supplied when issuing a diffusion_metrics_put_topic_metric_collector call. More... | |
struct | diffusion_metrics_remove_session_metric_collector_params_s |
Structure supplied when issuing a diffusion_metrics_remove_session_metric_collector call. More... | |
struct | diffusion_metrics_remove_topic_metric_collector_params_s |
Structure supplied when issuing a diffusion_metrics_remove_topic_metric_collector call. More... | |
struct | diffusion_metrics_list_session_metric_collectors_params_s |
Structure supplied when issuing a diffusion_metrics_list_session_metric_collectors call. More... | |
struct | diffusion_metrics_list_topic_metric_collectors_params_s |
Structure supplied when issuing a diffusion_metrics_list_topic_metric_collectors call. More... | |
Typedefs | |
typedef struct DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T | DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T |
Opaque Session Metric Collector Builder struct. | |
typedef struct DIFFUSION_SESSION_METRIC_COLLECTOR_T | DIFFUSION_SESSION_METRIC_COLLECTOR_T |
Opaque Session Metric Collector struct. | |
typedef struct DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T |
Opaque Topic Metric Collector Builder struct. | |
typedef struct DIFFUSION_TOPIC_METRIC_COLLECTOR_T | DIFFUSION_TOPIC_METRIC_COLLECTOR_T |
Opaque Topic Metric Collector struct. | |
typedef int(* | session_metric_collector_put_cb) (void *context) |
callback when a session metric collector has been set on the server. | |
typedef int(* | session_metric_collector_remove_cb) (void *context) |
callback when a session metric collector has been removed from the server. | |
typedef int(* | session_metric_collector_list_cb) (const LIST_T *session_metric_collectors, void *context) |
callback when the list of session metric collectors has been retrieved from the server. | |
typedef int(* | topic_metric_collector_put_cb) (void *context) |
callback when a topic metric collector has been set on the server. | |
typedef int(* | topic_metric_collector_remove_cb) (void *context) |
callback when a topic metric collector has been removed from the server. | |
typedef int(* | topic_metric_collector_list_cb) (const LIST_T *topic_metric_collectors, void *context) |
callback when the list of topic metric collectors has been retrieved from the server. | |
typedef struct diffusion_metrics_put_session_metric_collector_params_s | DIFFUSION_METRICS_PUT_SESSION_METRIC_COLLECTOR_PARAMS_T |
Structure supplied when issuing a diffusion_metrics_put_session_metric_collector call. | |
typedef struct diffusion_metrics_put_topic_metric_collector_params_s | DIFFUSION_METRICS_PUT_TOPIC_METRIC_COLLECTOR_PARAMS_T |
Structure supplied when issuing a diffusion_metrics_put_topic_metric_collector call. | |
typedef struct diffusion_metrics_remove_session_metric_collector_params_s | DIFFUSION_METRICS_REMOVE_SESSION_METRIC_COLLECTOR_PARAMS_T |
Structure supplied when issuing a diffusion_metrics_remove_session_metric_collector call. | |
typedef struct diffusion_metrics_remove_topic_metric_collector_params_s | DIFFUSION_METRICS_REMOVE_TOPIC_METRIC_COLLECTOR_PARAMS_T |
Structure supplied when issuing a diffusion_metrics_remove_topic_metric_collector call. | |
typedef struct diffusion_metrics_list_session_metric_collectors_params_s | DIFFUSION_METRICS_LIST_SESSION_METRIC_COLLECTORS_PARAMS_T |
Structure supplied when issuing a diffusion_metrics_list_session_metric_collectors call. | |
typedef struct diffusion_metrics_list_topic_metric_collectors_params_s | DIFFUSION_METRICS_LIST_TOPIC_METRIC_COLLECTORS_PARAMS_T |
Structure supplied when issuing a diffusion_metrics_list_topic_metric_collectors call. | |
Allows a client to configure metric collectors.
Diffusion servers provide metrics which are made available in several ways:-
Metric collectors allow custom aggregation of metrics that are relevant to your application. There are no default metric collectors, only the ones that you create.
There are two types of metric collector: Session Metric Collectors and Topic Metric Collectors.
For full details regarding the configuration and operation of metric collectors see the user manual.
These can be configured to record metric data for a subset of all sessions, specified with a session filter.
The set of metrics recorded by each session metric collector is the same as those recorded for the whole server. For full details of session metrics, see the table in the user manual.
If the session filters of two different session metric collectors select the same session, both will record metrics for that session. It is only valid to add the metrics of different session metric collectors if their session filters select distinct sets of sessions.
You can optionally group the sessions within a collector by session properties.
These can be configured to record metric data for a subset of all topics, specified with a topic selector.
You can optionally group the topics within a collector by topic type.
The set of metrics recorded by each topic metric collector is the same as those recorded for the whole server. For full details of topic metrics, see the table in the user manual.
If the topic selectors of two different topic metric collectors select the same topic, both will record metrics for that topic. It is only valid to add the metrics of different topic metric collectors if their topic selectors select distinct sets of topics.
The following access control restrictions are applied:
put
or remove
a session metric collector, a session needs the CONTROL_SERVER
global permission. put
or remove
a topic metric collector, a session needs the CONTROL_SERVER
global permission. list
session metric collectors or topic metric collectors
, a session needs the VIEW_SERVER
global permission. typedef int(* session_metric_collector_list_cb) (const LIST_T *session_metric_collectors, void *context) |
callback when the list of session metric collectors has been retrieved from the server.
context | User supplied context. |
typedef int(* session_metric_collector_put_cb) (void *context) |
callback when a session metric collector has been set on the server.
context | User supplied context. |
typedef int(* session_metric_collector_remove_cb) (void *context) |
callback when a session metric collector has been removed from the server.
context | User supplied context. |
typedef int(* topic_metric_collector_list_cb) (const LIST_T *topic_metric_collectors, void *context) |
callback when the list of topic metric collectors has been retrieved from the server.
context | User supplied context. |
typedef int(* topic_metric_collector_put_cb) (void *context) |
callback when a topic metric collector has been set on the server.
context | User supplied context. |
typedef int(* topic_metric_collector_remove_cb) (void *context) |
callback when a topic metric collector has been removed from the server.
context | User supplied context. |
DEPRECATED | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | diffusion_topic_metric_collector_builder_create_collectorDIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T *builder, char *name, char *topic_selector | ) |
Create a new topic metric collector using the values currently known by the builder.
builder | the topic metric collector builder |
name | the name of the topic metric collector |
topic_selector | the selector pattern that specifies the topics for which metrics are to be collected |
diffusion_topic_metric_collector_builder_create
instead bool diffusion_metrics_list_session_metric_collectors | ( | SESSION_T * | session, |
const DIFFUSION_METRICS_LIST_SESSION_METRIC_COLLECTORS_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Retrieves the current session metric collectors.
session | The current session. If NULL, this function returns immediately. |
params | Parameter structure describing the callbacks to be invoked. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. bool diffusion_metrics_list_topic_metric_collectors | ( | SESSION_T * | session, |
const DIFFUSION_METRICS_LIST_TOPIC_METRIC_COLLECTORS_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Retrieves the current topic metric collectors.
session | The current session. If NULL, this function returns immediately. |
params | Parameter structure describing the callbacks to be invoked. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. bool diffusion_metrics_put_session_metric_collector | ( | SESSION_T * | session, |
const DIFFUSION_METRICS_PUT_SESSION_METRIC_COLLECTOR_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Add a session metric collector, replacing any with the same name.
session | The current session. If NULL, this function returns immediately. |
params | Parameter structure describing the session metric collector and the callbacks to be invoked. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. bool diffusion_metrics_put_topic_metric_collector | ( | SESSION_T * | session, |
const DIFFUSION_METRICS_PUT_TOPIC_METRIC_COLLECTOR_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Add a topic metric collector, replacing any with the same name.
session | The current session. If NULL, this function returns immediately. |
params | Parameter structure describing the topic metric collector and the callbacks to be invoked. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. bool diffusion_metrics_remove_session_metric_collector | ( | SESSION_T * | session, |
const DIFFUSION_METRICS_REMOVE_SESSION_METRIC_COLLECTOR_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Removes any session metric collector with the given name, if it exists.
session | The current session. If NULL, this function returns immediately. |
params | Parameter structure describing the session metric collector name and the callbacks to be invoked. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. bool diffusion_metrics_remove_topic_metric_collector | ( | SESSION_T * | session, |
const DIFFUSION_METRICS_REMOVE_TOPIC_METRIC_COLLECTOR_PARAMS_T | params, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Removes any topic metric collector with the given name, if it exists.
session | The current session. If NULL, this function returns immediately. |
params | Parameter structure describing the topic metric collector name and the callbacks to be invoked. |
api_error | Populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
. DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * diffusion_session_metric_collector_builder_export_to_prometheus | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * | builder, |
bool | export_to_prometheus | ||
) |
Specifies whether the metric collector should export metrics to Prometheus or not.
Limit the number of groups maintained by this metric collector.
The default is that metrics are not exported to Prometheus.
builder | the session metric collector builder |
export_to_prometheus | true to export metrics to Prometheus |
Session metric collectors can group metrics by properties
. This property places an upper limit on the number of groups that will be maintained for the metric collector.
For example, if a session metric collector groups by $SessionId
and maximum_groups
is 10, then metrics will only be collected for the first 10 sessions.
builder | the session metric collector builder |
export_to_prometheus | true to export metrics to Prometheus |
void diffusion_session_metric_collector_builder_free | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * | builder | ) |
Free a session metric collector builder.
builder | the session metric collector builder |
DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * diffusion_session_metric_collector_builder_group_by_properties | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * | builder, |
LIST_T * | property_names | ||
) |
Specifies a list of session property names to group by, replacing any current list known to this builder.
builder | the session metric collector builder |
property_names | a list of session property names. See session.h for details of session properties |
DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * diffusion_session_metric_collector_builder_group_by_property | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * | builder, |
char * | property_name | ||
) |
Adds the name of a session property to group by to the list known to this builder.
By default a builder will initially have no session properties to group by set.
builder | the session metric collector builder |
property_name | the name of the session property. See session.h for details of session properties |
DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * diffusion_session_metric_collector_builder_init | ( | ) |
Initialize a new session metric collector builder.
diffusion_session_metric_collector_builder_free
should be called on this pointer when no longer needed.
DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * diffusion_session_metric_collector_builder_maximum_groups | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * | builder, |
int | limit | ||
) |
Set the maximum number of groups maintained by the metric collector.
By default, the number of groups is not limited.
builder | the session metric collector builder |
limit | a positive integer |
DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * diffusion_session_metric_collector_builder_remove_metrics_with_no_matches | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * | builder, |
bool | remove | ||
) |
Specifies whether the metric collector should remove any metrics that have no matches.
The default is that the metric collector will not remove metrics with no matches.
builder | the session metric collector builder |
remove | true to indicate that metrics with no matches should be removed |
DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * diffusion_session_metric_collector_builder_reset | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_BUILDER_T * | builder | ) |
Reset the session metric collector builder's internal values.
builder | the session metric collector builder |
bool diffusion_session_metric_collector_compare | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector_1, |
DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector_2 | ||
) |
Compares two session metric collectors.
collector_1 | a session metric collector |
collector_2 | another session metric collector |
bool diffusion_session_metric_collector_exports_to_prometheus | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector, |
bool * | exports_to_prometheus | ||
) |
Indicates whether the metric collector exports to Prometheus.
collector | the session metric collector |
exports_to_prometheus | the variable that will receive the bool value if present |
void diffusion_session_metric_collector_free | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector | ) |
Free a session metric collector.
collector | the session metric collector |
bool diffusion_session_metric_collector_get_group_by_properties | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector, |
LIST_T ** | group_by | ||
) |
Returns the list of properties to group by.
collector | the session metric collector |
group_by | the variable that will receive the list value if present |
bool diffusion_session_metric_collector_get_name | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector, |
char ** | name | ||
) |
Returns the name of the session metric collector.
collector | the session metric collector |
name | the variable that will receive the name if present |
bool diffusion_session_metric_collector_get_session_filter | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector, |
char ** | session_filter | ||
) |
Returns the session filter of the session metric collector.
collector | the session metric collector |
session_filter | the variable that will receive the session filter if present |
bool diffusion_session_metric_collector_maximum_groups | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector, |
int * | maximum_groups | ||
) |
Limit the number of groups maintained by this metric collector.
Session metric collectors can group metrics by properties
. This property places an upper limit on the number of groups that will be maintained for the metric collector.
For example, if a session metric collector groups by $SessionId
and maximum_groups
is 10, then metrics will only be collected for the first 10 sessions.
collector | the session metric collector |
maximum_groups | the variable that will receive the int value if present |
bool diffusion_session_metric_collector_removes_metrics_with_no_matches | ( | DIFFUSION_SESSION_METRIC_COLLECTOR_T * | collector, |
bool * | removes | ||
) |
Indicates whether metrics with no matches should be removed.
collector | the session metric collector |
removes | the variable that will receive the bool value if present |
DIFFUSION_TOPIC_METRIC_COLLECTOR_T * diffusion_topic_metric_collector_builder_create | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * | builder, |
char * | name, | ||
char * | topic_selector, | ||
DIFFUSION_API_ERROR * | api_error | ||
) |
Create a new topic metric collector using the values currently known by the builder.
builder | the topic metric collector builder |
name | the name of the topic metric collector |
topic_selector | the selector pattern that specifies the topics for which metrics are to be collected |
api_error | populated on API error. Can be NULL. |
api_error
pointer has been provided, this will be populated with the error information and should be freed with diffusion_api_error_free
.DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * diffusion_topic_metric_collector_builder_export_to_prometheus | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * | builder, |
bool | export_to_prometheus | ||
) |
Specifies whether the metric collector should export metrics to Prometheus or not.
The default is that metrics are not exported to Prometheus.
builder | the topic metric collector builder |
export_to_prometheus | true to export metrics to Prometheus |
void diffusion_topic_metric_collector_builder_free | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * | builder | ) |
Free a topic metric collector builder.
builder | the topic metric collector builder |
DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * diffusion_topic_metric_collector_builder_group_by_path_prefix_parts | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * | builder, |
int | parts | ||
) |
Specifies the number of leading parts of the topic path the metric collector should use to group results.
By default a topic metric collector does not group by the topic path prefix. If a positive number of parts is specified, it will enable grouping.
builder | the topic metric collector builder |
parts | the number of leading parts of the topic path to group by; set to 0 to disable grouping by path |
DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * diffusion_topic_metric_collector_builder_group_by_topic_type | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * | builder, |
bool | group_by_topic_type | ||
) |
Specifies whether the metric collector should group by topic type.
By default a topic metric collector does not group by topic type.
builder | the topic metric collector builder |
group_by_topic_type | true to indicate that the collector should group by topic type |
DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * diffusion_topic_metric_collector_builder_group_by_topic_view | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * | builder, |
bool | group_by_topic_view | ||
) |
Specifies whether the metric collector should group by topic view.
By default a topic metric collector does not group by topic view.
builder | the topic metric collector builder |
group_by_topic_view | true to indicate that the collector should group by topic view |
DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * diffusion_topic_metric_collector_builder_init | ( | ) |
Initialize a new topic metric collector builder.
diffusion_session_topic_collector_builder_free
should be called on this pointer when no longer needed.
DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * diffusion_topic_metric_collector_builder_maximum_groups | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * | builder, |
int | limit | ||
) |
Set the maximum number of groups maintained by the metric collector.
By default, the number of groups is not limited.
builder | the session metric collector builder |
limit | a positive integer |
DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * diffusion_topic_metric_collector_builder_reset | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_BUILDER_T * | builder | ) |
Reset the topic metric collector builder's internal values.
builder | the topic metric collector builder |
bool diffusion_topic_metric_collector_compare | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector_1, |
DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector_2 | ||
) |
Compares two topic metric collectors.
collector_1 | a topic metric collector |
collector_2 | another topic metric collector |
bool diffusion_topic_metric_collector_exports_to_prometheus | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector, |
bool * | exports_to_prometheus | ||
) |
Indicates whether the metric collector exports to Prometheus.
collector | the topic metric collector |
exports_to_prometheus | the variable that will receive the bool value if present |
void diffusion_topic_metric_collector_free | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector | ) |
Free a topic metric collector.
collector | the topic metric collector |
bool diffusion_topic_metric_collector_get_name | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector, |
char ** | name | ||
) |
Returns the name of the topic metric collector.
collector | the topic metric collector |
name | the variable that will receive the name if present |
bool diffusion_topic_metric_collector_get_topic_selector | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector, |
char ** | topic_selector | ||
) |
Returns the topic selector of the topic metric collector.
collector | the topic metric collector |
topic_selector | the variable that will receive the topic selector if present |
bool diffusion_topic_metric_collector_group_by_path_prefix_parts | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector, |
int * | group_by_path_prefix_parts | ||
) |
Specifies the number of leading parts of the topic path to group by, or 0, if the collector does not group by path prefix.
collector | the topic metric collector |
group_by_path_prefix_parts | the variable that will receive the int value if present |
bool diffusion_topic_metric_collector_groups_by_topic_type | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector, |
bool * | groups_by_topic_type | ||
) |
Specifies whether the metric collector should group by topic type.
collector | the topic metric collector |
groups_by_topic_type | the variable that will receive the bool value if present |
bool diffusion_topic_metric_collector_groups_by_topic_view | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector, |
bool * | groups_by_topic_view | ||
) |
Indicates whether the metric collector groups by topic view.
collector | the topic metric collector |
groups_by_topic_view | the variable that will receive the bool value if present |
bool diffusion_topic_metric_collector_maximum_groups | ( | DIFFUSION_TOPIC_METRIC_COLLECTOR_T * | collector, |
int * | maximum_groups | ||
) |
Limit the number of groups maintained by this metric collector.
Topic metric collectors can group metrics by properties
. This property places an upper limit on the number of groups that will be maintained for the metric collector.
collector | the topic metric collector |
maximum_groups | the variable that will receive the int value if present |