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

Feat: Log dumper #445

Merged
merged 6 commits into from
Dec 6, 2024
Merged

Feat: Log dumper #445

merged 6 commits into from
Dec 6, 2024

Conversation

waldgange
Copy link
Collaborator

@waldgange waldgange commented Oct 7, 2024

Introduce a set of parameters for log record dumping by a trigger message. This section can be added to the Broker config:

{
    ....
    "taskConfig": {
        ...
        "logDump": {
            "recordBufferSize": 32768,
            "recordingLevel": "TRACE",
            "triggerLevel": "FATAL"
        }
        ....
    }
    ....
}

Where:
recordBufferSize is a size of default logger's record buffer in bytes.
recordingLevel is the lowest severity level of the record that will be stored by the logger in its log record buffer.
triggerLevel is the lowest severity level of the record that will cause immediate publication of that record and any records in the logger's log record buffer.

@waldgange waldgange requested a review from a team as a code owner October 7, 2024 18:03
@waldgange waldgange changed the title Log dumper Feat: Log dumper Oct 8, 2024
Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 294 of commit 004c2fc has completed with FAILURE

@chrisbeard chrisbeard self-assigned this Oct 9, 2024
Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 298 of commit 28ec79b has completed with FAILURE

Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 300 of commit 8ce4504 has completed with FAILURE

@chrisbeard
Copy link
Contributor

Looks like there's a unit test for the log controller, let's extend that to test this as well.

I think the most important thing to make sure of with this test is that we don't break compatibility with older configs that don't utilize this.

@waldgange waldgange force-pushed the logdumper branch 3 times, most recently from 9a30dd5 to b827d6f Compare October 16, 2024 08:35
@waldgange
Copy link
Collaborator Author

@chrisbeard I've added a unit test for LogControllerConfig::fromObj(), also I've removed the outdated method fromDatum() and its unit test.
In order not to break compatibility with old broker configs we have to release this feature in two steps. As the first step we release the new config, containing the new parameters. When all machines upgrade to this version we will release the broker that retrieves new parameters from the config

Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 310 of commit a63f4e7 has completed with FAILURE

@waldgange waldgange force-pushed the logdumper branch 4 times, most recently from 5a0a785 to 7b9f24e Compare November 1, 2024 10:09
Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 351 of commit 7b9f24e has completed with FAILURE

Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 358 of commit f645c26 has completed with FAILURE

Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 360 of commit c3ef08d has completed with FAILURE

Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 372 of commit 6a93d60 has completed with FAILURE

Signed-off-by: Anton Pryakhin <[email protected]>
Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 378 of commit 84595e7 has completed with FAILURE

@@ -147,6 +147,9 @@ LogControllerConfig::LogControllerConfig(bslma::Allocator* allocator)
, d_syslogAppName("")
, d_syslogVerbosity(ball::Severity::ERROR)
, d_categories(allocator)
, d_recordBufferSize(32768)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where does this number come from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the default recordBufferSize of the ball::LoggerManagerConfiguration component we use to dump logs. We used to set it here

rc = lmc.setDefaultRecordBufferSizeIfValid(32768);

Now it's a variable. We are going to retrieve this number from the config

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this number in bytes? Can we just quickly mark the unit for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I've renamed the variable and added a comment in the same style as the variables above.

Comment on lines 532 to 533
// TODO: use obj.logDump() when the config is updated
// .setRecordBufferSize(obj.logDump().recordBufferSize());
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok I will remove this. This comment is a reminder to make the second step when all instances get the new version of the config. We used to leave such reminders in the past. Should we avoid them now?

Comment on lines 545 to 559
// if (ball::SeverityUtil::fromAsciiCaseless(
// &d_recordingVerbosity,
// obj.logDump().recordingLevel().c_str()) != 0) {
// errorDescription << "Invalid value for 'recordingLevel' ('"
// << obj.logDump().recordingLevel() << "')";
// return -1; // RETURN
// }

// if (ball::SeverityUtil::fromAsciiCaseless(
// &d_triggerVerbosity,
// obj.logDump().triggerLevel().c_str()) != 0) {
// errorDescription << "Invalid value for 'triggerLevel' ('"
// << obj.logDump().triggerLevel() << "')";
// return -1; // RETURN
// }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cleanup

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment on lines 79 to 80
// TODO: uncomment when setup of this parameter is uncommented
// lc.bslsLogSeverityThreshold() = "error";
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed this

/// might be partially altered. Refer to the component level
/// documentation (section: "LogControllerConfig: Datum format") for the
/// expected format of the `datum`.
int fromDatum(bsl::ostream& errorDescription, const bdld::Datum& datum);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this being deleted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't use it anywhere since 2019. We use 'fromObj()' method to parse the broker config instead

Signed-off-by: Anton Pryakhin <[email protected]>
@waldgange waldgange requested a review from hallfox November 22, 2024 09:56
src/groups/mqb/mqbcfg/mqbcfg_messages.cpp Outdated Show resolved Hide resolved
@@ -147,6 +147,9 @@ LogControllerConfig::LogControllerConfig(bslma::Allocator* allocator)
, d_syslogAppName("")
, d_syslogVerbosity(ball::Severity::ERROR)
, d_categories(allocator)
, d_recordBufferSize(32768)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this number in bytes? Can we just quickly mark the unit for it?

waldgange and others added 3 commits December 5, 2024 13:31
Co-authored-by: Taylor Foxhall <[email protected]>
Signed-off-by: Anton Pryakhin <[email protected]>
Signed-off-by: Anton Pryakhin <[email protected]>
@waldgange waldgange requested a review from hallfox December 5, 2024 15:08
Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 397 of commit 93c314c has completed with FAILURE

@waldgange waldgange merged commit 90b398b into bloomberg:main Dec 6, 2024
35 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.

3 participants