This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
PMM-5680 store logs #342
Open
qwest812
wants to merge
70
commits into
main
Choose a base branch
from
PMM-5680-store-logs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
PMM-5680 store logs #342
Changes from 9 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
167cbf3
Pmm-5680 store logs
qwest812 29764cc
Pmm-5680 store logs
qwest812 c8d2f68
Merge branch 'main' into PMM-5680-store-logs
qwest812 b673eaa
Pmm-5680 store logs
qwest812 9eda60e
Pmm-5680 store logs
qwest812 a6faa0b
Pmm-5680 store logs
qwest812 6f61509
Pmm-5680 store logs
qwest812 20a3ee2
Pmm-5680 store logs
qwest812 229845d
Pmm-5680 save logs process Done
qwest812 9161345
Pmm-5680 save logs process
qwest812 aa77af2
Pmm-5680 change dependency
qwest812 c6281e4
Merge branch 'main' into PMM-5680-store-logs
qwest812 5163ca9
Pmm-5680 update dependency
qwest812 e35cbc4
Pmm-5680 add mutex
qwest812 89a98da
Pmm-5680 fix tests
qwest812 989bb4f
Pmm-5680 fix tests
qwest812 9169b92
Pmm-5680 fix tests
qwest812 8562fbc
Pmm-5680 fix tests
qwest812 f0b2d6a
Pmm-5680 change process_child.go
qwest812 7a4863a
Pmm-5680 fix process_child.go
qwest812 c20a64c
Pmm-5680 fix mysql_show_table_status_action_test.go
qwest812 f2d3a40
Pmm-5680 gen
qwest812 50ebcaf
Pmm-5680 fix
qwest812 a0a6d44
Pmm-5680 update dependency
qwest812 a4bffaf
Pmm-5680 change name for logs
qwest812 fb64846
Pmm-5680 fix git actions
qwest812 fdc9f1a
Pmm-5680 fix git actions
qwest812 60dc79d
Pmm-5680 fix test
qwest812 8312f49
Pmm-5680 fix test
qwest812 3daddce
Pmm-5680 fix test
qwest812 dfc1597
Pmm-5680 fix lint
qwest812 cd38bd3
PMM-5680 Improvements
BupycHuk 9ff8dc0
PMM-5680 Improvements
BupycHuk 221a0b9
Pmm-5680 update storelogs
qwest812 729e3f1
Pmm-5680 remove function countLogs
qwest812 b24f6b5
Merge branch 'main' into PMM-5680-store-logs
qwest812 cb9c6b1
Merge branch 'PMM-5680-code-improvement-suggestions' into PMM-5680-st…
qwest812 7bd784b
Pmm-85680 update dependency
qwest812 b873ecc
Merge branch 'main' into PMM-5680-store-logs
qwest812 c53f291
Pmm-5680 response zipfile
qwest812 847932f
Pmm-5680 response zipfile
qwest812 77c8c83
Pmm-5680 fix mistake
qwest812 c686b5e
Pmm-5680 fix test
qwest812 c0bb005
Pmm-5680 fix test
qwest812 a709904
Pmm-5680 fix test
qwest812 e1da1ac
Pmm-5680 pretty
qwest812 5202e83
Pmm-5680 fix bug
qwest812 e44958a
Pmm-5680 fix bugs
qwest812 1657e70
Pmm-5680 change JSON to text
qwest812 c18be41
Pmm-5680 revert test
qwest812 1d77203
Pmm-5680 store serve logs
qwest812 c4151d3
Merge branch 'main' into PMM-5680-store-logs
qwest812 858e68c
Pmm-5680 store serve logs
qwest812 611c10e
Pmm-5680 fix test
qwest812 49cc0e6
Pmm-5680 remove struct AgentLogs
qwest812 60a0db6
Pmm-5680 remove id from map key
qwest812 ed5a7ce
Pmm-5680 set const number logs
qwest812 9d688bb
Pmm-5680 change function AgentsLogs
qwest812 545883a
Pmm-5680 remove comment
qwest812 96f10b0
Pmm-5680 fix linn err
qwest812 9880641
Pmm-5680 add small changes
qwest812 60e10a4
Pmm-5680 create test
qwest812 a0b10af
Pmm-5680 фвв еуые яшз ашду
qwest812 729bc50
Merge branch 'main' into PMM-5680-store-logs
qwest812 ecbac3d
Pmm-5680 make gen
qwest812 592965b
Pmm-5680 fix test
qwest812 f379d59
Pmm-5680 fix test
qwest812 29028f2
Pmm-5680 fix test
qwest812 f43cd91
Pmm-5680 fix test
qwest812 796c46d
pmm-5680 little changes
qwest812 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package supervisor | |
import ( | ||
"context" | ||
"fmt" | ||
"github.com/percona/pmm-agent/storelogs" | ||
"path/filepath" | ||
"regexp" | ||
"runtime/pprof" | ||
|
@@ -70,6 +71,7 @@ type agentProcessInfo struct { | |
done <-chan struct{} // closes when Process.Changes() channel closes | ||
requestedState *agentpb.SetStateRequest_AgentProcess | ||
listenPort uint16 | ||
logs *storelogs.LogsStore //store logs | ||
} | ||
|
||
// builtinAgentInfo describes built-in Agent. | ||
|
@@ -119,11 +121,13 @@ func (s *Supervisor) AgentsList() []*agentlocalpb.AgentInfo { | |
res := make([]*agentlocalpb.AgentInfo, 0, len(s.agentProcesses)+len(s.builtinAgents)) | ||
|
||
for id, agent := range s.agentProcesses { | ||
logs := agent.logs.GetLogs() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in scope of this task we don't have requirement to split logs per agent, but ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm surprised why it was made this way, although there was suggested implementation with a separate endpoint for logs. This implementation doesn't include all pmm-agent related logs(like logs related to connection to pmm-managed). |
||
info := &agentlocalpb.AgentInfo{ | ||
AgentId: id, | ||
AgentType: agent.requestedState.Type, | ||
Status: s.lastStatuses[id], | ||
ListenPort: uint32(agent.listenPort), | ||
Logs: logs, | ||
} | ||
res = append(res, info) | ||
} | ||
|
@@ -345,8 +349,9 @@ func (s *Supervisor) startProcess(agentID string, agentProcess *agentpb.SetState | |
"type": agentType, | ||
}) | ||
l.Debugf("Starting: %s.", processParams) | ||
|
||
process := process.New(processParams, agentProcess.RedactWords, l) | ||
ringLog := new(storelogs.LogsStore) | ||
ringLog.SetUp(30, l) | ||
process := process.New(processParams, agentProcess.RedactWords, l, ringLog) | ||
go pprof.Do(ctx, pprof.Labels("agentID", agentID, "type", agentType), process.Run) | ||
|
||
done := make(chan struct{}) | ||
|
@@ -368,6 +373,7 @@ func (s *Supervisor) startProcess(agentID string, agentProcess *agentpb.SetState | |
done: done, | ||
requestedState: proto.Clone(agentProcess).(*agentpb.SetStateRequest_AgentProcess), | ||
listenPort: port, | ||
logs: ringLog, | ||
} | ||
return nil | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's wrong, possible solution remove this requirement by some protoc --arg or by embeding [agentlocalpb|agentpb].UnimplementedAgentLocalServer