You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support struct values for fields in OTEL AccessLogger #31148
enhancementFeature requests. Not bugs or questions.investigatePotential bug that needs verificationstalestalebot believes this issue/PR has not been touched recently
Description:
the existing otel logger's request format is static by the body and attributes field(the struct layout is defined at the config time). I am wondering if we can make that dynamic by supporting struct values for fields in OTEL AccessLogger
I had some offline discussion. @TAOXUY I think you should share the use case for the log. AFAICT it's not a request log, it's closer to resource/audit log, which might require multiple entries per-request, for example. In that case, it's OTLP only needs to provide the client network function and receive the entire entry plus resource dynamically.
Yeah, that's our further ask. Essentially we could generate multiple logs(audit log) per access dynamically so we want to the forerunner extension can fully control the OTEL request generation, instead of using the current static declarative way.
@htuch This might actually be a more important question than this PR. The problem is that Wasm extensions have a choice to do two things:
They can import Otel SDK and compile it to Wasm directly, which requires substituting POSIX I/O calls with appropriate Envoy ABI calls.
1b. They can go the null Wasm way, and skip the second step in 1). This is how istio/proxy Stackdriver extension operates, by importing OpenCensus SDK.
They can use Envoy's Otel log sink as the SDK, and create a "foreign function" as an ABI extension to directly emit a log entry from the module, and let Envoy only handle batching and export. This can also be done indirectly by writing some well known filter state or dynamic metadata that is consumed by Otel log sink.
Each approach has merits, so it would be useful to provide some guidance on which approach to take with respect to extensions.
// When the field is set, the the OTel AccessLogger will assume
// a request is set in this filterState by precursor extensions
// so it will add this request in the request batches.
// When this field is used, `resource_attributes`, `body` or `attributes` shouldn't be set.
string filter_state_for_otel_request_injection =6;
Why we need this?
we may have multiple audit logs dynamically generated for single request so this static declarative configuring approach for request generation will no longer be effective.
minor: we potentially set OTel fields(other than Resource Attributes, LogRecord.body, LogRecord.body.attributes) that are not exposed by OTel AccessLogger config.
For #31148 (comment), I feel this speaks to limitation in ProxyWasm and our ABI (CC @mpwarres@PiotrSikora). Why can't we have better ABI-level support for logging/tracing/stats that can approach what is needed for OTLP?
I'm actually super confused on this thread though, it started off as some ask about OT access loggers, and now it's about Wasm ABIs?
@htuch The original issue did not have the full context. The logs are being produced by a Wasm extension, and need to be exported via OTLP to a different resource (not the request log, multiple entries per log).
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.
enhancementFeature requests. Not bugs or questions.investigatePotential bug that needs verificationstalestalebot believes this issue/PR has not been touched recently
Activity
soulxu commentedon Dec 4, 2023
cc @htuch
htuch commentedon Dec 4, 2023
Is the idea to use header formatter variables?
TAOXUY commentedon Dec 4, 2023
Hi @htuch , possibly extend access logging formatter somehow.
Currently, if the var is set to a dynamic_metadata which is struct, it will be set as a json string but we need to be a struct in OTel accesslogger.
@kyessenov
htuch commentedon Dec 6, 2023
Can you propose a proto change to make this concrete?
kyessenov commentedon Dec 6, 2023
I had some offline discussion. @TAOXUY I think you should share the use case for the log. AFAICT it's not a request log, it's closer to resource/audit log, which might require multiple entries per-request, for example. In that case, it's OTLP only needs to provide the client network function and receive the entire entry plus resource dynamically.
TAOXUY commentedon Dec 7, 2023
Thanks @kyessenov!
Yeah, that's our further ask. Essentially we could generate multiple logs(audit log) per access dynamically so we want to the forerunner extension can fully control the OTEL request generation, instead of using the current static declarative way.
htuch commentedon Dec 8, 2023
Thanks. I think having a concrete proto change (even if only a sketch in a comment) would be a useful way to clarify what is being proposed.
kyessenov commentedon Dec 8, 2023
@htuch This might actually be a more important question than this PR. The problem is that Wasm extensions have a choice to do two things:
1b. They can go the null Wasm way, and skip the second step in 1). This is how istio/proxy Stackdriver extension operates, by importing OpenCensus SDK.
Each approach has merits, so it would be useful to provide some guidance on which approach to take with respect to extensions.
TAOXUY commentedon Dec 11, 2023
Thanks Kuat!
For
envoy/api/envoy/extensions/access_loggers/open_telemetry/v3/logs_service.proto
Lines 26 to 49 in da09811
I am thinking introducing something like
Why we need this?
htuch commentedon Dec 12, 2023
For #31148 (comment), I feel this speaks to limitation in ProxyWasm and our ABI (CC @mpwarres @PiotrSikora). Why can't we have better ABI-level support for logging/tracing/stats that can approach what is needed for OTLP?
I'm actually super confused on this thread though, it started off as some ask about OT access loggers, and now it's about Wasm ABIs?
kyessenov commentedon Dec 12, 2023
@htuch The original issue did not have the full context. The logs are being produced by a Wasm extension, and need to be exported via OTLP to a different resource (not the request log, multiple entries per log).
PiotrSikora commentedon Dec 18, 2023
I'm definitely missing some context, but what's missing in Wasm's
proxy_log?What's the exact ask that would make Wasm work for OTEL AccessLogger?
kyessenov commentedon Dec 18, 2023
@PiotrSikora Ability to send structured logs (https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/logs/v1/logs.proto), meaning key-value attribute, resource attributes, and structured body.
Also, ability to register OTLP for Wasm, and route
proxy_logto it.github-actions commentedon Jan 17, 2024
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
github-actions commentedon Jan 25, 2024
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.