open-telemetry / open-telemetry/opentelemetry-cpp
Parent-Child discover error in examples/simple when built as release and shared library.
@lalitb is already working on this.
Since Nov 3, 2021.
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 632
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 75
Description
Describe your environment
My system is Ubuntu 18.04.5 LTS. And the compiler is gcc 7.5.0
Steps to reproduce
I am trying to use opentelemetry as a shared library for my project. But I found that when I try to build it as release and shared library, there is some error in Parent-Child discover. The problem can be reproduced by just running the examples/simple/example_simple. Build in Debug(default) in cmake or static library wont show this error.
I use the following code to build.
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
cmake --build . --target all
What is the expected behavior?
In example/simple the parent_span_id of f1 should be span_id of f2. And parent_span_id of f2 should be span_id of library. But both showing 0000000000000000.
What is the actual behavior?
{
name : f1
trace_id : cbbb2e3813a548c408de4b484dc723a1
span_id : ce90a9eaf3214e19
tracestate :
parent_span_id: 0000000000000000
start : 1634260358826620364
duration : 7665
description :
span kind : Internal
status : Unset
attributes :
events :
links :
resources :
service.name: unknown_service
telemetry.sdk.version: 1.0.0
telemetry.sdk.language: cpp
telemetry.sdk.name: opentelemetry
instr-lib : foo_library
}
{
name : f1
trace_id : 3dc7f1b4da6e2eedff960b136ab6e305
span_id : a145e9e7fca8f666
tracestate :
parent_span_id: 0000000000000000
start : 1634260358826785278
duration : 1634
description :
span kind : Internal
status : Unset
attributes :
events :
links :
resources :
service.name: unknown_service
telemetry.sdk.version: 1.0.0
telemetry.sdk.language: cpp
telemetry.sdk.name: opentelemetry
instr-lib : foo_library
}
{
name : f2
trace_id : 94d5abc1a0839e21a97ab9bb3564cbea
span_id : 8c0d473664eeeb48
tracestate :
parent_span_id: 0000000000000000
start : 1634260358826616048
duration : 296248
description :
span kind : Internal
status : Unset
attributes :
events :
links :
resources :
service.name: unknown_service
telemetry.sdk.version: 1.0.0
telemetry.sdk.language: cpp
telemetry.sdk.name: opentelemetry
instr-lib : foo_library
}
{
name : library
trace_id : 0f0bc2eebeb389b448502ac1f015ed1e
span_id : 72fdbadc8e352b5d
tracestate :
parent_span_id: 0000000000000000
start : 1634260358826597245
duration : 460802
description :
span kind : Internal
status : Unset
attributes :
events :
links :
resources :
service.name: unknown_service
telemetry.sdk.version: 1.0.0
telemetry.sdk.language: cpp
telemetry.sdk.name: opentelemetry
instr-lib : foo_library
}
Also the there is a test failed passing.
/home/xxx/src/opentelemetry-cpp/sdk/test/trace/tracer_test.cc:130: Failure
Value of: span2.at(0)->GetParentSpanId().IsValid()
Actual: false
Expected: true
/home/xxx/src/opentelemetry-cpp/sdk/test/trace/tracer_test.cc:142: Failure
Expected equality of these values:
span1.at(0)->GetTraceId()
Which is: 16-byte object <11-E7 89-39 C6-F1 C7-94 00-2A 0C-55 77-86 CC-F1>
span2.at(0)->GetTraceId()
Which is: 16-byte object <7A-F8 0A-45 00-73 E5-4C 09-3E D9-58 8D-D0 60-F3>
/home/chunhao.shen/src/opentelemetry-cpp/sdk/test/trace/tracer_test.cc:143: Failure
Expected equality of these values:
span2.at(0)->GetParentSpanId()
Which is: 8-byte object <00-00 00-00 00-00 00-00>
span1.at(0)->GetSpanId()
Which is: 8-byte object <4D-6D D3-1B 08-D4 0C-9F>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.