Documentation ¶
Overview ¶
package for monitoring and reporting the daemon metrics
package for monitoring and reporting the daemon metrics
package for monitoring and reporting the daemon metrics
package for monitoring and reporting the daemon metrics
Index ¶
- func ConvertStructToJSON(payLoad interface{}) ([]byte, error)
- func GenXid() string
- func GetDaemonID() string
- func GetSize(v interface{}) uint64
- func GetValue(md metadata.MD, key string) string
- func HeartbeatHandler(rw http.ResponseWriter, r *http.Request)
- func Publish(payload interface{}, serviceUrl string) bool
- func PublishRequestStats(commonStat *CommonStats, inStream grpc.ServerStream) bool
- func PublishResponseStats(commonStats *CommonStats, duration time.Duration, err error) bool
- func RegisterDaemon(serviceURL string) bool
- func SetDaemonGrpId(grpId string)
- func SetIsNoAlertsConfig(state bool)
- func SetNoHeartbeatURLState(state bool)
- func ValidateHeartbeatConfig() error
- func ValidateNotificationConfig() error
- type CommonStats
- type DaemonHeartbeat
- type Notification
- type RegisterDaemonPayload
- type RequestStats
- type Response
- type ResponseStats
- type Status
- type TokenGenerated
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertStructToJSON ¶
convert the given struct to its corresponding json.
func GetDaemonID ¶
func GetDaemonID() string
generates DaemonID nad returns i.e. DaemonID = HASH (Org Name, Service Name, daemon endpoint)
func GetSize ¶
func GetSize(v interface{}) uint64
Generic utility to determine the size of the srtuct passed
func HeartbeatHandler ¶
func HeartbeatHandler(rw http.ResponseWriter, r *http.Request)
Heartbeat request handler function : upon request it will hit the service for status and wraps the results in daemons heartbeat
func PublishRequestStats ¶
func PublishRequestStats(commonStat *CommonStats, inStream grpc.ServerStream) bool
Create a request Object and Publish this to a service end point
func PublishResponseStats ¶
func PublishResponseStats(commonStats *CommonStats, duration time.Duration, err error) bool
Publish response received as a payload for reporting /metrics analysis If there is an error in the response received from the service, then send out a notification as well.
func RegisterDaemon ¶
New Daemon registration. Generates the DaemonID and use that as getting access token
func SetIsNoAlertsConfig ¶
func SetIsNoAlertsConfig(state bool)
set the no alerts URL and email State
func SetNoHeartbeatURLState ¶
func SetNoHeartbeatURLState(state bool)
set the no heartbeat URL State
func ValidateHeartbeatConfig ¶
func ValidateHeartbeatConfig() error
validates the heartbeat configurations
func ValidateNotificationConfig ¶
func ValidateNotificationConfig() error
validates the heartbeat configurations
Types ¶
type CommonStats ¶
type CommonStats struct { ID string ServiceMethod string RequestReceivedTime string OrganizationID string ServiceID string GroupID string DaemonEndPoint string Version string }
func BuildCommonStats ¶
func BuildCommonStats(receivedTime time.Time, methodName string) *CommonStats
type DaemonHeartbeat ¶
type DaemonHeartbeat struct { DaemonID string `json:"daemonID"` Timestamp string `json:"timestamp"` Status string `json:"status"` ServiceHeartbeat string `json:"serviceheartbeat"` }
define heartbeat data model. Service Status JSON object Array marshalled to a string
func GetHeartbeat ¶
func GetHeartbeat(serviceURL string, serviceType string, serviceID string) (heartbeat DaemonHeartbeat, err error)
prepares the heartbeat, which includes calling to underlying service DAemon is serving
func (*DaemonHeartbeat) Check ¶
func (service *DaemonHeartbeat) Check(ctx context.Context, req *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
Check implements `service Health`.
func (*DaemonHeartbeat) Watch ¶
func (service *DaemonHeartbeat) Watch(*grpc_health_v1.HealthCheckRequest, grpc_health_v1.Health_WatchServer) error
Watch implements `service Watch todo for later`.
type Notification ¶
type Notification struct { DaemonID string `json:"component_id"` Timestamp string `json:"timestamp"` Recipient string `json:"recipient"` Message string `json:"message"` Details string `json:"details"` Component string `json:"component"` Type string `json:"type"` Level string `json:"level"` }
define heartbeat data model. Service Status JSON object Array marshalled to a string
func (*Notification) Send ¶
func (alert *Notification) Send() bool
function for sending an alert to a given endpoint
type RegisterDaemonPayload ¶
type RequestStats ¶
type RequestStats struct { Type string `json:"type"` RegistryAddressKey string `json:"registry_address_key"` EthereumJsonRpcEndpointKey string `json:"ethereum_json_rpc_endpoint"` RequestID string `json:"request_id"` InputDataSize string `json:"input_data_size"` ServiceMethod string `json:"service_method"` RequestReceivedTime string `json:"request_received_time"` OrganizationID string `json:"organization_id"` ServiceID string `json:"service_id"` GroupID string `json:"group_id"` DaemonEndPoint string `json:"daemon_end_point"` Version string `json:"version"` }
Request stats that will be captured
type ResponseStats ¶
type ResponseStats struct { Type string `json:"type"` RegistryAddressKey string `json:"registry_address_key"` EthereumJsonRpcEndpointKey string `json:"ethereum_json_rpc_endpoint"` RequestID string `json:"request_id"` OrganizationID string `json:"organization_id"` ServiceID string `json:"service_id"` GroupID string `json:"group_id"` ServiceMethod string `json:"service_method"` ResponseSentTime string `json:"response_sent_time"` RequestReceivedTime string `json:"request_received_time"` ResponseTime string `json:"response_time"` ResponseCode string `json:"response_code"` ErrorMessage string `json:"error_message"` Version string `json:"version"` }
Response stats that will be captured and published