[#51] add address to logs #322

Open
pogpp wants to merge 1 commit from pogpp/frostfs-sdk-go:feature/51_improve_logger into master
Member

Signed-off-by: Pavel Pogodaev p.pogodaev@yadro.com

Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
pogpp added 1 commit 2025-01-24 09:42:03 +00:00
[#51] add address to logs
All checks were successful
DCO / DCO (pull_request) Successful in 27s
Code generation / Generate proto (pull_request) Successful in 35s
Tests and linters / Tests (pull_request) Successful in 50s
Tests and linters / Lint (pull_request) Successful in 1m24s
f3ede1fc56
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
requested reviews from storage-core-committers, storage-core-developers, storage-services-committers, storage-services-developers 2025-01-24 09:42:03 +00:00
pogpp was assigned by dkirillov 2025-01-24 13:22:09 +00:00
dkirillov reviewed 2025-01-24 13:24:26 +00:00
@ -167,3 +168,3 @@
return true, nil
}
return true, err
return true, fmt.Errorf("try put single '%s': %w", it.address, err)
Member

There are plenty of other methods in pool. Why do we change only this one?

There are plenty of other methods in pool. Why do we change only this one?
pogpp force-pushed feature/51_improve_logger from f3ede1fc56 to a7fa225b7e 2025-01-30 12:11:57 +00:00 Compare
pogpp force-pushed feature/51_improve_logger from a7fa225b7e to 5b92015d60 2025-01-30 12:12:55 +00:00 Compare
nzinkevich requested changes 2025-01-30 13:38:57 +00:00
pool/pool.go Outdated
@ -2670,6 +2670,10 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error {
prmCtx.useDefaultSession()
prmCtx.useVerb(session.VerbObjectDelete)
prmCtx.useAddress(prm.addr)
cp, err := p.connection()
Member

Why do we declare this if do not make any requests with it? It's not guaranteed that endpoint would be the same as here

Why do we declare this if do not make any requests with it? It's not guaranteed that endpoint would be the same as here
pool/pool.go Outdated
@ -2678,3 +2682,3 @@
relatives, err := relations.ListAllRelations(ctx, p, prm.addr.Container(), prm.addr.Object(), tokens)
if err != nil {
return fmt.Errorf("failed to collect relatives: %w", err)
return fmt.Errorf("failed to collect relatives via client %s: %w", cp.address(), err)
Member

ListAllRelations (and others) already contains address in error, returned from underlying methods

Line 3230 in 5b92015
return nil, fmt.Errorf("failed to get raw object header by addr: %s %w", cp.address(), err)


And here:

Line 3282 in 5b92015
return oid.ID{}, fmt.Errorf("failed to read split chain member's header by addr: %s %w", cp.address(), err)


Why do we add endpoint to error again?

Maybe we should add endpoint info in places e.g.:

Line 3287 in 5b92015
return oid.ID{}, relations.ErrNoLeftSibling

And:

Line 3228 in 5b92015
return nil, relations.ErrNoSplitInfo

`ListAllRelations` (and others) already contains address in error, returned from underlying methods https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/5b92015d603c07c447c04823b6099f6ad190a097/pool/pool.go#L3230 And here: https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/5b92015d603c07c447c04823b6099f6ad190a097/pool/pool.go#L3282 Why do we add endpoint to error again? Maybe we should add endpoint info in places e.g.: https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/5b92015d603c07c447c04823b6099f6ad190a097/pool/pool.go#L3287 And: https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/5b92015d603c07c447c04823b6099f6ad190a097/pool/pool.go#L3228
pogpp force-pushed feature/51_improve_logger from 5b92015d60 to 5f110ec850 2025-02-03 12:45:34 +00:00 Compare
pogpp force-pushed feature/51_improve_logger from 5f110ec850 to 16284cad49 2025-02-03 12:46:46 +00:00 Compare
requested review from nzinkevich 2025-02-03 12:46:55 +00:00
dkirillov reviewed 2025-02-04 10:02:43 +00:00
@ -167,3 +168,3 @@
return true, nil
}
return true, err
return true, fmt.Errorf("try put single '%s': %w", it.address, err)
Member

There are other places where error is returned. Why do we update only this?

There are other places where error is returned. Why do we update only this?
nzinkevich reviewed 2025-02-06 07:10:01 +00:00
@ -3241,3 +3249,3 @@
res, err := p.HeadObject(ctx, prm)
if err != nil {
return nil, fmt.Errorf("failed to get linking object's header: %w", err)
return nil, fmt.Errorf("failed to get linking object's header by addr: %s %w", cp.address(), err)
Member

It seems HeadObject returns an err with cc.endpoint already included

It seems HeadObject returns an err with cc.endpoint already included
@ -3291,3 +3307,3 @@
res, err := p.SearchObjects(ctx, prm)
if err != nil {
return nil, fmt.Errorf("failed to search objects by split ID: %w", err)
return nil, fmt.Errorf("failed to search objects by split ID by addr %s: %w", cp.address(), err)
Member

SearchObjects's err already had an endpoint info

Line 2900 in 16284ca
return fmt.Errorf("search object via client %s: %w", cc.endpoint, err)

SearchObjects's err already had an endpoint info https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/16284cad497c1661d58f8b55b4eb2c371e7f699b/pool/pool.go#L2900
@ -3323,3 +3343,3 @@
resSearch, err := p.SearchObjects(ctx, prm)
if err != nil {
return nil, fmt.Errorf("failed to find object children: %w", err)
return nil, fmt.Errorf("failed to find object children by addr %s: %w", cp.address(), err)
Member

Same

Same
All checks were successful
DCO / DCO (pull_request) Successful in 1m9s
Required
Details
Code generation / Generate proto (pull_request) Successful in 1m12s
Required
Details
Tests and linters / Tests (pull_request) Successful in 1m30s
Required
Details
Tests and linters / Lint (pull_request) Successful in 2m27s
Required
Details
This pull request doesn't have enough approvals yet. 0 of 2 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/51_improve_logger:pogpp-feature/51_improve_logger
git checkout pogpp-feature/51_improve_logger
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-committers
TrueCloudLab/storage-core-developers
TrueCloudLab/storage-services-committers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-sdk-go#322
No description provided.