log

package
v0.0.0-...-a1c22f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AcceptLanguageHeader is the standard http header name used so that we don't have to pass in the http request
	AcceptLanguageHeader = "Accept-Language"
	// HostHeader is the standard http header Host used to indicate the target host name
	HostHeader = "Host"
	// ContentTypeHeader is the standard http header Content-Type
	ContentTypeHeader = "Content-Type"
	// RequestAPIVersionParameterName is the query string parameter name ARM adds for the api version
	RequestAPIVersionParameterName = "api-version"
	// RequestResourceTypeParameterName is the query string parameter name to distinguish between cluster types
	RequestResourceTypeParameterName = "resource-type"
	// RequestCorrelationIDHeader is the http header name ARM adds for the correlationID
	RequestCorrelationIDHeader = "x-ms-correlation-request-id"
	// RequestARMClientRequestIDHeader is the http header name ARM adds for the client request id
	RequestARMClientRequestIDHeader = "x-ms-client-request-id"
	// RequestGraphClientRequestIDHeader is the http header name graph adds for the client request id
	RequestGraphClientRequestIDHeader = "client-request-id"
	// RequestClientSessionIDHeader is the http header name ARM adds for the client session id
	RequestClientSessionIDHeader = "x-ms-client-session-id"
	// RequestClientApplicationIDHeader is the http header name ARM adds for the client app id
	RequestClientApplicationIDHeader = "x-ms-client-app-id"
	// RequestClientPrincipalNameHeader is the http header name ARM adds for the client principal name
	RequestClientPrincipalNameHeader = "x-ms-client-principal-name"
	// ResponseARMRequestIDHeader is the http header name our rp adds to uniquely identify this request, used by ARM
	ResponseARMRequestIDHeader = "x-ms-request-id"
	// ResponseGraphRequestIDHeader is the http header name our rp adds to uniquely identify this request, used by graph
	ResponseGraphRequestIDHeader = "request-id"
	// CredentialFormatParameterName is the query string parameter name, optional
	CredentialFormatParameterName = "format"
	// LoginMethodParameterName is the query string parameter name, optional
	LoginMethodParameterName = "login"
	// CredentialServerFQDNFormatParameterName is the query string parameter name, optional
	CredentialServerFQDNFormatParameterName = "server-fqdn"
	// AADTenantIDHeader is the header used by ARM to pass the requesting entity's AAD tenant ID to RP.
	AADTenantIDHeader = "x-ms-client-tenant-id"
	// LocationHeader is the http header name required for Accepted status
	LocationHeader = "Location"
	// AzureAsyncOperationHeader is the http header name required for async operation
	AzureAsyncOperationHeader = "Azure-AsyncOperation"
	// RetryAfterHeader is the http header name for client's back off duration
	RetryAfterHeader = "Retry-After"
	// UserAgentHeader is the http header name for the user agent
	UserAgentHeader = "User-Agent"
	// ForwardedForHeader is the http header name for identifying the original client IP address
	ForwardedForHeader = "X-Forwarded-For"
	// RealIPHeader is the http header name for identifying the client IP address
	RealIPHeader = "X-Real-Ip"
	// RetryAttemptHeader is the grpc header name for retry attempt count
	RetryAttemptHeader = "x-retry-attempty"
)
View Source
const (
	// RequestAcsOperationIDHeader is the http header name ACS RP adds for it's operation ID
	RequestAcsOperationIDHeader = "x-ms-acs-operation-id"
	//RequestClientCertThumbprintHeader contains the sha-1 thumbprint hash for the client cert, added by the nginx proxy in production clusters
	RequestClientCertThumbprintHeader = "x-ssl-cert-thumbprint"
)
View Source
const (
	// CorrelationID is the id that correlation an RP operation with ARM operation/request
	CorrelationID = "correlationID"
	// OperationID is the operation id to track a request received by ACS
	OperationID = "operationID"
	// HCPOperationID is the operation id of operation being processed by HCP service
	HCPOperationID = "hcpOperationID"
	// HCPControlPlaneID is the ID of the control-plane as set by HCP
	HCPControlPlaneID = "hcpControlPlaneID"
	// OperationName is the name of operation invoked by a request received by ACS
	OperationName = "operationName"
	// SubOperationName is the name of suboperation invoked by a request received by ACS
	SubOperationName = "subOperationName"
	// AADTenantID is the ID of the customer's AAD tenant
	AADTenantID = "aadTenantID"
	// SubscriptionID identifies a customer/an organization
	SubscriptionID = "subscriptionID"
	// ResourceGroupName contains a group of ARM (RP) resources
	ResourceGroupName = "resourceGroupName"
	// ResourceName is the name of ACS resource
	ResourceName = "resourceName"
	// DetectorName is the name of app lens detector
	DetectorName = "detectorName"
	// AgentPoolName is the name of the agentpool in the managed cluster.
	AgentPoolName = "agentPoolName"
	// MaintenanceConfigurationName is the name of the maintenanceConfiguration in the managed cluster.
	MaintenanceConfigurationName = "maintenanceConfiguration"
	// APIVersion is api version on which the request was sent to ACS
	APIVersion = "apiVersion"
	// AcceptLanguage is the language of request
	AcceptLanguage = "acceptLanguage"
	// ClientApplicationID is the value that came in http header for the client app id
	ClientApplicationID = "clientApplicationID"
	// ClientPrincipalName is the client principal name
	ClientPrincipalName = "clientPrincipalName"
	// ClientRequestID is the client request id
	ClientRequestID = "clientRequestID"
	// UserAgent is user agent of the request
	UserAgent = "userAgent"
	// MessageID is the messageID of a queue message
	MessageID = "messageID"
	// PopReceipt is the pop receipt of a queue message
	PopReceipt = "popReceipt"
	// InsertionTime is the insertion time of a queue message
	InsertionTime = "insertionTime"
	// ExpirationTime is the expiration time of a queue message
	ExpirationTime = "expirationTime"
	// DequeueCount is the dequeue count of a queue message
	DequeueCount = "dequeueCount"
	// TimeNextVisible is the time a queue message will become visible
	TimeNextVisible = "timeNextVisible"
	// OperationTimeout is the operation execution timeout
	OperationTimeout = "operationTimeout"
	// DelayStartInSeconds indicate worker not to pick up a message for this amount of time initially.
	DelayStartInSeconds = "delayStartInSeconds"
	// RegionName is the region of the service serving traffic
	RegionName = "region"
	// PropertiesBag is the field to put the properties
	PropertiesBag = "propertiesBag"

	// HCPUnderlayName is the name of the selected underlay for the hosted control-plane pods
	HCPUnderlayName = "hcpUnderlayName"
	//ControlPlaneAZEnabled is the propertyname which we set in propertybag for the existence az for the control plane
	ControlPlaneAZEnabled = "enableControlPlaneAZ"
	//AgentPoolAZEnabled is part of the propertyname which we set in propertybag for the existence az for the agentpool
	AgentPoolAZEnabled = "enableAZ"
	// InternalSubscription is the parameters map key used to indicate if the corresponding subscription ID in the
	// map is an internal subscription ID.
	InternalSubscription = "internalSubscription"

	// ExtensionAddonName is the name of the extension addon in the managed cluster.
	ExtensionAddonName = "extensionAddonName"
)
View Source
const (
	// DefaultSubOperationName is default suboperation name
	DefaultSubOperationName = "None"
	// LowerTrueString is the bool value = true as string used at multiple places
	LowerTrueString = "true"
)
View Source
const (
	//DefaultMessageTTL : set default message TTL for 3 days
	DefaultMessageTTL = time.Duration(72) * time.Hour

	//DefaultOperationTimeout : default timeout for completing an async operation (PUT/DELETE). The RP will
	// timeout the operation if long running operation does not complete in 120 minutes
	DefaultOperationTimeout = time.Duration(120) * time.Minute
)
View Source
const (
	Authentication        = AuditEventCategory("Authentication")
	Authorization         = AuditEventCategory("Authorization")
	UserManagement        = AuditEventCategory("UserManagement")
	GroupManagement       = AuditEventCategory("GroupManagement")
	RoleManagement        = AuditEventCategory("RoleManagement")
	ApplicationManagement = AuditEventCategory("ApplicationManagement")
	KeyManagement         = AuditEventCategory("KeyManagement")
	DirectoryManagement   = AuditEventCategory("DirectoryManagement")
	ResourceManagement    = AuditEventCategory("ResourceManagement")
	PolicyManagement      = AuditEventCategory("PolicyManagement")
	DeviceManagement      = AuditEventCategory("DeviceManagement")
	EntitlementManagement = AuditEventCategory("EntitlementManagement")
	PasswordManagement    = AuditEventCategory("PasswordManagement")
	ObjectManagement      = AuditEventCategory("ObjectManagement")
	IdentityProtection    = AuditEventCategory("IdentityProtection")
	Other                 = AuditEventCategory("Other")
)

audit event category types as defined in the Ifx documentation. little to no details on what they represent, so it is up to our interpretation we can request new types to be added.

View Source
const (
	CorrelationIDFieldName     = "correlationID"
	ClientSessionIDFieldName   = "clientSessionID"
	OperationIDFieldName       = "operationID"
	SourceFieldName            = "source"
	ClientRequestIDFieldName   = "clientRequestID"
	LatencyFieldName           = "latency"
	SubscriptionIDFieldName    = "subscriptionID"
	IsInternalSubFieldName     = "isInternalSub"
	ResourceGroupNameFieldName = "resourceGroupName"
	ResourceNameFieldName      = "resourceName"
	AgentPoolNameFieldName     = "agentPoolName"
	OperationNameFieldName     = "operationName"
	RegionFieldName            = "region"
	InsertionTimeFieldName     = "insertionTime"
	RetryAttemptFieldName      = "retryAttempt"

	SuboperationNameFieldName = "suboperationName"
	TruncatedLogFieldName     = "truncated"

	// user-agent field is already used by grpc request so a different namespace is needed
	UserAgentGRPC = "user-agent-grpc"
	HostNameGRPC  = "host-name-grpc"
)

Exported field names to use in the structured logger

View Source
const (
	QosSource   = "AcsQOSLog"
	TraceSource = "AcsTraceLog"
)

Event sources the logger uses that connect to the mdsd.d config to control the tables in geneva this gets uploaded to

View Source
const (
	NanoSecondToMillisecondConversionFactor = 1000 * 1000
	TimeFormat                              = "2006-01-02T15:04:05.999999999Z07:00"
)
View Source
const StackAnnotationKey string = "stackinfo"

StackAnnotationKey allows the kusto exporter to identify the stack annotation and extract it into columns

Variables

This section is empty.

Functions

func GetGlobalLogger

func GetGlobalLogger() *logrus.Entry

GetGlobalLogger gets the global logger

func New

func New(serviceName, version string) *log.Entry

New returns a new logger

func NewContextWithTeam

func NewContextWithTeam(ctx context.Context, team AKSTeam) context.Context

func ProfileSpan

func ProfileSpan(ctx context.Context, spanName string, team AKSTeam, executeFunc func(ctx context.Context) *apierror.Error) *apierror.Error

ProfileSpan creates a new span for provided function, sets errors on exit

func PropagatorMiddleware

func PropagatorMiddleware(inner http.Handler) http.Handler

PropagatorMiddleware will deserialize span information from a given http request and set it in the http context

func SpanContextFromRequest

func SpanContextFromRequest(req *http.Request) (trace.SpanContext, bool)

SpanContextFromRequest extracts a span context from a given request [used for testing, use Propagator middleware]

func SpanContextToRequest

func SpanContextToRequest(ctx context.Context, req *http.Request)

SpanContextToRequest is a wrapper to serialize span information from a given context into an http request

func StartSpan

func StartSpan(ctx context.Context, name string, team AKSTeam) (context.Context, *trace.Span)

StartSpan wrapper when there are no tags

func StartSpanWithTags

func StartSpanWithTags(ctx context.Context, name string, team AKSTeam, tags map[string]string) (context.Context, *trace.Span)

StartSpanWithTags wrapper around trace.StartSpan to add tags as attributes and also add additional apitracking fields

func WithAPITracking

func WithAPITracking(ctx context.Context, apiTracking *APITracking) context.Context

WithAPITracking appends the operation.APITracking onto a copy of the passed in context and returns the copy

func WithLogger

func WithLogger(ctx context.Context, logger *Logger) context.Context

WithLogger takes a context and logger then returns a child context with the logger attached

func WithTags

func WithTags(span *trace.Span, tags map[string]string)

WithTags adds additional tags as attributes to the trace.Span

Types

type AKSTeam

type AKSTeam string

AKSTeam is an AKS sub-team that owns certain AKS code or component. This info is imbedded in the trace spans as an attribute. Because we log the span ID for each log message, with the team info found in the span, for each error in the log we now know which sub-team owns it.

The ownership info is obtained from the following team WiKi page: https://msazure.visualstudio.com/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/16868/AKS-Service-Overview

const (

	// AKSTeamSameAsParent means the team owner of this child span is the same as its parent span.
	AKSTeamSameAsParent AKSTeam = ""
	AKSTeamUnknown      AKSTeam = "Unknown"

	// See the code comment of
	//    type AKSTeam string
	// to find the link to the WiKi page that contains mapping from the teams defined here to
	// the actual email group/engineers to contact.
	AKSTeamAddon             AKSTeam = "Addon"
	AKSTeamBilling           AKSTeam = "Billing"
	AKSTeamCCPPoolController AKSTeam = "CCPPoolController"
	AKSTeamKonnectivityVPN   AKSTeam = "Konnectivity_VPN"
	AKSTeamETCD              AKSTeam = "ETCD"
	AKSTeamEventGrid         AKSTeam = "EventGrid"
	AKSTeamHCPDataAccess     AKSTeam = "HCP_DataAccess"
	AKSTeamJITController     AKSTeam = "JITController"
	AKSTeamMSIAuth           AKSTeam = "MSI_Auth"
	AKSTeamNetworking        AKSTeam = "Networking"
	AKSTeamNodeProvisioning  AKSTeam = "NodeProvisioning"
	AKSTeamWindows           AKSTeam = "Windows"
	AKSTeamOverlayManager    AKSTeam = "OverlayManager"
	AKSTeamPrivateCluster    AKSTeam = "PrivateCluster"
	AKSTeamOperationQueue    AKSTeam = "OperationQueue"
	AKSTeamRegionalLooper    AKSTeam = "RegionalLooper"
	AKSTeamRP                AKSTeam = "RP"
	AKSTeamUpgrade           AKSTeam = "Upgrade"
)

func GetTeamFromContext

func GetTeamFromContext(ctx context.Context) AKSTeam

type APITracking

type APITracking struct {
	// contains filtered or unexported fields
}

APITracking is a type for storing all the context info needed to track an api call

func GetAPITracking

func GetAPITracking(ctx context.Context) (*APITracking, bool)

GetAPITracking retrieves the APITracking struct pointer out of a context struct

func NewAPITracking

func NewAPITracking(pathParameters map[string]string, request *http.Request, routePath string) *APITracking

NewAPITracking creates a new APITracking struct with data from the http request and returns a pointer to it

func NewAPITrackingFromOutgoingRequest

func NewAPITrackingFromOutgoingRequest(pathParameters map[string]string, request *http.Request, routePath, region string) (*APITracking, error)

NewAPITrackingFromOutgoingRequest creates a new APITracking struct with data from the out going request (extracting fields out of context) and returns a pointer to it

func NewAPITrackingFromParametersMap

func NewAPITrackingFromParametersMap(m map[string]interface{}) *APITracking

NewAPITrackingFromParametersMap creates a new APITracking struct with data pass in a map The intended use of this function is mainly for creating API tracking for queuemessageprocessor and unit testing.

func NewAPITrackingWithRegion

func NewAPITrackingWithRegion(pathParameters map[string]string, request *http.Request, routePath, region string) *APITracking

NewAPITrackingWithRegion creates a new APITracking struct with data from the http request and returns a pointer to it

func NewHealthAPITracking

func NewHealthAPITracking(region string) *APITracking

NewHealthAPITracking creates a new APITracking struct for a health check call

func (*APITracking) AddResultCodeDependency

func (at *APITracking) AddResultCodeDependency(value string)

AddResultCodeDependency sets the result code dependency

func (*APITracking) ConvertPropertiesBagtoString

func (at *APITracking) ConvertPropertiesBagtoString() string

ConvertPropertiesBagtoString is the function used to convert propertiesbag to string

func (*APITracking) GetAADTenantID

func (at *APITracking) GetAADTenantID() string

GetAADTenantID returns the AAD tenant id if it was provided by ARM

func (*APITracking) GetAPIVersion

func (at *APITracking) GetAPIVersion() string

GetAPIVersion returns the api version on the request

func (*APITracking) GetAcceptLanguage

func (at *APITracking) GetAcceptLanguage() string

GetAcceptLanguage returns the accept language from the header on the request

func (*APITracking) GetAccessProfileRoleName

func (at *APITracking) GetAccessProfileRoleName() string

GetAccessProfileRoleName returns the roleName

func (*APITracking) GetActionName

func (at *APITracking) GetActionName() string

GetActionName returns the actionName if it was on the request

func (*APITracking) GetAgentPoolCount

func (at *APITracking) GetAgentPoolCount() (int, error)

func (*APITracking) GetAgentPoolName

func (at *APITracking) GetAgentPoolName() string

GetAgentPoolName returns the agentpoolName if it was an agentpool request, else empty string.

func (*APITracking) GetAuxiliaryToken

func (at *APITracking) GetAuxiliaryToken() string

GetAuxiliaryToken gets aux token

func (*APITracking) GetClientAppID

func (at *APITracking) GetClientAppID() string

GetClientAppID returns the client app id

func (*APITracking) GetClientPrincipalName

func (at *APITracking) GetClientPrincipalName() string

GetClientPrincipalName returns the client principal id

func (*APITracking) GetClientRequestID

func (at *APITracking) GetClientRequestID() uuid.UUID

GetClientRequestID returns the client request id

func (*APITracking) GetClientSessionID

func (at *APITracking) GetClientSessionID() string

GetClientSessionID returns the client session id

func (*APITracking) GetContainerName

func (at *APITracking) GetContainerName() string

GetContainerName returns the container name if it was on the request else empty string

func (*APITracking) GetControlPlaneID

func (at *APITracking) GetControlPlaneID() string

GetControlPlaneID returns the control plane Id if it was on the request else empty string

func (*APITracking) GetCorrelationID

func (at *APITracking) GetCorrelationID() uuid.UUID

GetCorrelationID retrieves the correlation id from the APITracking struct

func (*APITracking) GetCredentialFormat

func (at *APITracking) GetCredentialFormat() string

GetCredentialFormat returns the credential format if it was on the request else empty string

func (*APITracking) GetCredentialServerFQDNFormat

func (at *APITracking) GetCredentialServerFQDNFormat() string

GetCredentialServerFQDNFormat returns the kubeconfig server type. It can be public or private for private cluster.

func (*APITracking) GetCxUnderlayName

func (at *APITracking) GetCxUnderlayName() string

GetCxUnderlayName returns the customer underlay name

func (*APITracking) GetDelayStartInSeconds

func (at *APITracking) GetDelayStartInSeconds() uint

GetDelayStartInSeconds returns the message start delay in seconds

func (*APITracking) GetDequeueCount

func (at *APITracking) GetDequeueCount() int

GetDequeueCount returns the dequeue count of a queue message

func (*APITracking) GetDetectorName

func (at *APITracking) GetDetectorName() string

GetDetectorName returns the detectorName if it was on the request else empty string

func (*APITracking) GetErrorAKSTeam

func (at *APITracking) GetErrorAKSTeam() string

func (*APITracking) GetErrorCategory

func (at *APITracking) GetErrorCategory() string

func (*APITracking) GetErrorDependency

func (at *APITracking) GetErrorDependency() string

func (*APITracking) GetErrorSubcode

func (at *APITracking) GetErrorSubcode() string

func (*APITracking) GetExpirationTime

func (at *APITracking) GetExpirationTime() time.Time

GetExpirationTime returns the expiration time of a queue message

func (*APITracking) GetExtensionAddonName

func (at *APITracking) GetExtensionAddonName() string

GetExtensionAddonName returns the extension addon name if it was a extension addon request, else empty string.

func (*APITracking) GetExtensionProviderName

func (at *APITracking) GetExtensionProviderName() string

GetExtensionProviderName return providerName of the extension resource

func (*APITracking) GetExtensionResourceName

func (at *APITracking) GetExtensionResourceName() string

GetExtensionResourceName return name of the extension resource

func (*APITracking) GetExtensionResourceType

func (at *APITracking) GetExtensionResourceType() string

GetExtensionResourceType return type of the extension resource

func (*APITracking) GetFQDN

func (at *APITracking) GetFQDN() string

GetFQDN returns the fqdn

func (*APITracking) GetHCPControlPlaneID

func (at *APITracking) GetHCPControlPlaneID() string

GetHCPControlPlaneID gets the HCP Control Plane ID

func (*APITracking) GetHCPOperationID

func (at *APITracking) GetHCPOperationID() string

GetHCPOperationID retrieves the operation id from the APITracking struct

func (*APITracking) GetHCPUnderlayName

func (at *APITracking) GetHCPUnderlayName() string

GetHCPUnderlayName gets the HCP Underlay Name

func (*APITracking) GetHost

func (at *APITracking) GetHost() string

GetHost returns the host name from the header on the request

func (*APITracking) GetHttpMethod

func (at *APITracking) GetHttpMethod() string

Get GetHttpMethod the http method on the request

func (*APITracking) GetInsertionTime

func (at *APITracking) GetInsertionTime() time.Time

GetInsertionTime returns the insertion time of a queue message

func (*APITracking) GetK8sCurrentVersion

func (at *APITracking) GetK8sCurrentVersion() string

GetK8sCurrentVersion is the function used to get k8s current Version

func (*APITracking) GetK8sGoalVersion

func (at *APITracking) GetK8sGoalVersion() string

GetK8sGoalVersion is the function used to get k8s goal Version

func (*APITracking) GetLoginMethod

func (at *APITracking) GetLoginMethod() string

GetLoginMethod returns the login method if it was on the request else empty string

func (*APITracking) GetMaintenanceConfigurationName

func (at *APITracking) GetMaintenanceConfigurationName() string

GetMaintenanceConfigurationName returns the maintenance configuration if it was a maintenance configuration request, else empty string.

func (*APITracking) GetMessageID

func (at *APITracking) GetMessageID() int

GetMessageID returns the message id of a queue message

func (*APITracking) GetMessageTTLSec

func (at *APITracking) GetMessageTTLSec() uint

GetMessageTTLSec returns the message TTL in seconds

func (*APITracking) GetOperationCategory

func (at *APITracking) GetOperationCategory() AuditEventCategory

GetOperationCategory returns the AuditEventCategory mapped to the current operation

func (*APITracking) GetOperationID

func (at *APITracking) GetOperationID() uuid.UUID

GetOperationID retrieves the operation id from the APITracking struct

func (*APITracking) GetOperationName

func (at *APITracking) GetOperationName() string

GetOperationName returns the operation name

func (*APITracking) GetOperationTimeout

func (at *APITracking) GetOperationTimeout() time.Duration

GetOperationTimeout returns operation execution time limit in seconds

func (*APITracking) GetPodName

func (at *APITracking) GetPodName() string

GetPodName returns the podName if it was on the request else empty string

func (*APITracking) GetPopReceipt

func (at *APITracking) GetPopReceipt() string

GetPopReceipt returns the pop receipt of a queue message

func (*APITracking) GetPrivateEndpointConnectionName

func (at *APITracking) GetPrivateEndpointConnectionName() string

GetPrivateEndpointConnectionName returns the privateEndpointConnection if it was on the request else empty string

func (*APITracking) GetPropertiesBag

func (at *APITracking) GetPropertiesBag() map[string]string

GetPropertiesBag returns propertiesbag

func (*APITracking) GetReferer

func (at *APITracking) GetReferer() string

GetReferer returns the referer on the request

func (*APITracking) GetRegion

func (at *APITracking) GetRegion() string

GetRegion returns a request's target region

func (*APITracking) GetResourceGroupName

func (at *APITracking) GetResourceGroupName() string

GetResourceGroupName returns the resourceGroupName if it was on the request else empty string

func (*APITracking) GetResourceName

func (at *APITracking) GetResourceName() string

GetResourceName returns the resourceName if it was on the request else empty string

func (*APITracking) GetResourceType

func (at *APITracking) GetResourceType() string

GetResourceType returns the resourceType if it was on the request else empty string

func (*APITracking) GetResultCodeDependency

func (at *APITracking) GetResultCodeDependency() string

GetResultCodeDependency gets the result code dependency in comma separated string

func (*APITracking) GetSpanContext

func (at *APITracking) GetSpanContext() (trace.SpanContext, bool)

GetSpanContext retrieves the SpanContext when handling a message

func (*APITracking) GetSubOperationName

func (at *APITracking) GetSubOperationName() string

GetSubOperationName returns the suboperation name

func (*APITracking) GetSubnetName

func (at *APITracking) GetSubnetName() string

GetSubnetName returns the subnet name if it was on the request else empty string

func (*APITracking) GetSubscriptionID

func (at *APITracking) GetSubscriptionID() uuid.UUID

GetSubscriptionID returns the subscription id if it was on the request else empty string

func (*APITracking) GetSubscriptionIDString

func (at *APITracking) GetSubscriptionIDString() string

GetSubscriptionIDString returns the subscription ID as a string. This avoids coupling the caller to a specific version of the UUID package as would occur when using GetSubscriptionID.

func (*APITracking) GetTargetURI

func (at *APITracking) GetTargetURI() string

GetTargetURI returns the target URI on the request

func (*APITracking) GetTimeNextVisible

func (at *APITracking) GetTimeNextVisible() time.Time

GetTimeNextVisible returns the next visible time of a queue message

func (*APITracking) GetToBeDeletedAgentPoolLabels

func (at *APITracking) GetToBeDeletedAgentPoolLabels() (map[string]map[string]string, error)

GetLabels returns the custom node labels if it was on the request else nil

func (*APITracking) GetUserAgent

func (at *APITracking) GetUserAgent() string

GetUserAgent returns the user agent on the request

func (*APITracking) GetVMName

func (at *APITracking) GetVMName() string

GetVMName returns the vmName if it was on the request

func (*APITracking) GetVirtualNetworkName

func (at *APITracking) GetVirtualNetworkName() string

GetVirtualNetworkName returns the virtual network name if it was on the request else empty string

func (*APITracking) IsAdminOperation

func (at *APITracking) IsAdminOperation() bool

IsAdminOperation returns whether this operation is admin operation

func (*APITracking) IsAgentPoolAZEnabled

func (at *APITracking) IsAgentPoolAZEnabled() bool

IsAgentPoolAZEnabled checks whether the agentPool is az enabled or not this will have a valid value for agent pool operations

func (*APITracking) IsControlPlaneAZEnabled

func (at *APITracking) IsControlPlaneAZEnabled() bool

IsControlPlaneAZEnabled checks whether the cluster is az enabled or not

func (*APITracking) IsInternalSubscription

func (at *APITracking) IsInternalSubscription() bool

IsInternalSubscription returns true if the subscription ID is an internal subscription ID.

func (*APITracking) SetAgentPoolCount

func (at *APITracking) SetAgentPoolCount(count int)

func (*APITracking) SetAgentPoolName

func (at *APITracking) SetAgentPoolName(name string)

SetAgentPoolName sets the agentpoolName

func (*APITracking) SetAuxiliaryToken

func (at *APITracking) SetAuxiliaryToken(token string)

SetAuxiliaryToken sets aux token

func (*APITracking) SetControlPlaneID

func (at *APITracking) SetControlPlaneID(controlPlane string)

func (*APITracking) SetCxUnderlayName

func (at *APITracking) SetCxUnderlayName(cxUnderlayName string)

SetCxUnderlayName sets the customer underlay name

func (*APITracking) SetDelayStartInSeconds

func (at *APITracking) SetDelayStartInSeconds(delayStartInSeconds uint)

SetDelayStartInSeconds set the message start delay in seconds

func (*APITracking) SetErrorAKSTeam

func (at *APITracking) SetErrorAKSTeam(aksTeam string)

func (*APITracking) SetErrorCategory

func (at *APITracking) SetErrorCategory(category string)

func (*APITracking) SetErrorDependency

func (at *APITracking) SetErrorDependency(dep string)

func (*APITracking) SetErrorSubcode

func (at *APITracking) SetErrorSubcode(subcode string)

func (*APITracking) SetExtensionAddonName

func (at *APITracking) SetExtensionAddonName(name string)

SetExtensionAddonName sets the extensionAddonName

func (*APITracking) SetFQDN

func (at *APITracking) SetFQDN(fqdn string)

SetFQDN sets the fqdn

func (*APITracking) SetHCPControlPlaneID

func (at *APITracking) SetHCPControlPlaneID(cpid string)

SetHCPControlPlaneID sets the HCP Control Plane ID

func (*APITracking) SetHCPUnderlayName

func (at *APITracking) SetHCPUnderlayName(underlayName string)

SetHCPUnderlayName sets the HCP Underlay Name

func (*APITracking) SetHost

func (at *APITracking) SetHost(h string)

SetHost sets operation host

func (*APITracking) SetInsertionTime

func (at *APITracking) SetInsertionTime(d time.Time)

SetInsertionTime sets queue message insertion time

func (*APITracking) SetMaintenanceConfigurationName

func (at *APITracking) SetMaintenanceConfigurationName(name string)

SetMaintenanceConfigurationName sets the maintenanceConfigurationName

func (*APITracking) SetMessageTTL

func (at *APITracking) SetMessageTTL(ttl time.Duration)

SetMessageTTL sets message TTL

func (*APITracking) SetOperationTimeout

func (at *APITracking) SetOperationTimeout(d time.Duration)

SetOperationTimeout sets operation execution time limit

func (*APITracking) SetPropertiesBag

func (at *APITracking) SetPropertiesBag(key, value string)

SetPropertiesBag set the properties bag

func (*APITracking) SetRegion

func (at *APITracking) SetRegion(region string)

SetRegion sets the region of target resource

func (*APITracking) SetSpanContext

func (at *APITracking) SetSpanContext(sc trace.SpanContext)

SetSpanContext propagates the SpanContext from sync to async

func (*APITracking) SetSubOperationName

func (at *APITracking) SetSubOperationName(subOperationName string)

SetSubOperationName sets the suboperation name

func (*APITracking) SetToBeDeletedAgentPoolLabels

func (at *APITracking) SetToBeDeletedAgentPoolLabels(labels map[string]map[string]string) error

GetLabels returns the custom node labels if it was on the request else nil

type Logger

type Logger struct {
	TraceLogger *logrus.Entry
	QosLogger   *logrus.Entry
}

Logger is a type that can log trace logs or

func GetContextlessTraceLogger

func GetContextlessTraceLogger() *Logger

GetContextlessTraceLogger returns a logger that can be used outside of a context

func GetLogger

func GetLogger(ctx context.Context) *Logger

GetLogger pulls a logger off the context and returns it

func GetLoggerWithFallback

func GetLoggerWithFallback(ctx context.Context, fallback func() *Logger) *Logger

func GetQueueWatcherLogger

func GetQueueWatcherLogger() *Logger

TODO(thgamble) - 5/5/20 - possible move? only used in ./common/cmd/queuewatcher/queuewatcher.go GetQueueWatcherLogger returns a logger to use in the queue watcher

func InitializeTestLogger

func InitializeTestLogger() *Logger

InitializeTestLogger initializes a logger that can be used in a test

func InitializeTestLoggerWithLevel

func InitializeTestLoggerWithLevel(level logrus.Level) *Logger

InitializeTestLoggerWithLevel initializes a logger that can be used in a test, but with specified trace level

func NewAddonTokenReconcilerLogger

func NewAddonTokenReconcilerLogger(apiTracking *APITracking) *Logger

NewAddonTokenReconcilerLogger creates a logger supposed to be used by addon token reconciler

func NewGRPCOutgoingRequestLogger

func NewGRPCOutgoingRequestLogger(ctx context.Context, fullMethod string) *Logger

NewGRPCOutgoingRequestLogger creates an outgoing request logger for gRPC requests

func NewIncomingGRPCRequestLogger

