-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Evgenii Baidakov <[email protected]>
- Loading branch information
Showing
4 changed files
with
184 additions
and
28 deletions.
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package stat | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// Method is an enumerator to describe [client.Client] methods. | ||
type Method int | ||
|
||
const ( | ||
MethodBalanceGet Method = iota | ||
MethodContainerPut | ||
MethodContainerGet | ||
MethodContainerList | ||
MethodContainerDelete | ||
MethodContainerEACL | ||
MethodContainerSetEACL | ||
MethodEndpointInfo | ||
MethodNetworkInfo | ||
MethodObjectPut | ||
MethodObjectDelete | ||
MethodObjectGet | ||
MethodObjectHead | ||
MethodObjectRange | ||
MethodSessionCreate | ||
MethodNetMapSnapshot | ||
MethodObjectHash | ||
MethodObjectSearch | ||
methodLast | ||
) | ||
|
||
// String implements fmt.Stringer. | ||
func (m Method) String() string { | ||
switch m { | ||
case MethodBalanceGet: | ||
return "balanceGet" | ||
case MethodContainerPut: | ||
return "containerPut" | ||
case MethodContainerGet: | ||
return "containerGet" | ||
case MethodContainerList: | ||
return "containerList" | ||
case MethodContainerDelete: | ||
return "containerDelete" | ||
case MethodContainerEACL: | ||
return "containerEACL" | ||
case MethodContainerSetEACL: | ||
return "containerSetEACL" | ||
case MethodEndpointInfo: | ||
return "endpointInfo" | ||
case MethodNetworkInfo: | ||
return "networkInfo" | ||
case MethodObjectPut: | ||
return "objectPut" | ||
case MethodObjectDelete: | ||
return "objectDelete" | ||
case MethodObjectGet: | ||
return "objectGet" | ||
case MethodObjectHead: | ||
return "objectHead" | ||
case MethodObjectRange: | ||
return "objectRange" | ||
case MethodSessionCreate: | ||
return "sessionCreate" | ||
case MethodNetMapSnapshot: | ||
return "netMapSnapshot" | ||
case MethodObjectHash: | ||
return "objectHash" | ||
case MethodObjectSearch: | ||
return "objectSearch" | ||
case methodLast: | ||
return "it's a system name rather than a method" | ||
default: | ||
return "unknown" | ||
} | ||
} | ||
|
||
type ( | ||
// OperationCallback describes common interface to external statistic collection. | ||
OperationCallback = func(nodeKey []byte, endpoint string, method Method, duration time.Duration, err error) | ||
|
||
// Aggregator is a default statistic collector. | ||
Aggregator struct{} | ||
) | ||
|
||
// NewAggregator constructs a new Aggregator. | ||
func NewAggregator() Aggregator { | ||
return Aggregator{} | ||
} | ||
|
||
// Collect stores statistic from client. | ||
func (a *Aggregator) Collect(_ []byte, _ string, _ Method, _ time.Duration, _ error) { | ||
} |