Skip to content

Commit 34a2cd0

Browse files
nokute78edsiper
authored andcommitted
in_opentelemetry: support tag_from_uri
Signed-off-by: Takahiro Yamashita <[email protected]>
1 parent 3efd96c commit 34a2cd0

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

plugins/in_opentelemetry/opentelemetry.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ static struct flb_config_map config_map[] = {
169169
0, FLB_TRUE, offsetof(struct flb_opentelemetry, tag_key),
170170
""
171171
},
172+
{
173+
FLB_CONFIG_MAP_BOOL, "tag_from_uri", "true",
174+
0, FLB_TRUE, offsetof(struct flb_opentelemetry, tag_from_uri),
175+
"If true, tag will be created from uri. e.g. v1_metrics from /v1/metrics ."
176+
},
172177
{
173178
FLB_CONFIG_MAP_INT, "successful_response_code", "201",
174179
0, FLB_TRUE, offsetof(struct flb_opentelemetry, successful_response_code),

plugins/in_opentelemetry/opentelemetry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct flb_opentelemetry {
3535
flb_sds_t tcp_port;
3636
const char *tag_key;
3737
bool raw_traces;
38+
int tag_from_uri;
3839

3940
size_t buffer_max_size; /* Maximum buffer size */
4041
size_t buffer_chunk_size; /* Chunk allocation size */

plugins/in_opentelemetry/opentelemetry_prot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,8 +1578,8 @@ int opentelemetry_prot_handle(struct flb_opentelemetry *ctx, struct http_conn *c
15781578
/* Compose the query string using the URI */
15791579
len = strlen(uri);
15801580

1581-
if (len == 1) {
1582-
tag = NULL; /* use default tag */
1581+
if (ctx->tag_from_uri != FLB_TRUE) {
1582+
tag = flb_sds_create(ctx->ins->tag);
15831583
}
15841584
else {
15851585
tag = flb_sds_create_size(len);

0 commit comments

Comments
 (0)