Skip to content
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

encode_opentelemetry: Handle minimal otel payloads #60

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Sep 24, 2024

In some circumstances, instrumentation scope is happened to be NULL:

fluent-bit        | #0  0x59a1f7596740      in  set_instrumentation_scope() at lib/ctraces/src/ctr_encode_opentelemetry.c:917
fluent-bit        | #1  0x59a1f75968f3      in  set_scope_spans() at lib/ctraces/src/ctr_encode_opentelemetry.c:983
fluent-bit        | #2  0x59a1f7596ae4      in  set_resource_spans() at lib/ctraces/src/ctr_encode_opentelemetry.c:1051
fluent-bit        | #3  0x59a1f7596beb      in  create_export_service_request() at lib/ctraces/src/ctr_encode_opentelemetry.c:1087
fluent-bit        | #4  0x59a1f7597300      in  ctr_encode_opentelemetry_create() at lib/ctraces/src/ctr_encode_opentelemetry.c:1304
fluent-bit        | #5  0x59a1f737cd3d      in  process_traces() at plugins/out_opentelemetry/opentelemetry.c:389
fluent-bit        | #6  0x59a1f737d3e0      in  cb_opentelemetry_flush() at plugins/out_opentelemetry/opentelemetry.c:485
fluent-bit        | #7  0x59a1f6e5dfc3      in  output_pre_cb_flush() at include/fluent-bit/flb_output.h:598
fluent-bit        | #8  0x59a1f7b59a86      in  co_init() at lib/monkey/deps/flb_libco/amd64.c:117
fluent-bit        | #9  0xffffffffffffffff  in  ???() at ???:0

With the reproducible steps here: fluent/fluent-bit#9391

In this PR, Plug an occurrence of SEGV due to empty spans.

In unit tests, I created the similar circumstances that handles the empty spans:

|-------------------- RESOURCE SPAN --------------------|
  resource:
     - attributes:
            - receiver.tool: 'ctraces'
     - dropped_attributes_count: 0
  schema_url: 
  [scope_span]
    schema_url: 
    [spans]

Additional context:

Under the current ctraces, I still got a SEGV error:

fluent-bit        | #0  0x597458c257b8      in  set_instrumentation_scope() at lib/ctraces/src/ctr_encode_opentelemetry.c:920
fluent-bit        | #1  0x597458c259d0      in  set_scope_spans() at lib/ctraces/src/ctr_encode_opentelemetry.c:1003
fluent-bit        | #2  0x597458c25bc1      in  set_resource_spans() at lib/ctraces/src/ctr_encode_opentelemetry.c:1072
fluent-bit        | #3  0x597458c25cc8      in  create_export_service_request() at lib/ctraces/src/ctr_encode_opentelemetry.c:1108
fluent-bit        | #4  0x597458c263dd      in  ctr_encode_opentelemetry_create() at lib/ctraces/src/ctr_encode_opentelemetry.c:1325
fluent-bit        | #5  0x597458a0bd3d      in  process_traces() at plugins/out_opentelemetry/opentelemetry.c:389
fluent-bit        | #6  0x597458a0c3e0      in  cb_opentelemetry_flush() at plugins/out_opentelemetry/opentelemetry.c:485
fluent-bit        | #7  0x5974584ecfc3      in  output_pre_cb_flush() at include/fluent-bit/flb_output.h:598
fluent-bit        | #8  0x5974591e8d86      in  co_init() at lib/monkey/deps/flb_libco/amd64.c:117
fluent-bit        | #9  0xffffffffffffffff  in  ???() at ???:0

@cosmo0920 cosmo0920 force-pushed the cosmo0920-process-minimal-traces branch from d69ad8b to 7062c8b Compare September 24, 2024 10:13
@edsiper edsiper merged commit 902f34b into master Sep 26, 2024
21 checks passed
@edsiper edsiper deleted the cosmo0920-process-minimal-traces branch September 26, 2024 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants