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

HPCC-30405 Jtrace CNullSpan Implementation #17904

Merged

Conversation

rpastrana
Copy link
Member

@rpastrana rpastrana commented Oct 13, 2023

  • Defines CNullSpan
  • Adds cppunits
  • Defaults activespans to CnullSpan
  • Removes activespan nullptr checks

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

@rpastrana rpastrana requested a review from ghalliday October 13, 2023 22:11
@rpastrana
Copy link
Member Author

@ghalliday I think this is what you asked for. I'm not sure about the behavior in the second commit.

Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

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

Looks good. A few minor comments

@@ -58,8 +58,9 @@ extern jlib_decl IProperties * getClientHeaders(const ISpan * span);

interface ITraceManager : extends IInterface
{
virtual ISpan * createServerSpan(const char * name, StringArray & httpHeaders, SpanFlags flags = SpanFlags::None) = 0;
virtual ISpan * createServerSpan(const char * name, const IProperties * httpHeaders, SpanFlags flags = SpanFlags::None) = 0;
virtual ISpan * createNullSpan() const = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Minor. This can be a global function rather than a member if the ITraceManager interface.


static ISpan * getNullSpan()
{
if(!nullSpan)
Copy link
Member

Choose a reason for hiding this comment

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

Not thread safe - probably simplest to create at startup. getNullSpan() can be a global function rather than a static member to avoid the cicular dependency that might result.

class CNullSpan : public CInterfaceOf<ISpan>
{
public:
virtual void setSpanAttribute(const char * key, const char * val) override {};
Copy link
Member

Choose a reason for hiding this comment

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

trivial: the trailing ; are not needed on the function definitions.

@rpastrana rpastrana force-pushed the HPCC-30405-CNullSpan branch from 04e5bf5 to 8f27049 Compare October 23, 2023 21:26
@rpastrana rpastrana requested a review from ghalliday October 25, 2023 18:35
@rpastrana
Copy link
Member Author

@ghalliday please review.

Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

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

@rpastrana please squash (and remove change left in by mistake?)

@@ -25,6 +25,10 @@ global:
logging:
detail: 80

#
Copy link
Member

Choose a reason for hiding this comment

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

@rpastrana I think left in by mistake.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ghalliday yep, removing. But do we care to keep it as enabled in the default values file?

@rpastrana rpastrana force-pushed the HPCC-30405-CNullSpan branch from 9d2e47e to 2a5853f Compare October 27, 2023 13:24
@@ -25,6 +25,10 @@ global:
logging:
detail: 80

# tracing sets the default tracing information for all components. Can be overridden locally
Copy link
Member Author

Choose a reason for hiding this comment

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

@ghalliday Added the comment I initially had intended to expose here

@rpastrana rpastrana requested a review from ghalliday October 27, 2023 13:25
Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

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

@rpastrana I can merge as is, or you can include a change to rename the option. The option should also be in the schema - with a description, because I am not quite sure of its effect.

@@ -25,6 +25,10 @@ global:
logging:
detail: 80

# tracing sets the default tracing information for all components. Can be overridden locally
tracing:
disable: false
Copy link
Member

@ghalliday ghalliday Oct 31, 2023

Choose a reason for hiding this comment

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

Picky. This option should be "disabled" for consistency for all the other uses.

@rpastrana rpastrana requested a review from ghalliday November 2, 2023 12:41
Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

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

@rpastrana please squash (and remove 1 space)

@@ -814,7 +841,7 @@ class CTraceManager : implements ITraceManager, public CInterface
Expected Configuration format:
global:
tracing: #optional - tracing enabled by default
disable: true #optional - disable OTel tracing
disabled: true #optional - disable OTel tracing
Copy link
Member

Choose a reason for hiding this comment

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

trivial: extra space

- Defines CNullSpan
- Adds cppunits
- Defaults activespans to CnullSpan
- Removes activespan nullptr checks
- Adds default global.tracing.disable
- Exposes getNullSpan jlib function
- Utilizes getNullSpan jlib function

- Renames disable config to disabled

Signed-off-by: Rodrigo Pastrana <[email protected]>
@rpastrana rpastrana force-pushed the HPCC-30405-CNullSpan branch from 46be75a to ad9a996 Compare November 2, 2023 14:25
@rpastrana
Copy link
Member Author

@ghalliday squashed

@ghalliday ghalliday merged commit 4ae09b1 into hpcc-systems:candidate-9.4.x Nov 2, 2023
50 of 51 checks passed
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.

2 participants