Documentation ¶
Overview ¶
Package servicecontext performs context values read/write, generally through server or client wrappers
Index ¶
- Constants
- func GetConfig(ctx context.Context) configx.Values
- func GetDAO(ctx context.Context) dao.DAO
- func GetOperationID(ctx context.Context) (string, string)
- func GetServiceName(ctx context.Context) string
- func HttpMetaExtractorWrapper(h http.Handler) http.Handler
- func HttpMetaFromGrpcContext(ctx context.Context, name string) (string, bool)
- func HttpRequestInfoToMetadata(ctx context.Context, req *http.Request) context.Context
- func HttpSpanHandlerWrapper(h http.Handler) http.Handler
- func NewMetricsHttpWrapper(h http.Handler) http.Handler
- func NewMetricsWrapper(service micro.Service)
- func ScanConfig(ctx context.Context, target interface{}) error
- func SpanClientWrapper(c client.Client) client.Client
- func SpanHandlerWrapper(fn server.HandlerFunc) server.HandlerFunc
- func SpanSubscriberWrapper(subscriberFunc server.SubscriberFunc) server.SubscriberFunc
- func WithConfig(ctx context.Context, config configx.Values) context.Context
- func WithDAO(ctx context.Context, dao dao.DAO) context.Context
- func WithOperationID(ctx context.Context, operationID string, operationLabel ...string) context.Context
- func WithServiceName(ctx context.Context, serviceName string) context.Context
- func WithSpan(ctx context.Context, s *Span) context.Context
- type Span
Constants ¶
const ( ContextMetaJobUuid = "X-Pydio-Job-Uuid" ContextMetaTaskUuid = "X-Pydio-Task-Uuid" ContextMetaTaskActionPath = "X-Pydio-Task-ActionPath" )
const ( HttpMetaExtracted = "HttpMetaExtracted" HttpMetaRemoteAddress = "RemoteAddress" HttpMetaRequestMethod = "RequestMethod" HttpMetaRequestURI = "RequestURI" HttpMetaHost = "RequestHost" HttpMetaHostname = "RequestHostname" HttpMetaPort = "RequestPort" HttpMetaProtocol = "HttpProtocol" HttpMetaUserAgent = "UserAgent" HttpMetaContentType = "ContentType" HttpMetaCookiesString = "CookiesString" ClientTime = "ClientTime" ServerTime = "ServerTime" CtxWorkspaceUuid = "CtxWorkspaceUuid" )
const ( SpanMetadataId = "x-pydio-span-id" SpanMetadataRootParentId = "x-pydio-span-root-id" OperationMetadataId = "x-pydio-operation-id" )
Variables ¶
This section is empty.
Functions ¶
func GetOperationID ¶ added in v1.4.0
GetRequestID returns the session id associated to this context
func GetServiceName ¶
GetServiceName returns the service name associated to this context
func HttpMetaExtractorWrapper ¶
HttpMetaExtractorWrapper extracts data from the request and puts it in a context Metadata field.
func HttpMetaFromGrpcContext ¶
HttpMetaFromGrpcContext extracts metadata from context that may have been passed along across services (meta name may be lowered cased)
func HttpRequestInfoToMetadata ¶
HttpRequestInfoToMetadata extracts as much HTTP metadata as possible and stores it in the context as metadata.
func HttpSpanHandlerWrapper ¶
Extract data from request and put it in context Metadata field
func NewMetricsHttpWrapper ¶ added in v1.4.0
func NewMetricsWrapper ¶ added in v1.4.0
func NewMetricsWrapper(service micro.Service)
func ScanConfig ¶
GetConfig already unmarshalled in a specific format
func SpanHandlerWrapper ¶
func SpanHandlerWrapper(fn server.HandlerFunc) server.HandlerFunc
func SpanSubscriberWrapper ¶ added in v1.4.0
func SpanSubscriberWrapper(subscriberFunc server.SubscriberFunc) server.SubscriberFunc
NewDAOSubscriberWrapper wraps a db connection for each subscriber
func WithConfig ¶
WithConfig links a config to the context
func WithOperationID ¶ added in v1.4.0
func WithOperationID(ctx context.Context, operationID string, operationLabel ...string) context.Context
WithSessionID returns a context which knows its session ID
func WithServiceName ¶
WithServiceName returns a context which knows its service name