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

[chore][testbed] add filelog as a part of test cases #36603

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

VihasMakwana
Copy link
Contributor

Recently, we added memory limiter test cases for OTLP.
This PR updates the cases to work with filelog sender as well.

@VihasMakwana VihasMakwana requested a review from a team as a code owner November 29, 2024 16:26
@VihasMakwana VihasMakwana changed the title [chore[testbed] add filelog as a part of test cases [chore][testbed] add filelog as a part of test cases Nov 29, 2024
@VihasMakwana VihasMakwana added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Dec 2, 2024
@VihasMakwana
Copy link
Contributor Author

@ChrsMark can you please take at this PR? I've used options.

Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

Overall LGTM.

testbed/tests/scenarios.go Outdated Show resolved Hide resolved
@@ -658,9 +663,8 @@ func getLogsID(logToRetry []plog.Logs) []string {
logRecord := logElement.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords()
for index := 0; index < logRecord.Len(); index++ {
logObj := logRecord.At(index)
itemIndex, _ := logObj.Attributes().Get("item_index")
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, is this change required for the test that this PR adds? From what I can see it should be fine to include it but just want to understand why.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. It's required.

filelogwriter accepts logs in plog.Log and writes them in file. Here

for k := 0; k < ills.LogRecords().Len(); k++ {
_, err := f.file.Write(append(f.convertLogToTextLine(ills.LogRecords().At(k)), '\n'))
if err != nil {
return err
}

This is kind of a special case where the log attributes are a part of log body itself. That why I use regex.

For other senders (such as otlp), we start the corresponding exporter for a sender. In such scenarios, the attributes are preserved.

Let me know if you have any questions.

Co-authored-by: Christos Markou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry testbed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants