Documentation
¶
Index ¶
- Variables
- func CreateDialOptionsFromCtx(ctx *ContextMap) (opts *websocket.DialOptions, err error)
- func CreateMetaDataFromCtx(ctx *ContextMap, ctxWithCancel context.Context) (ctxWithMetaData context.Context, err error)
- func InitLogger(GlobalConfig *config.Config)
- type Config
- type ContextKey
- type ContextMap
- type Metric
- type Metrics
- type Point
- type Resource
Constants ¶
This section is empty.
Variables ¶
var DATADOG_API_KEY string
var DATADOG_LOGS bool
var DATADOG_LOGS_URL string
var DATADOG_METRICS bool
var DATADOG_METRICS_URL string
var DATADOG_SERVICE_NAME string
var DATADOG_SOURCE string
var DATADOG_STAGE string
var DATADOG_VERSION string
var ERROR_FILE_LOCATION string
Initialize config variables
var LOCAL_LOGS bool
var LOCAL_LOGS_LOCATION string
var LOG_LEVEL string
var Log loggerWrapper
Initialize the global logger variable.
Functions ¶
func CreateDialOptionsFromCtx ¶ added in v1.0.5
func CreateDialOptionsFromCtx(ctx *ContextMap) (opts *websocket.DialOptions, err error)
CreateDialOptionsFromCtx creates websocket dial options from the given ContextMap.
Parameters:
- ctx: the logging context map containing metadata values
Returns:
- opts: the websocket dial options with the attached metadata
- err: an error if the metadata creation fails
func CreateMetaDataFromCtx ¶ added in v1.0.5
func CreateMetaDataFromCtx(ctx *ContextMap, ctxWithCancel context.Context) (ctxWithMetaData context.Context, err error)
CreateMetaDataFromCtx creates gRPC metadata from the given ContextMap and attaches it to the provided context.
Parameters:
- ctx: the logging context map containing metadata values
- ctxWithCancel: the gRPC context to which the metadata will be attached
Returns:
- ctxWithMetaData: the new gRPC context with the attached metadata
- err: an error if the metadata creation or attachment fails
func InitLogger ¶
InitLogger initializes the global logger.
The function creates a new zap logger with the specified configuration and sets the global logger variable to the new logger.
Parameters:
- GlobalConfig: The global configuration from the config package.
Types ¶
type Config ¶
type Config struct {
ErrorFileLocation string
LogLevel string
LocalLogs bool
LocalLogsLocation string
DatadogLogs bool
DatadogSource string
DatadogStage string
DatadogVersion string
DatadogService string
DatadogAPIKey string
DatadogLogsURL string
DatadogMetrics bool
DatadogMetricsURL string
}
Config represents the configuration for the logging package.
type ContextKey ¶
type ContextKey string
ContextKey defines the supported context keys.
const ( InstructionGuid ContextKey = "instructionGuid" WorkflowId ContextKey = "workflowId" WorkflowRunId ContextKey = "workflowRunId" UserId ContextKey = "userId" AdapterType ContextKey = "adapterType" WatchFolderPath ContextKey = "watchFolderPath" WatchFilePath ContextKey = "watchFilePath" ReaderGuid ContextKey = "readerGuid" ClientGuid ContextKey = "clientGuid" Action ContextKey = "action" Rest_Call_Id ContextKey = "restCallId" Rest_Call ContextKey = "restCall" UserMail ContextKey = "userMail" )
type ContextMap ¶
type ContextMap struct {
// contains filtered or unexported fields
}
ContextMap represents a context for managing key-value pairs with specific context keys. It allows setting, retrieving, and copying context data associated with various keys.
func CreateCtxFromHeader ¶ added in v1.0.5
func CreateCtxFromHeader(request *http.Request) (ctx *ContextMap, err error)
CreateCtxFromHeader creates a ContextMap from HTTP request headers.
Parameters:
- request: the HTTP request containing the headers
Returns:
- ctx: the logging context map created from the headers
- err: an error if the header extraction or deserialization fails
func CreateCtxFromMetaData ¶ added in v1.0.5
func CreateCtxFromMetaData(ctxWithMetaData context.Context) (ctx *ContextMap, err error)
CreateCtxFromMetaData creates a ContextMap from gRPC metadata in the provided context.
Parameters:
- ctxWithMetaData: the gRPC context containing the metadata
Returns:
- ctx: the logging context map created from the metadata
- err: an error if the metadata extraction or deserialization fails
func (*ContextMap) Copy ¶
func (ctx *ContextMap) Copy() *ContextMap
Copy function copies the current contextMap so new uses of Set do not overwrite existing values
Returns:
- *ContextMap: A copy of the current ContextMap.
func (*ContextMap) Get ¶
func (ctx *ContextMap) Get(key ContextKey) (interface{}, bool)
Get function retrieves the value for a ContextKey
Parameters:
- key: The ContextKey for which to retrieve the value.
Returns:
- interface{}: The value associated with the specified ContextKey.
- bool: A boolean indicating whether the ContextKey exists.
func (*ContextMap) Set ¶
func (ctx *ContextMap) Set(key ContextKey, value interface{})
Set function sets ContextKeys equal to any value
type Metric ¶
type Metric struct {
Metric string `json:"metric"`
Type int `json:"type"`
Points []Point `json:"points"`
Resources []Resource `json:"resources"`
}
Metric represents a time series metric.
type Metrics ¶
type Metrics struct {
Series []Metric `json:"series"`
}
Metrics represents a collection of metrics.