func NewIncomingGRPCRequestLogger(ctx context.Context, req interface{}, fullMethod, region string) *Logger

NewIncomingGRPCRequestLogger creates a request logger for GRPC

func NewIncomingRequestLogger

func NewIncomingRequestLogger(apiTracking *APITracking, req *http.Request, routeName string) *Logger

NewIncomingRequestLogger creates an incoming request logger

func NewLogger

func NewLogger(apiTracking *APITracking) *Logger

NewLogger makes a new Logger that can log trace and qos events

func NewLoggerWithCustomWriter

func NewLoggerWithCustomWriter(formatter logrus.Formatter, customWriter io.Writer) *Logger

NewLoggerWithCustomWriter used for testing to overwrite the logger output used by codebase for verification of log fields

func NewLoggerWithFields

func NewLoggerWithFields(logger *Logger, fields map[string]interface{}) *Logger

NewLoggerWithFields returns a new logger with additional fields

func NewMSIConnectorLogger

func NewMSIConnectorLogger(apiTracking *APITracking) *Logger

NewMSIConnectorLogger creates a logger supposed to be used by msi connector

func NewMSICredentialRefresherLogger

func NewMSICredentialRefresherLogger() *Logger

NewMSICredentialRefresherLogger creates a logger supposed to be used by msi credential refresher

func NewOutgoingRequestLogger

func NewOutgoingRequestLogger(apiTracking *APITracking, request *http.Request) *Logger

NewOutgoingRequestLogger creates an outgoing request logger

func NewOutgoingRequestLoggerForLogrus

func NewOutgoingRequestLoggerForLogrus(logrus *logrus.Entry, apiTracking *APITracking, request *http.Request) *Logger

NewOutgoingRequestLoggerForLogrus creates an outgoing request logger from a Logrus logger.

func NewServiceLogger

func NewServiceLogger(sourceName string, fields map[string]interface{}) *Logger

NewServiceLogger creates a logger for a specific service

func (*Logger) Debug

func (l *Logger) Debug(ctx context.Context, msg string)

func (*Logger) Debugf

func (l *Logger) Debugf(ctx context.Context, format string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string)

func (*Logger) ErrorWithStack

func (l *Logger) ErrorWithStack(ctx context.Context, err error)

func (*Logger) Errorf

func (l *Logger) Errorf(ctx context.Context, format string, args ...interface{})

func (*Logger) Errorw

func (l *Logger) Errorw(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(ctx context.Context, msg string)

func (*Logger) Fatalf

func (l *Logger) Fatalf(ctx context.Context, format string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string)

func (*Logger) Infof

func (l *Logger) Infof(ctx context.Context, msg string, args ...interface{})

func (*Logger) InfofWithLatency

func (l *Logger) InfofWithLatency(ctx context.Context, latency time.Duration, fmt string, args ...interface{})

func (*Logger) Infow

func (l *Logger) Infow(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) Panicw

func (l *Logger) Panicw(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) QOSEvent

func (logger *Logger) QOSEvent(fields map[string]interface{}, placeHolder string)

func (*Logger) TraceInfo

func (logger *Logger) TraceInfo(msg string)

TraceInfo logs a trace info line containing the message with a field name msg

func (*Logger) Warning

func (l *Logger) Warning(ctx context.Context, msg string)

func (*Logger) Warningf

func (l *Logger) Warningf(ctx context.Context, format string, args ...interface{})

func (*Logger) Warningw

func (l *Logger) Warningw(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) WithField

func (logger *Logger) WithField(key string, value interface{}) *Logger

WithField returns a new logger with the additional field, allowing to add context information on the fly

func (*Logger) WithFields

func (logger *Logger) WithFields(fields map[string]interface{}) *Logger

WithFields returns a new logger with additional fields, allowing to add context information on the fly

type SpanTrace

type SpanTrace interface {
	Debugf(ctx context.Context, format string, args ...interface{})
	Infof(ctx context.Context, format string, args ...interface{})
	Warningf(ctx context.Context, format string, args ...interface{})
	Errorf(ctx context.Context, format string, args ...interface{})
	Fatalf(ctx context.Context, format string, args ...interface{})

	Debug(ctx context.Context, msg string)
	Info(ctx context.Context, msg string)
	Warning(ctx context.Context, msg string)
	Error(ctx context.Context, msg string)
	ErrorWithStack(ctx context.Context, err error)
	Fatal(ctx context.Context, err error)

	Infow(msg string, keysAndValues ...interface{})
	Warningw(msg string, keysAndValues ...interface{})
	Errorw(msg string, keysAndValues ...interface{})
	Panicw(msg string, keysAndValues ...interface{})

	InfofWithLatency(ctx context.Context, latency time.Duration, fmt string, args ...interface{})
}

type Tracking

type Tracking interface {
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL