Skip to content

Refactor dispatch.{c,h}#932

Merged
morrisonlevi merged 4 commits intomasterfrom
levi/build/dispatch
Jun 24, 2020
Merged

Refactor dispatch.{c,h}#932
morrisonlevi merged 4 commits intomasterfrom
levi/build/dispatch

Conversation

@morrisonlevi
Copy link
Copy Markdown
Collaborator

@morrisonlevi morrisonlevi commented Jun 23, 2020

Description

Ahead of some work on the non-instrumentation API, I discovered some cruft in the dispatch process. This PR:

  • Moves dispatch_setup.c into dispatch.c
  • Refactors a few functions in those files and deletes some unnecessary helpers
  • Extracts common code into ddtrace_prehook and ddtrace_posthook
  • Removes some DD_PRINTF usage

Overall it deletes more code than it adds, which I am happy about. There shouldn't be any behavior changes, and don't expect it to substantially affect overhead. It will lower the amount of memory used, however, I expect the non-instrumentation API to increase it more than this reduces it.

There is more work to do, but it was getting large enough that I figured it was time for code review.

Readiness checklist

  • Changelog has been added to the appropriate release draft.
  • Tests added for this feature/bug.

Reviewer checklist

  • Appropriate labels assigned.
  • Milestone is set.
  • Changelog has been added to the appropriate release draft. For community contributors the reviewer is in charge of this task.

@morrisonlevi morrisonlevi added the c-extension Apply this label to issues and prs related to the C-extension label Jun 23, 2020
@morrisonlevi morrisonlevi added this to the 0.48.0 milestone Jun 23, 2020
Copy link
Copy Markdown
Contributor

@SammyK SammyK left a comment

Choose a reason for hiding this comment

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

Looks great @morrisonlevi! I just left one question, but 👍.

Comment thread config.m4
src/ext/configuration_php_iface.c \
src/ext/ddtrace_string.c \
src/ext/dispatch.c \
src/ext/dispatch_setup.c \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔝

retval = &rv;
}
_dd_end_span(span, retval);
ddtrace_posthook(NULL, span, retval);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should have access to the fbc from the execute_data here (and in the other return handlers). Or is there a reason we need to keep it NULL?

Copy link
Copy Markdown
Collaborator Author

@morrisonlevi morrisonlevi Jun 24, 2020

Choose a reason for hiding this comment

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

It's because we don't need to check for a span stack mismatch because of the way the handlers works -- if there was a mismatch we wouldn't even be running the posthook in these handlers. This is the only thing the FBC is used for.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good point. Just FYI, that assumption will likely change in #931.

@morrisonlevi morrisonlevi merged commit 58409a7 into master Jun 24, 2020
@morrisonlevi morrisonlevi deleted the levi/build/dispatch branch June 24, 2020 15:32
@morrisonlevi morrisonlevi modified the milestones: 0.48.0, 0.47.0 Jun 29, 2020
@morrisonlevi morrisonlevi mentioned this pull request Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c-extension Apply this label to issues and prs related to the C-extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants