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

[receiver/mongodbatlas] Support collection of MongoDBAtlas Access Logs #21406

Merged
merged 23 commits into from
May 10, 2023

Conversation

dehaansa
Copy link
Contributor

@dehaansa dehaansa commented May 2, 2023

Description: Add the ability to collect MongoDB Atlas Access Logs

Link to tracking Issue: #21182

Testing: Unit test coverage & integration test based on a recently retrieved payload.

Documentation: Added documentation of configuration to the Readme.

@dehaansa dehaansa requested a review from a team May 2, 2023 15:50
@dehaansa dehaansa requested a review from djaglowski as a code owner May 2, 2023 15:50
@github-actions github-actions bot requested a review from schmikei May 2, 2023 15:51
Copy link
Contributor

@schmikei schmikei left a comment

Choose a reason for hiding this comment

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

Overall looks pretty good!! I have a couple concerns about upper limits and giving users control over a heavily accessed mongodbatlas and how this scales. But overall nice work!!

Some really nice refactors around the project config loading I love to see 🚀

receiver/mongodbatlasreceiver/access_logs.go Show resolved Hide resolved
nowTimestamp := pcommon.NewTimestampFromTime(now)
logs := transformAccessLogs(nowTimestamp, fullLogs, project, cluster, alr.logger)

if logs.LogRecordCount() > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I can imagine this being a bottleneck for logs. Say we are getting the max number of log entries of 20000 and we keep adding logs to the fullLogs. We only ever send the logs down at once so we could theoretically stream logs down the telemetry pipeline. Could we try consuming logs after each request when safe to not overload processors with large batches of logs?

receiver/mongodbatlasreceiver/config.go Outdated Show resolved Hide resolved
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

This looks good to me except I wonder if the separate configuration structure is appropriate.

receiver/mongodbatlasreceiver/README.md Outdated Show resolved Hide resolved
receiver/mongodbatlasreceiver/access_logs.go Show resolved Hide resolved
@dehaansa
Copy link
Contributor Author

dehaansa commented May 9, 2023

Since this got an approval - don't merge yet, figured out a timing issue in testing where logs are sometimes not available in the API for upwards of 1 minute, need to factor this delay into the start/end calculations to avoid data loss.

@dehaansa dehaansa requested review from djaglowski and schmikei May 9, 2023 17:49
Copy link
Contributor

@schmikei schmikei left a comment

Choose a reason for hiding this comment

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

Just requesting changes cause I have some minor concerns/design decisions I want to get clarification on (they may be necessary, just wanted to discuss them first).

Also was curious if users would ever want to run logs without project access_logs? It doesn't seem like that's a use case of the current implementation or its not a documented case in the testdata/README.md

receiver/mongodbatlasreceiver/README.md Show resolved Hide resolved
receiver/mongodbatlasreceiver/factory.go Outdated Show resolved Hide resolved
receiver/mongodbatlasreceiver/config.go Outdated Show resolved Hide resolved
@djaglowski djaglowski merged commit 2099155 into open-telemetry:main May 10, 2023
@github-actions github-actions bot added this to the next release milestone May 10, 2023
@dehaansa dehaansa deleted the mongodb-atlas-access-log branch May 10, 2023 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants