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 ¶
Client holds the client state
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
DebugLog io.Writer
}
Config the client
type CustomIndexBody ¶
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,omitempty"` // OPS
EventID string `json:"eventId"` // 110114
Category string `json:"category,omitempty"` // TRACELOG
Component string `json:"component,omitempty"` // "TEST"
TransactionID string `json:"transactionId"` // 2abd7355-cbdd-43e1-b32a-43ec19cd98f0
ServiceName string `json:"serviceName,omitempty"` // OPS
ApplicationInstance string `json:"applicationInstance,omitempty"` // INST-00002
ApplicationVersion string `json:"applicationVersion,omitempty"` // 1.0.0
OriginatingUser string `json:"originatingUser,omitempty"` // SomeUser
ServerName string `json:"serverName,omitempty"` // app.example.com
LogTime string `json:"logTime"` // 2017-01-31T08:00:00Z
Severity string `json:"severity"` // INFO
TraceID string `json:"traceId,omitempty"` // xxx
SpanID string `json:"spanId,omitempty"` // yyy
LogData LogData `json:"logData"` // Log data
Custom json.RawMessage `json:"custom,omitempty"` // Custom log fields
Meta map[string]interface{} `json:"-"`
Error error `json:"-"`
}
Resource is a logging resource
type StoreResponse ¶
StoreResponse holds a LogEvent response
func (*StoreResponse) StatusCode ¶
func (r *StoreResponse) StatusCode() int