Since it's both more consistent to report all gRPC methods under the same metric, and easier to maintain the gRPC metrics when there is only one instance, we decided to move all of them under a common prefix, contrast_.
Future list of metrics
contrast_attestation_failures 8
contrast_coordinator_manifest_generation 1
contrast_grpc_server_handled_total
contrast_grpc_server_handling_seconds_bucket
contrast_grpc_server_handling_seconds_count
contrast_grpc_server_handling_seconds_sum
contrast_grpc_server_msg_received_total
contrast_grpc_server_msg_sent_total
contrast_grpc_server_started_total
Below is the original PR description with the motivation for refactoring userapi etc.
This PR moves the gRPC handlers for userapi and recoveryapi into the authority module. In the main module remain gRPC server setup (credentials, metrics, listener).
I'm mostly driven by the increasing complexity of changing code in both authority and userapi. We had to change the Authority API a couple of times, and adjusting the userapi test accordingly is cumbersome. Given that the Authority API is closely coupled to the gRPC API, it is probably for the best to merge the two and remove the current Authority API.
To keep things simple, I'm refactoring in several steps. This is the first step, which does the bare minimum to keep the boat afloat after the move. There are still some rough edges (I left a couple of TODOs), but it already allows to resolve this and that TODO, which are blocking RFC004 - the former here and the latter in a PoC commit [here].
Next, I need to consolidate the former Authority API with the userapi, which will mostly involve moving code around, and adapt the tests. Fortunately, these changes can now be interleaved with the recovery effort.
Review Recommendation
I split the PR into
a pure move of userapi*.go and recoveryapi.go
subsequent changes to adapt to their new habitat
It is probably easier to restrict the Changes from in the review tab to the second commit, so that you only see the actual changes. Otherwise, git does not consider the files related and the diffs are the entire files.
TODO:
[x] rename PR for changelog (user facing is the change in metric names)
During a refactoring, we discovered that the gRPC metrics include the service in both the metric name and a label:
Since it's both more consistent to report all gRPC methods under the same metric, and easier to maintain the gRPC metrics when there is only one instance, we decided to move all of them under a common prefix,
contrast_
.Future list of metrics
contrast_attestation_failures 8 contrast_coordinator_manifest_generation 1 contrast_grpc_server_handled_total contrast_grpc_server_handling_seconds_bucket contrast_grpc_server_handling_seconds_count contrast_grpc_server_handling_seconds_sum contrast_grpc_server_msg_received_total contrast_grpc_server_msg_sent_total contrast_grpc_server_started_total
Below is the original PR description with the motivation for refactoring userapi etc.
This PR moves the gRPC handlers for
userapi
andrecoveryapi
into theauthority
module. In the main module remain gRPC server setup (credentials, metrics, listener).I'm mostly driven by the increasing complexity of changing code in both
authority
anduserapi
. We had to change theAuthority
API a couple of times, and adjusting theuserapi
test accordingly is cumbersome. Given that theAuthority
API is closely coupled to the gRPC API, it is probably for the best to merge the two and remove the currentAuthority
API.To keep things simple, I'm refactoring in several steps. This is the first step, which does the bare minimum to keep the boat afloat after the move. There are still some rough edges (I left a couple of TODOs), but it already allows to resolve this and that TODO, which are blocking RFC004 - the former here and the latter in a PoC commit [here].
Next, I need to consolidate the former
Authority
API with theuserapi
, which will mostly involve moving code around, and adapt the tests. Fortunately, these changes can now be interleaved with the recovery effort.Review Recommendation
I split the PR into
userapi*.go
andrecoveryapi.go
It is probably easier to restrict the
Changes from
in the review tab to the second commit, so that you only see the actual changes. Otherwise, git does not consider the files related and the diffs are the entire files.TODO: