Documentation ¶
Overview ¶
The code defines a Go package called "corel" that provides functionality for generating and managing correlation IDs.
Index ¶
- Constants
- func AmqpLoader(ctx context.Context, headers amqp.Table) amqp.Table
- func AmqpUnloader(ctx context.Context, headers amqp.Table) context.Context
- func EncodeCorel(corelid *CoRelationId) string
- func HttpCorelLoader(ctx context.Context, header http.Header) http.Header
- func HttpCorelUnLoader(ctx context.Context, header http.Header) context.Context
- func KafkaCorelLoader(ctx context.Context, headers []kafka.Header) []kafka.Header
- func KafkaCorelUnLoader(ctx context.Context, headers []kafka.Header) context.Context
- func NewChildContext(ctx context.Context, ids ...string) context.Context
- func NewContext(corelid *CoRelationId) context.Context
- func NewOrphanContext(ids ...string) context.Context
- type CoRelationId
Constants ¶
const CtxCorelLocator corelstr = "corel"
Variables ¶
This section is empty.
Functions ¶
func AmqpLoader ¶ added in v1.2.22
unloading of corel info from ctx and loading it in kafka header
func AmqpUnloader ¶ added in v1.2.22
This will be used to load corel from kafka message's header to context unloading of corel info from header and loading it in ctx
func EncodeCorel ¶ added in v1.2.12
func EncodeCorel(corelid *CoRelationId) string
func HttpCorelLoader ¶ added in v1.2.14
* inside header it will write `Corel`="base64 of json"
func HttpCorelUnLoader ¶ added in v1.2.14
*The below Unloader will work with gin.Context only.
func KafkaCorelLoader ¶ added in v1.2.14
unloading of corel info from ctx and loading it in kafka header
func KafkaCorelUnLoader ¶ added in v1.2.14
This will be used to load corel from kafka message's header to context unloading of corel info from header and loading it in ctx
func NewChildContext ¶
-- if len(ids)>0 then a new corel will be created and this will be set in cotenxt.WithValue with the createdCorelId attached -- else if the passed context have a corel, *The return context is context.WithValue and in th corel it has the child corel of that of passed corel context
func NewContext ¶
func NewContext(corelid *CoRelationId) context.Context
func NewOrphanContext ¶
Types ¶
type CoRelationId ¶
type CoRelationId struct { SessionId, RequestId, AppRequestId, RequestSource string // contains filtered or unexported fields }
CoRelationId correlationData
func DecodeCorel ¶ added in v1.2.12
func DecodeCorel(encoded []byte) (corelid *CoRelationId, err error)
func GetCorelationId ¶
func GetCorelationId(ctx context.Context) *CoRelationId
concurrent unsafe it adds corelId if not found
func NewCorelId ¶
func NewCorelId(ids ...string) *CoRelationId
ids[0] - sessionId ids[1] - requestId ids[3] - subRequestId ids[4] - requestSource
func NewCorelIdFromHttp ¶
func NewCorelIdFromHttp(header http.Header) *CoRelationId
func ReadCorelId ¶
func ReadCorelId(ctx context.Context) (*CoRelationId, error)
func (*CoRelationId) Child ¶ added in v1.2.13
func (corelid *CoRelationId) Child() *CoRelationId
func (*CoRelationId) GetRequestId ¶ added in v1.2.12
func (corelid *CoRelationId) GetRequestId() string
func (*CoRelationId) GetSessionId ¶ added in v1.2.12
func (corelid *CoRelationId) GetSessionId() string
func (*CoRelationId) Sibling ¶ added in v1.2.13
func (corelid *CoRelationId) Sibling() *CoRelationId