X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils%2Fformat_stackdriver%2Fformat_stackdriver.c;h=ccb1c77deed6920c2adbc291008286d6d6e32154;hb=956a2f4996d9fb0526b6f60c29be9b17c0ad27ba;hp=80b85ae44cfd7608b736b07e37221d082a3d4914;hpb=164e3aed7d737055ac7aa2d0cc9981247f32a491;p=collectd.git diff --git a/src/utils/format_stackdriver/format_stackdriver.c b/src/utils/format_stackdriver/format_stackdriver.c index 80b85ae4..ccb1c77d 100644 --- a/src/utils/format_stackdriver/format_stackdriver.c +++ b/src/utils/format_stackdriver/format_stackdriver.c @@ -144,16 +144,16 @@ static int format_typed_value(yajl_gen gen, int ds_type, value_t v, } case DS_TYPE_DERIVE: { derive_t diff = v.derive - (derive_t)start_value; - snprintf(integer, sizeof(integer), "%" PRIi64, diff); + ssnprintf(integer, sizeof(integer), "%" PRIi64, diff); break; } case DS_TYPE_COUNTER: { counter_t diff = counter_diff((counter_t)start_value, v.counter); - snprintf(integer, sizeof(integer), "%llu", diff); + ssnprintf(integer, sizeof(integer), "%llu", diff); break; } case DS_TYPE_ABSOLUTE: { - snprintf(integer, sizeof(integer), "%" PRIu64, v.absolute); + ssnprintf(integer, sizeof(integer), "%" PRIu64, v.absolute); break; } default: { @@ -177,7 +177,7 @@ static int format_typed_value(yajl_gen gen, int ds_type, value_t v, * "CUMULATIVE", * "GAUGE" * ) -*/ + */ static int format_metric_kind(yajl_gen gen, int ds_type) { switch (ds_type) { case DS_TYPE_GAUGE: @@ -198,7 +198,7 @@ static int format_metric_kind(yajl_gen gen, int ds_type) { * "DOUBLE", * "INT64" * ) -*/ + */ static int format_value_type(yajl_gen gen, int ds_type) { return json_string(gen, (ds_type == DS_TYPE_GAUGE) ? "DOUBLE" : "INT64"); } @@ -210,10 +210,10 @@ static int metric_type(char *buffer, size_t buffer_size, data_set_t const *ds, #define GCM_PREFIX "custom.googleapis.com/collectd/" if ((ds_index != 0) || strcmp("value", ds_name) != 0) { - snprintf(buffer, buffer_size, GCM_PREFIX "%s/%s_%s", vl->plugin, vl->type, - ds_name); + ssnprintf(buffer, buffer_size, GCM_PREFIX "%s/%s_%s", vl->plugin, vl->type, + ds_name); } else { - snprintf(buffer, buffer_size, GCM_PREFIX "%s/%s", vl->plugin, vl->type); + ssnprintf(buffer, buffer_size, GCM_PREFIX "%s/%s", vl->plugin, vl->type); } char const *whitelist = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -280,8 +280,8 @@ static int read_cumulative_state(data_set_t const *ds, value_list_t const *vl, } char start_value_key[DATA_MAX_NAME_LEN]; - snprintf(start_value_key, sizeof(start_value_key), - "stackdriver:start_value[%d]", ds_index); + ssnprintf(start_value_key, sizeof(start_value_key), + "stackdriver:start_value[%d]", ds_index); int status = uc_meta_data_get_signed_int(vl, start_value_key, ret_start_value);