-
Notifications
You must be signed in to change notification settings - Fork 324
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
move chanid metrics to chainservice #3544
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3544 +/- ##
==========================================
- Coverage 75.43% 74.07% -1.36%
==========================================
Files 247 253 +6
Lines 22845 23324 +479
==========================================
+ Hits 17233 17278 +45
- Misses 4685 5121 +436
+ Partials 927 925 -2
Continue to review full report at Codecov.
|
@@ -75,6 +99,13 @@ func (cs *ChainService) HandleAction(ctx context.Context, actPb *iotextypes.Acti | |||
if err != nil { | |||
return err | |||
} | |||
chainID := strconv.FormatUint(uint64(act.ChainID()), 10) |
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.
final comment: wrapping the code into a subfunc chainIDmetrics(act)
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.
done
chainservice/chainservice.go
Outdated
@@ -83,6 +108,16 @@ func (cs *ChainService) HandleAction(ctx context.Context, actPb *iotextypes.Acti | |||
return err | |||
} | |||
|
|||
func (cs *ChainService) chainIDmetrics(act action.SealedEnvelope) { |
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.
func chainIDMetrics(act action.SealedEnvelope) {}
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.
done
if act.ChainID() > 0 { | ||
_apiCallWithChainIDMtc.WithLabelValues(chainID).Inc() | ||
} else { | ||
recipient, _ := act.Destination() |
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 will be empty for staking action, change string to staking
in such case
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.
done
chainservice/chainservice.go
Outdated
@@ -75,6 +99,7 @@ func (cs *ChainService) HandleAction(ctx context.Context, actPb *iotextypes.Acti | |||
if err != nil { | |||
return err | |||
} | |||
chainIDmetrics(act) |
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.
move to L108, so duplicate action won't be counted
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.
done
//it will be empty for staking action, change string to staking in such case | ||
if recipient == "" { | ||
recipient = "staking" | ||
} |
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.
also it might be web3tx, use below to check
act, ok := selp.Action().(action.EthCompatibleAction)
ethTx, err := act.ToEthTx()
when all these did not check out, classify as "staking"
…task/config-get * 'task/config-get' of github.com:pocockn/iotex-core: modify test move chanid metrics to chainservice (iotexproject#3544) [ioctl] fix log entries created from user input (iotexproject#3546) add log in rolldposctx (iotexproject#3553) fix uncontrolled data used in path expression (iotexproject#3547) [api] impl. TestGrpcServer_GetServerMeta (iotexproject#3559)
…task/set-config * 'task/set-config' of github.com:pocockn/iotex-core: [test] Disable workingset cache in the benchmark test (iotexproject#3558) [pkg] fix deferring unsafe method "Close" on type "*os.File" (iotexproject#3548) [action] Refactor handleTransfer() (iotexproject#3557) Add MinVersion in tls.Config (iotexproject#3562) [ioctl] Modify file permission as 0600 (iotexproject#3563) [httputil] add ReadHeaderTimeout (iotexproject#3550) [staking] unexport namespace (iotexproject#3551) move chanid metrics to chainservice (iotexproject#3544) [ioctl] fix log entries created from user input (iotexproject#3546) add log in rolldposctx (iotexproject#3553) fix uncontrolled data used in path expression (iotexproject#3547) [api] impl. TestGrpcServer_GetServerMeta (iotexproject#3559) [ioctl] Build action command line into new ioctl (iotexproject#3472) fix potential file inclusion via variable (iotexproject#3549)
Co-authored-by: dustinxie <dahuaxie@gmail.com>
* upstream/master: (45 commits) Task: Get config cmd (iotexproject#3552) [ioctl] fix Errors unhandled (iotexproject#3567) fix dir permission and file inclusion (iotexproject#3566) [test] Disable workingset cache in the benchmark test (iotexproject#3558) [pkg] fix deferring unsafe method "Close" on type "*os.File" (iotexproject#3548) [action] Refactor handleTransfer() (iotexproject#3557) Add MinVersion in tls.Config (iotexproject#3562) [ioctl] Modify file permission as 0600 (iotexproject#3563) [httputil] add ReadHeaderTimeout (iotexproject#3550) [staking] unexport namespace (iotexproject#3551) move chanid metrics to chainservice (iotexproject#3544) [ioctl] fix log entries created from user input (iotexproject#3546) add log in rolldposctx (iotexproject#3553) fix uncontrolled data used in path expression (iotexproject#3547) [api] impl. TestGrpcServer_GetServerMeta (iotexproject#3559) [ioctl] Build action command line into new ioctl (iotexproject#3472) fix potential file inclusion via variable (iotexproject#3549) [ioctl] Incorrect conversion between integer types (iotexproject#3522) [action] fix incorrect conversion between integer types (iotexproject#3545) [test] fix TestLoadBlockchainfromDB (iotexproject#3521) ...
Description
delete chainid metrics in gRPC server, added in chainservice
Fixes #3489
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: