Skip to content

Commit

Permalink
in_opentelemetry: add tag_from_uri support to http2 codepath
Browse files Browse the repository at this point in the history
tags are still v1_logs/v1_metrics/v1_traces even in gRPC cases

Signed-off-by: Stewart Webb <[email protected]>
  • Loading branch information
nuclearpidgeon committed Jul 1, 2024
1 parent 5ce9c43 commit 5aab3eb
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions plugins/in_opentelemetry/opentelemetry_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,7 @@ int opentelemetry_prot_handle_ng(struct flb_http_request *request,
int grpc_request;
struct flb_opentelemetry *context;
int result = -1;
flb_sds_t tag;

context = (struct flb_opentelemetry *) response->stream->user_data;

Expand Down Expand Up @@ -2435,19 +2436,37 @@ int opentelemetry_prot_handle_ng(struct flb_http_request *request,
strcmp(request->path, "/opentelemetry.proto.collector.metric.v1.MetricService/Export") == 0 ||
strcmp(request->path, "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export") == 0) {
payload_type = 'M';
result = process_payload_metrics_ng(context, context->ins->tag, request, response);
if (context->tag_from_uri == FLB_TRUE) {
tag = flb_sds_create("v1_metrics");
}
else {
tag = flb_sds_create(context->ins->tag);
}
result = process_payload_metrics_ng(context, tag, request, response);
}
else if (strcmp(request->path, "/v1/traces") == 0 ||
strcmp(request->path, "/opentelemetry.proto.collector.trace.v1.TraceService/Export") == 0 ||
strcmp(request->path, "/opentelemetry.proto.collector.traces.v1.TracesService/Export") == 0) {
payload_type = 'T';
result = process_payload_traces_ng(context, context->ins->tag, request, response);
if (context->tag_from_uri == FLB_TRUE) {
tag = flb_sds_create("v1_traces");
}
else {
tag = flb_sds_create(context->ins->tag);
}
result = process_payload_traces_ng(context, tag, request, response);
}
else if (strcmp(request->path, "/v1/logs") == 0 ||
strcmp(request->path, "/opentelemetry.proto.collector.log.v1.LogService/Export") == 0 ||
strcmp(request->path, "/opentelemetry.proto.collector.logs.v1.LogsService/Export") == 0) {
payload_type = 'L';
result = process_payload_logs_ng(context, context->ins->tag, request, response);
if (context->tag_from_uri == FLB_TRUE) {
tag = flb_sds_create("v1_logs");
}
else {
tag = flb_sds_create(context->ins->tag);
}
result = process_payload_logs_ng(context, tag, request, response);
}

if (grpc_request) {
Expand Down

0 comments on commit 5aab3eb

Please sign in to comment.