-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in_opentelemetry: add tag_from_uri support to http2 codepath #8963
base: master
Are you sure you want to change the base?
in_opentelemetry: add tag_from_uri support to http2 codepath #8963
Conversation
e0ae915
to
66ae903
Compare
tags are still v1_logs/v1_metrics/v1_traces even in gRPC cases Signed-off-by: Stewart Webb <stewart.james.webb@gmail.com>
66ae903
to
5aab3eb
Compare
@edsiper @cosmo0920 I've fixed up the formatting of the commit messages / PR titles on this one. It should properly fix the issue in #8734 |
tag = flb_sds_create("v1_logs"); | ||
} | ||
else { | ||
tag = flb_sds_create(context->ins->tag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I am not wrong, this new memory buffer tag
is never released, please validate that on every place is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, good catch. Although, the tag should get handed off to the routing/processing system later on via the flb_input_log_append
/flb_input_metrics_append
/flb_input_trace_append
calls - e.g.
fluent-bit/plugins/in_opentelemetry/opentelemetry_prot.c
Lines 2389 to 2395 in 69bf966
if (ret == 0) { | |
ret = flb_input_log_append(ctx->ins, | |
tag, | |
flb_sds_len(tag), | |
encoder->output_buffer, | |
encoder->output_length); | |
} |
Does this mean the buffer gets picked up by another thread later? (does it need to be freed there? does that perhaps already happen?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looking at the existing HTTP1 codepath, it seems the tag does get freed there by the handler at the end:
fluent-bit/plugins/in_opentelemetry/opentelemetry_prot.c
Lines 1923 to 1928 in 69bf966
flb_sds_destroy(tag); | |
send_response(conn, ctx->successful_response_code, NULL); | |
return ret; | |
} |
For some reason the new HTTP/2 server codepaths in the OpenTelemetry input plugin don't have any support for the
tag_from_uri
plugin option.This PR adds the same
v1_metrics
/v1_logs
/v1_traces
tags that thetag_from_uri
behaviour in the previousflb_downstream
-based non-HTTP/2 codepath.Strictly speaking, this is arguably not fully correct, as the "URI"s in the gRPC cases are more complex:
opentelemetry.proto.collector.metrics.v1.MetricsService/Export
opentelemetry.proto.collector.traces.v1.TracesService/Export
opentelemetry.proto.collector.logs.v1.LogsService/Export
However it's probably a good enough first step given that anyone trying to filter by telemetry signal type would already be using these
v1_metrics
/v1_logs
/v1_traces
tags, and it seems overly complex to have totally different longer tags just for gRPC input.As I said in an earlier comment on #8734, the "proper" fix for this IMO is to switch to a
tag_from_signaltype
option or something like that. But this is more work and might count as a breaking config change. This PR at least brings the same behaviour as the non-HTTP/2 config case to the HTTP/2 config case."Next-step" fix for #8734 (previous PR #8881 only addressed cases where http2 plugin option was set to false).
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
cURL command for testing:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.