Documentation
¶
Overview ¶
Package logging provides support for HSDP Logging services
Index ¶
Constants ¶
const (
// TimeFormat is the time format used for the LogTime field
TimeFormat = "2006-01-02T15:04:05.000Z07:00"
)
Variables ¶
var ( ErrMissingCredentialsOrIAMClient = errors.New("missing signing credentials or IAM client") ErrNothingToPost = errors.New("nothing to post") ErrMissingBaseURL = errors.New("missing base URL") ErrMissingProductKey = errors.New("missing ProductKey") ErrBatchErrors = errors.New("batch errors. check Invalid map for details") ErrResponseError = errors.New("unexpected HSDP response error") )
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct { ResourceType string `json:"resourceType"` Type string `json:"type"` Total int `json:"total"` ProductKey string `json:"productKey,omitempty"` Entry []Element `json:"entry"` }
Bundle is a FHIR bundle resource There is just enough there to create the logging payload
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the client state
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) StoreResources ¶
func (c *Client) StoreResources(msgs []Resource, count int) (*StoreResponse, error)
StoreResources posts one or more log messages In case invalid resources are detected StoreResources will return with ErrBatchErrors and the Response.Failed map will contain the resources This also happens in case the HSDP Ingestor API flags resources. In both cases the complete batch should be considered as not persisted and the LogEvents should be resubmitted for storage
type Config ¶
type Config struct { Region string Environment string IAMClient *iam.Client BaseURL string ProductKey string Debug bool }
Config the client
type CustomIndexBody ¶ added in v0.6.0
type CustomIndexBody []struct { Fieldname string `json:"fieldname"` Fieldtype string `json:"fieldtype"` }
CustomIndexBody describes the custom index request payload
type Element ¶
type Element struct {
Resource Resource `json:"resource"`
}
Element is a FHIR element resource
type ErrorResponse ¶
ErrorResponse holds an error response from the server
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type LogData ¶
type LogData struct {
Message string `json:"message"`
}
LogData is the payload of a log message
type Resource ¶
type Resource struct { ResourceType string `json:"resourceType"` // LogEvent ID string `json:"id"` // 7f4c85a8-e472-479f-b772-2916353d02a4 ApplicationName string `json:"applicationName"` // OPS EventID string `json:"eventId"` // 110114 Category string `json:"category"` // TRACELOG Component string `json:"component"` // "TEST" TransactionID string `json:"transactionId"` // 2abd7355-cbdd-43e1-b32a-43ec19cd98f0 ServiceName string `json:"serviceName"` // OPS ApplicationInstance string `json:"applicationInstance"` // INST-00002 ApplicationVersion string `json:"applicationVersion"` // 1.0.0 OriginatingUser string `json:"originatingUser"` // SomeUser ServerName string `json:"serverName"` // app.example.com LogTime string `json:"logTime"` // 2017-01-31T08:00:00Z Severity string `json:"severity"` // INFO LogData LogData `json:"logData"` // Log data Custom json.RawMessage `json:"custom,omitempty"` // Custom log fields Meta map[string]interface{} `json:"-"` }
Resource is a logging resource
type StoreResponse ¶ added in v0.15.0
Response holds a LogEvent response