Skip to content
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

Fix RPC name override #11813

Merged
merged 4 commits into from
Jan 22, 2024
Merged

Fix RPC name override #11813

merged 4 commits into from
Jan 22, 2024

Conversation

dhaidashenko
Copy link
Collaborator

No description provided.

Copy link
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

@dhaidashenko dhaidashenko marked this pull request as ready for review January 18, 2024 18:59
Comment on lines 477 to 482
name := fmt.Sprintf("eth-sendonly-rpc-%d", i)
if node.Name != nil && *node.Name != "" {
name = *node.Name
}
rpc := evmclient.NewRPCClient(lggr, empty, (*url.URL)(node.HTTPURL), name, int32(i), chainID,
commonclient.Secondary)
Copy link
Contributor

Choose a reason for hiding this comment

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

It is safe to pass the nodeName directly. We validate that all nodes are named. Notice that we already pas it without nil check on the line below.

Suggested change
name := fmt.Sprintf("eth-sendonly-rpc-%d", i)
if node.Name != nil && *node.Name != "" {
name = *node.Name
}
rpc := evmclient.NewRPCClient(lggr, empty, (*url.URL)(node.HTTPURL), name, int32(i), chainID,
commonclient.Secondary)
rpc := evmclient.NewRPCClient(lggr, empty, (*url.URL)(node.HTTPURL), *node.Name, int32(i), chainID,
commonclient.Secondary)

Copy link
Collaborator

@samsondav samsondav left a comment

Choose a reason for hiding this comment

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

Can we get a test demonstrating what this fixes?

@jmank88
Copy link
Contributor

jmank88 commented Jan 18, 2024

Can we get a test demonstrating what this fixes?

We haven't had the ability to test prom metrics coherently in the past, since they are all mixed up in global state. However, we could add a txtar test and checks the /metrics endpoint, like for /health: https://github.com/smartcontractkit/chainlink/blob/develop/testdata/scripts/health/multi-chain.txtar

@dhaidashenko
Copy link
Collaborator Author

dhaidashenko commented Jan 19, 2024

Can we get a test demonstrating what this fixes?

We haven't had the ability to test prom metrics coherently in the past, since they are all mixed up in global state. However, we could add a txtar test and checks the /metrics endpoint, like for /health: https://github.com/smartcontractkit/chainlink/blob/develop/testdata/scripts/health/multi-chain.txtar

Added the test, but it does not feel that this is the right approach. The script seems too complex for txtar test. Also it's quite limited in terms of available metrics as node does not perform any actions. Automated check against soaked node might be a better option.

@jmank88
Copy link
Contributor

jmank88 commented Jan 19, 2024

Can we get a test demonstrating what this fixes?

We haven't had the ability to test prom metrics coherently in the past, since they are all mixed up in global state. However, we could add a txtar test and checks the /metrics endpoint, like for /health: develop/testdata/scripts/health/multi-chain.txtar

Added the test, but it does not feel that this is the right approach. The script seems too complex for txtar test. Also it's quite limited in terms of available metrics as node does not perform any actions. Automated check against soaked node might be a better option.

I was hoping it could be made simpler, but soak tests would be fine too 🤷

@cl-sonarqube-production
Copy link

Copy link
Contributor

@prashantkumar1982 prashantkumar1982 left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@dhaidashenko
Copy link
Collaborator Author

Can we get a test demonstrating what this fixes?

We haven't had the ability to test prom metrics coherently in the past, since they are all mixed up in global state. However, we could add a txtar test and checks the /metrics endpoint, like for /health: develop/testdata/scripts/health/multi-chain.txtar

Added the test, but it does not feel that this is the right approach. The script seems too complex for txtar test. Also it's quite limited in terms of available metrics as node does not perform any actions. Automated check against soaked node might be a better option.

I was hoping it could be made simpler, but soak tests would be fine too 🤷

@jmank88 on second thought, implementation of a more generalized "framework" for metrics testing seems like a high-effort low-priority task. As the current approach gets the job done in this particular case, do you mind merging the fix as is?

@jmank88
Copy link
Contributor

jmank88 commented Jan 22, 2024

I was hoping it could be made simpler, but soak tests would be fine too 🤷

@jmank88 on second thought, implementation of a more generalized "framework" for metrics testing seems like a high-effort low-priority task. As the current approach gets the job done in this particular case, do you mind merging the fix as is?

Did you try using the basic stderr/stdout commands? They accept grep patterns, so it seems like this could be checked with one line for each metric, like:

curl $NODEURL/metrics

stdout 'evm_pool_rpc_node_dials_total{evmChainID="68472",nodeName="BlueEVMPrimaryNode"}'
stdout ...

I don't fully understand the extra retry logic though. Was it flakey without?

@dhaidashenko
Copy link
Collaborator Author

I was hoping it could be made simpler, but soak tests would be fine too 🤷

@jmank88 on second thought, implementation of a more generalized "framework" for metrics testing seems like a high-effort low-priority task. As the current approach gets the job done in this particular case, do you mind merging the fix as is?

Did you try using the basic stderr/stdout commands? They accept grep patterns, so it seems like this could be checked with one line for each metric, like:

curl $NODEURL/metrics

stdout 'evm_pool_rpc_node_dials_total{evmChainID="68472",nodeName="BlueEVMPrimaryNode"}'
stdout ...

I don't fully understand the extra retry logic though. Was it flakey without?

I did not observe the flake. But Dial happens in a separate goroutine, so there is no guarantee that the metric is visible, when API is ready to handle requests.

@jmank88 jmank88 added this pull request to the merge queue Jan 22, 2024
Merged via the queue into develop with commit 41f2497 Jan 22, 2024
82 checks passed
@jmank88 jmank88 deleted the fix/BCI-2605-rpc-name branch January 22, 2024 14:46
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.

4 participants