Documentation
¶
Index ¶
- func InjectField[T any](ctx context.Context, key string, value T) context.Context
- func InjectFields(ctx context.Context, fields map[string]string) context.Context
- func NewContext(ctx context.Context) context.Context
- func SetInContext(ctx context.Context, logger *Logger) context.Context
- func Setup(ctx context.Context, cfg MonitorConfig) (context.Context, error)
- func StartGRPCUnaryCallSegment(ctx context.Context, svcInfo ExternalServiceInfo, fullMethod string) (context.Context, func(error))
- func StartVaultSegment(ctx context.Context, info ExternalServiceInfo, operation string) func(error)
- type ExternalServiceInfo
- type GRPCRequestMetadata
- type LogField
- type Logger
- type MockOption
- type MockOption_Execute_Call
- type MockOption_Expecter
- type MonitorConfig
- type MonitorTest
- func (m MonitorTest) Context() context.Context
- func (m MonitorTest) GetLogger() *Logger
- func (m MonitorTest) GetLogs(t *testing.T) []map[string]interface{}
- func (m MonitorTest) GetPropagator() propagation.TextMapPropagator
- func (m MonitorTest) GetSpans() tracetest.SpanStubs
- func (m MonitorTest) GetTracer() trace.Tracer
- type Option
- type RequestMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InjectField ¶
InjectField injects a field to Logger and trace.Span in context
func InjectFields ¶
func NewContext ¶
NewContext copies the logger from old to a new context Use this when you want to use a new context but copy the logger over from the original context
func SetInContext ¶
SetInContext sets the logger in context
func StartVaultSegment ¶
func StartVaultSegment(ctx context.Context, info ExternalServiceInfo, operation string) func(error)
StartVaultSegment starts a trace.Span with vault information
Types ¶
type ExternalServiceInfo ¶
ExternalServiceInfo holds the ext svc info
func NewExternalServiceInfo ¶
func NewExternalServiceInfo(rawURL string) ExternalServiceInfo
NewExternalServiceInfo creates a new ExternalServiceInfo from the given url
type GRPCRequestMetadata ¶
func StartUnaryIncomingCall ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func FromContext ¶
FromContext gets the logger from context
func NewNoopLogger ¶
func NewNoopLogger() *Logger
type MockOption ¶
MockOption is an autogenerated mock type for the Option type
func NewMockOption ¶
func NewMockOption(t interface { mock.TestingT Cleanup(func()) }) *MockOption
NewMockOption creates a new instance of MockOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockOption) EXPECT ¶
func (_m *MockOption) EXPECT() *MockOption_Expecter
func (*MockOption) Execute ¶
func (_m *MockOption) Execute(_a0 *Logger)
Execute provides a mock function with given fields: _a0
type MockOption_Execute_Call ¶
MockOption_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
func (*MockOption_Execute_Call) Return ¶
func (_c *MockOption_Execute_Call) Return() *MockOption_Execute_Call
func (*MockOption_Execute_Call) Run ¶
func (_c *MockOption_Execute_Call) Run(run func(_a0 *Logger)) *MockOption_Execute_Call
func (*MockOption_Execute_Call) RunAndReturn ¶
func (_c *MockOption_Execute_Call) RunAndReturn(run func(*Logger)) *MockOption_Execute_Call
type MockOption_Expecter ¶
type MockOption_Expecter struct {
// contains filtered or unexported fields
}
func (*MockOption_Expecter) Execute ¶
func (_e *MockOption_Expecter) Execute(_a0 interface{}) *MockOption_Execute_Call
Execute is a helper method to define mock.On call
- _a0 *Logger
type MonitorConfig ¶
type MonitorTest ¶
type MonitorTest struct {
// contains filtered or unexported fields
}
func NewMonitorTest ¶
func NewMonitorTest() (MonitorTest, func())
func (MonitorTest) Context ¶
func (m MonitorTest) Context() context.Context
func (MonitorTest) GetLogger ¶
func (m MonitorTest) GetLogger() *Logger
func (MonitorTest) GetPropagator ¶
func (m MonitorTest) GetPropagator() propagation.TextMapPropagator
func (MonitorTest) GetSpans ¶
func (m MonitorTest) GetSpans() tracetest.SpanStubs
func (MonitorTest) GetTracer ¶
func (m MonitorTest) GetTracer() trace.Tracer
Source Files
¶
- context.go
- external_service_info.go
- instrument_http_incoming.go
- instrument_http_outgoing.go
- instrument_unary_incoming_call.go
- instrument_unary_outgoing_call.go
- instrument_vault.go
- instruments.go
- log_fields.go
- logger.go
- metadata_carrier.go
- mock_Option.go
- monitor.go
- new.go
- options.go
- test_utils.go
- tracer.go
- zap.go