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

Adds TextMap propagator #6

Merged
merged 2 commits into from
Feb 16, 2018
Merged

Adds TextMap propagator #6

merged 2 commits into from
Feb 16, 2018

Conversation

jcchavezs
Copy link
Contributor

This PR adds TextMap propagator.

Ping @palazzem

@palazzem palazzem self-requested a review February 16, 2018 14:03
@palazzem palazzem added the 🍏 core Changes to the core tracing functionality label Feb 16, 2018
@palazzem palazzem added this to the 0.1.0 milestone Feb 16, 2018
const TRACE_ID = '1c42b4de015cc315';
const SPAN_ID = '1c42b4de015cc316';

public function testInjectSpanContextIntoCarrier()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some tests where:

  • what happen if the traceId is not set
  • what happen if the spanId is not set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you refer to extract not to inject.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes sorry 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

continue;
}

if ($traceId === null && $spanId === null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be an || operator like we're doing for Go: https://github.com/DataDog/dd-trace-go/blob/master/opentracing/propagators.go#L116-L118

Mostly a SpanContext is not valid for extraction if the traceId and the spanId (the parent) are not set. In case of distributed tracing they both need to be set, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally. I will change it.

@jcchavezs jcchavezs merged commit eba5940 into master Feb 16, 2018
@jcchavezs jcchavezs deleted the adds_propagators branch February 16, 2018 14:32
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
bwoebi added a commit that referenced this pull request Sep 5, 2023
Illustrating the issue:

// calling begin
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_begin
add    x8, x8, #0x6b0
blr    x8
// start of function execution
// reading string arg from execute_data constants
mov    x8, #0xe400                     // #58368
movk   x8, #0xac44, lsl #16
movk   x8, #0xaaaa, lsl #32
// storing to CV[1]
str    x8, [x27, #96]
mov    w8, #0x6                        // #6
// storing type of CV[1]
str    w8, [x27, #104]
// nothing happens, my test function is empty :-)
// calling end with 2 args
adrp   x1, 0xaaaaacad4000
add    x1, x1, #0x740
mov    x0, x27
adrp   x8, 0xaaaaacad4000
add    x8, x8, #0x7b0
str    x8, [x27]
adrp   x8, 0xaaaaab361000 <zend_observer_fcall_install+496> // zend_observer_fcall_end
add    x8, x8, #0x844
blr    x8

As one can see, with the tracing JIT, it just forcibly overrides the second arg, inlining the called function. (Which is also why we leaked our custom $context array in the LogsIntegration).
The JIT has no exit points here.

Hence, we have no choice but to forcefully disallow inlining the hooked methods where overrideArguments is used.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍏 core Changes to the core tracing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants