Skip to content

Commit

Permalink
encode_opentelemetry: tests: Make a generic opts instead of cutoff sp…
Browse files Browse the repository at this point in the history
…ecific one

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Oct 1, 2024
1 parent f6f0e93 commit 92a16b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions include/cmetrics/cmt_encode_opentelemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions src/cmt_encode_opentelemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion tests/encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 92a16b9

Please sign in to comment.