Skip to content

PMM-12548 Mongolog as new MongoDB query source.#3776

Merged
JiriCtvrtka merged 147 commits intov3from
PMM-12548-new-mongo-query-source
Jun 23, 2025
Merged

PMM-12548 Mongolog as new MongoDB query source.#3776
JiriCtvrtka merged 147 commits intov3from
PMM-12548-new-mongo-query-source

Conversation

@JiriCtvrtka
Copy link
Contributor

@JiriCtvrtka JiriCtvrtka commented Mar 13, 2025

PMM-12548

Link to the Feature Build: Percona-Lab/pmm-submodules#3913
Percona Toolkit PR: percona/percona-toolkit#951

  • Prepare doc about new query source

@JiriCtvrtka JiriCtvrtka changed the title PMM-12548 Slowlog as new MongoDB query source PMM-12548 Slowlog as new MongoDB query source. Mar 13, 2025
@codecov
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 48.46416% with 302 lines in your changes missing coverage. Please review.

Project coverage is 44.18%. Comparing base (62a08d2) to head (20dbdc6).
Report is 1 commits behind head on v3.

Files with missing lines Patch % Lines
managed/services/inventory/agents.go 0.00% 68 Missing ⚠️
agent/agents/mongodb/mongolog/internal/mongolog.go 66.23% 42 Missing and 10 partials ⚠️
.../inventory/add_agent_qan_mongodb_mongolog_agent.go 0.00% 43 Missing ⚠️
agent/agents/mongodb/mongolog/internal/monitor.go 68.10% 30 Missing and 7 partials ⚠️
managed/services/management/mongodb.go 0.00% 23 Missing ⚠️
managed/services/converters.go 0.00% 16 Missing ⚠️
agent/agents/mongodb/mongolog/mongodb.go 67.39% 13 Missing and 2 partials ⚠️
managed/services/agents/mongodb.go 0.00% 14 Missing ⚠️
agent/agents/supervisor/supervisor.go 0.00% 9 Missing ⚠️
managed/services/inventory/grpc/agents_server.go 0.00% 8 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##               v3    #3776      +/-   ##
==========================================
+ Coverage   44.15%   44.18%   +0.02%     
==========================================
  Files         369      373       +4     
  Lines       45356    45903     +547     
==========================================
+ Hits        20027    20282     +255     
- Misses      23645    23917     +272     
- Partials     1684     1704      +20     
Flag Coverage Δ
admin 17.31% <22.22%> (+0.03%) ⬆️
agent 53.05% <68.57%> (+0.44%) ⬆️
managed 44.80% <4.34%> (-0.19%) ⬇️
vmproxy 73.45% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@BupycHuk BupycHuk requested a review from Copilot June 23, 2025 06:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces Mongolog as a new MongoDB query source and integrates it across the agent, CLI, and inventory tooling.

  • Adds a new mongolog agent under agent/agents/mongodb/mongolog with monitor, aggregator, and sender workflow
  • Refactors profiler constants (timeouts, channel capacities) to unexported, named constants for clarity
  • Updates CLI and inventory commands to support the mongolog source and adds corresponding tests and Makefile adjustments for test data setup

Reviewed Changes

Copilot reviewed 20 out of 93 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
agent/agents/mongodb/profiler/internal/parser/parser.go Updated aggregator import path to shared package
agent/agents/mongodb/profiler/internal/monitors.go Renamed exported timeout constants to unexported identifiers
agent/agents/mongodb/profiler/internal/collector/collector.go Introduced collectorChanCapacity constant and replaced magic values
agent/agents/mongodb/mongolog/internal/monitor.go New log reader and parsing logic for Mongolog
agent/Makefile Added directories and files to support Mongolog test data
admin/commands/management/add_mongodb.go Added MongodbQuerySourceMongolog flag for CLI
admin/commands/list.go Integrated qanMongodbMongologAgents into the agents list
admin/commands/list_test.go Added tests for the Mongolog list command
Comments suppressed due to low confidence (1)

admin/commands/list_test.go:728

  • Typo in test data: "monoglog" should be "mongolog" to reflect the correct agent name.
					AgentID:    "qan-mongodb-monoglog-1",

Comment on lines +186 to +191
connections[connection.Client] = connection.User
}
logger.Debugf("connections: %+v", connections)
case disconnectQuery:
if connection, ok := getConnection(l.Attr, logger); ok {
delete(connections, connection.Remote)
Copy link
Contributor

Choose a reason for hiding this comment

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

is it intentional to have connection.Client in one place and connection.Remote in another?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added comment to describe it in code.

return
}

switch profile.Protocol {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this part still required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, right. Removed

JiriCtvrtka and others added 3 commits June 23, 2025 09:11
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JiriCtvrtka JiriCtvrtka enabled auto-merge (squash) June 23, 2025 10:56
@JiriCtvrtka JiriCtvrtka merged commit b4ba023 into v3 Jun 23, 2025
30 checks passed
@JiriCtvrtka JiriCtvrtka deleted the PMM-12548-new-mongo-query-source branch June 23, 2025 11:06
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.

6 participants