Files
ziti/controller/network/service_counters.go
T
Cam Otts 405492ce92 Route error codes (#335)
* Initial work on adding route error codes to route responses

* updated messaging

* Split out terminator incrementors
Added handling for Service Errors
Added initial steps at deleting misbehaving terminators

* Added test for destroying and settin gprecedence on terminators
Added handling for terminator errors in routing

* inverted error switch

* cleanup for pr

* PR comments

* refactored conditional printing to account for single node paths that don't have links

* added error log when route status

* added another misconfigured error

Co-authored-by: Paul Lorenz <paul.lorenz@netfoundry.io>
2022-03-23 12:51:49 -05:00

60 lines
2.2 KiB
Go

package network
import (
"fmt"
"time"
)
type ServiceCounters interface {
ServiceDialSuccess(serviceId, terminatorId string)
ServiceDialFail(serviceId, terminatorId string)
ServiceDialTimeout(serviceId, terminatorId string)
ServiceDialOtherError(serviceId string)
ServiceTerminatorTimeout(serviceId, terminatorId string)
ServiceTerminatorConnectionRefused(serviceId, terminatorId string)
ServiceInvalidTerminator(serviceId, terminatorId string)
ServiceMisconfiguredTerminator(serviceId, terminatorId string)
}
func (network *Network) ServiceDialSuccess(serviceId, terminatorId string) {
combinedId := network.joinIds(serviceId, terminatorId)
network.serviceDialSuccessCounter.Update(combinedId, time.Now(), 1)
}
func (network *Network) ServiceDialFail(serviceId, terminatorId string) {
combinedId := network.joinIds(serviceId, terminatorId)
network.serviceDialFailCounter.Update(combinedId, time.Now(), 1)
}
func (network *Network) ServiceDialTimeout(serviceId, terminatorId string) {
combinedId := network.joinIds(serviceId, terminatorId)
network.serviceDialTimeoutCounter.Update(combinedId, time.Now(), 1)
}
func (network *Network) ServiceDialOtherError(serviceId string) {
network.serviceDialOtherErrorCounter.Update(serviceId, time.Now(), 1)
}
func (network *Network) ServiceTerminatorTimeout(serviceId, terminatorId string) {
combinedId := network.joinIds(serviceId, terminatorId)
network.serviceTerminatorTimeoutCounter.Update(combinedId, time.Now(), 1)
}
func (network *Network) ServiceTerminatorConnectionRefused(serviceId, terminatorId string) {
combinedId := network.joinIds(serviceId, terminatorId)
network.serviceTerminatorConnectionRefusedCounter.Update(combinedId, time.Now(), 1)
}
func (network *Network) ServiceInvalidTerminator(serviceId, terminatorId string) {
combinedId := network.joinIds(serviceId, terminatorId)
network.serviceInvalidTerminatorCounter.Update(combinedId, time.Now(), 1)
}
func (network *Network) ServiceMisconfiguredTerminator(serviceId, terminatorId string) {
combinedId := network.joinIds(serviceId, terminatorId)
network.serviceMisconfiguredTerminatorCounter.Update(combinedId, time.Now(), 1)
}
func (network *Network) joinIds(serviceId, terminatorId string) string {
return fmt.Sprintf("%v:%v", serviceId, terminatorId)
}