From 92a16b9c094fa325ef49ed8a36364c9123a4464e Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Tue, 1 Oct 2024 14:08:23 +0900 Subject: [PATCH] encode_opentelemetry: tests: Make a generic opts instead of cutoff specific one Signed-off-by: Hiroshi Hatake --- include/cmetrics/cmt_encode_opentelemetry.h | 8 ++++---- src/cmt_encode_opentelemetry.c | 10 +++++----- tests/encoding.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/cmetrics/cmt_encode_opentelemetry.h b/include/cmetrics/cmt_encode_opentelemetry.h index cb1a8e1..811ba36 100644 --- a/include/cmetrics/cmt_encode_opentelemetry.h +++ b/include/cmetrics/cmt_encode_opentelemetry.h @@ -45,16 +45,16 @@ struct cmt_opentelemetry_context int64_t cutoff_threshold; }; -struct cmt_opentelemetry_context_cutoff_opts +struct cmt_opentelemetry_context_opts { - int use_cutoff; - int64_t cutoff_threshold; + int use_cutoff; + int64_t cutoff_threshold; }; cfl_sds_t cmt_encode_opentelemetry_create(struct cmt *cmt); cfl_sds_t cmt_encode_opentelemetry_create_with_cutoff(struct cmt *cmt, int use_cutoff); cfl_sds_t cmt_encode_opentelemetry_create_with_cutoff_opts(struct cmt *cmt, - struct cmt_opentelemetry_context_cutoff_opts *opts); + struct cmt_opentelemetry_context_opts *opts); void cmt_encode_opentelemetry_destroy(cfl_sds_t text); diff --git a/src/cmt_encode_opentelemetry.c b/src/cmt_encode_opentelemetry.c index 0e2c3c5..80b988d 100644 --- a/src/cmt_encode_opentelemetry.c +++ b/src/cmt_encode_opentelemetry.c @@ -257,7 +257,7 @@ static void destroy_opentelemetry_context( struct cmt_opentelemetry_context *context); static struct cmt_opentelemetry_context *initialize_opentelemetry_context( - struct cmt *cmt, struct cmt_opentelemetry_context_cutoff_opts *opts); + struct cmt *cmt, struct cmt_opentelemetry_context_opts *opts); static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_to_otlp_any_value(struct cfl_variant *value); static inline Opentelemetry__Proto__Common__V1__KeyValue *cfl_variant_kvpair_to_otlp_kvpair(struct cfl_kvpair *input_pair); @@ -2138,7 +2138,7 @@ static Opentelemetry__Proto__Resource__V1__Resource * } static struct cmt_opentelemetry_context *initialize_opentelemetry_context( - struct cmt *cmt, struct cmt_opentelemetry_context_cutoff_opts *opts) + struct cmt *cmt, struct cmt_opentelemetry_context_opts *opts) { struct cfl_kvlist *resource_metrics_root; struct cfl_kvlist *scope_metrics_root; @@ -2532,7 +2532,7 @@ static cfl_sds_t render_opentelemetry_context_to_sds( } cfl_sds_t cmt_encode_opentelemetry_create_with_cutoff_opts(struct cmt *cmt, - struct cmt_opentelemetry_context_cutoff_opts *opts) + struct cmt_opentelemetry_context_opts *opts) { size_t metric_index; struct cmt_opentelemetry_context *context; @@ -2645,7 +2645,7 @@ cfl_sds_t cmt_encode_opentelemetry_create_with_cutoff_opts(struct cmt *cmt, cfl_sds_t cmt_encode_opentelemetry_create_with_cutoff(struct cmt *cmt, int use_cutoff) { - struct cmt_opentelemetry_context_cutoff_opts opts; + struct cmt_opentelemetry_context_opts opts; opts.use_cutoff = use_cutoff; opts.cutoff_threshold = CMT_ENCODE_OPENTELEMETRY_CUTOFF_THRESHOLD; @@ -2654,7 +2654,7 @@ cfl_sds_t cmt_encode_opentelemetry_create_with_cutoff(struct cmt *cmt, int use_c cfl_sds_t cmt_encode_opentelemetry_create(struct cmt *cmt) { - struct cmt_opentelemetry_context_cutoff_opts opts; + struct cmt_opentelemetry_context_opts opts; opts.use_cutoff = CMT_FALSE; opts.cutoff_threshold = CMT_ENCODE_OPENTELEMETRY_CUTOFF_DISABLED; diff --git a/tests/encoding.c b/tests/encoding.c index 95956c5..cdcc747 100644 --- a/tests/encoding.c +++ b/tests/encoding.c @@ -640,7 +640,7 @@ void test_opentelemetry_outdated_with_cutoff_opts() cfl_sds_t payload; struct cmt *cmt; uint64_t ts; - struct cmt_opentelemetry_context_cutoff_opts opts; + struct cmt_opentelemetry_context_opts opts; opts.use_cutoff = CMT_TRUE; opts.cutoff_threshold = CMT_ENCODE_OPENTELEMETRY_CUTOFF_THRESHOLD;