Documentation ¶
Index ¶
- Variables
- func AppendFile(name string, data []byte, perm os.FileMode) error
- func CaptureEqualRequestURL() mw_client_model.CaptureMatcher
- func CaptureEqualRequestURLAndHeader(header string) mw_client_model.CaptureMatcher
- func CaptureReMatcherRequestURL() mw_client_model.CaptureMatcher
- func DecorateHttpClient(httpClient *http.Client, traceAttributes map[string]string, metricName string, ...) *http.Client
- func IsNilish(val any) bool
- func NewHttpClient(hostname string, serviceName string, targetServiceName string, ...) *http.Client
- func TouchFile(name string, perm os.FileMode) error
- type CaptureTransport
- type DelayedReaderPersister
- type LogTransport
- type MetricTransport
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCapNotMatch = errors.New("capture not match")
View Source
var ErrCapResponse = errors.New("capture response error")
Functions ¶
func CaptureEqualRequestURL ¶
func CaptureEqualRequestURL() mw_client_model.CaptureMatcher
func CaptureEqualRequestURLAndHeader ¶
func CaptureEqualRequestURLAndHeader(header string) mw_client_model.CaptureMatcher
func CaptureReMatcherRequestURL ¶
func CaptureReMatcherRequestURL() mw_client_model.CaptureMatcher
func DecorateHttpClient ¶
func DecorateHttpClient(httpClient *http.Client, traceAttributes map[string]string, metricName string, metricDescription string, metricLabels map[string]string, buildinfo model.BuildInfo, log *slog.Logger, logReqLevel slog.Level, logRespLevel slog.Level, captureConfig srv_configs.CaptureConfiger, ) *http.Client
func NewHttpClient ¶ added in v0.0.4
Types ¶
type CaptureTransport ¶
type CaptureTransport struct {
// contains filtered or unexported fields
}
func NewCaptureTransport ¶
func NewCaptureTransport(base http.RoundTripper, mode model.CaptureTransportMode, dirPath string, capMatchers []mw_client_model.CaptureMatcher) *CaptureTransport
type DelayedReaderPersister ¶
type DelayedReaderPersister struct {
// contains filtered or unexported fields
}
func NewDelayedReaderPersister ¶
func NewDelayedReaderPersister(body io.ReadCloser) *DelayedReaderPersister
func (*DelayedReaderPersister) Close ¶
func (drp *DelayedReaderPersister) Close() error
func (*DelayedReaderPersister) Done ¶
func (drp *DelayedReaderPersister) Done() <-chan struct{}
func (*DelayedReaderPersister) IsNil ¶
func (drp *DelayedReaderPersister) IsNil() bool
func (*DelayedReaderPersister) Payload ¶
func (drp *DelayedReaderPersister) Payload() []byte
type LogTransport ¶
type LogTransport struct {
// contains filtered or unexported fields
}
LogTransport implements the http.RoundTripper interface and wraps outbound HTTP(S) requests with logs.
func NewLogTransport ¶
func NewLogTransport(base http.RoundTripper, beginLevel slog.Level, endLevel slog.Level) *LogTransport
NewLogTransport wraps the provided http.RoundTripper with one that logs request and respnse.
If the provided http.RoundTripper is nil, http.DefaultTransport will be used as the base http.RoundTripper.
type MetricTransport ¶
type MetricTransport struct {
// contains filtered or unexported fields
}
MetricTransport implements the http.RoundTripper interface and wraps outbound HTTP(S) requests with metrics.
func NewMetricTransport ¶
func NewMetricTransport(base http.RoundTripper, meter metric_api.Meter, name string, description string, attributes map[string]string, errFormatter middleware.ErrFormatter, ) *MetricTransport
NewMetricTransport wraps the provided http.RoundTripper with one that meters metrics.
If the provided http.RoundTripper is nil, http.DefaultTransport will be used as the base http.RoundTripper.
Click to show internal directories.
Click to hide internal directories.