Compare commits
	
		
			3 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7a325e2c9e | |||
| 7daa927e70 | |||
| 
						 | 
					54bb7f7acb | 
@@ -1,5 +1,5 @@
 | 
				
			|||||||
# Micro
 | 
					# Micro
 | 
				
			||||||

 | 
					
 | 
				
			||||||
[](https://opensource.org/licenses/Apache-2.0)
 | 
					[](https://opensource.org/licenses/Apache-2.0)
 | 
				
			||||||
[](https://pkg.go.dev/go.unistack.org/micro/v4?tab=overview)
 | 
					[](https://pkg.go.dev/go.unistack.org/micro/v4?tab=overview)
 | 
				
			||||||
[](https://git.unistack.org/unistack-org/micro/actions?query=workflow%3Abuild+branch%3Av4+event%3Apush)
 | 
					[](https://git.unistack.org/unistack-org/micro/actions?query=workflow%3Abuild+branch%3Av4+event%3Apush)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,11 +15,6 @@ import (
 | 
				
			|||||||
	"go.unistack.org/micro/v4/tracer"
 | 
						"go.unistack.org/micro/v4/tracer"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// DefaultCodecs will be used to encode/decode data
 | 
					 | 
				
			||||||
var DefaultCodecs = map[string]codec.Codec{
 | 
					 | 
				
			||||||
	"application/octet-stream": codec.NewCodec(),
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type noopClient struct {
 | 
					type noopClient struct {
 | 
				
			||||||
	funcCall   FuncCall
 | 
						funcCall   FuncCall
 | 
				
			||||||
	funcStream FuncStream
 | 
						funcStream FuncStream
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -161,7 +161,7 @@ func NewOptions(opts ...Option) Options {
 | 
				
			|||||||
	options := Options{
 | 
						options := Options{
 | 
				
			||||||
		Context:     context.Background(),
 | 
							Context:     context.Background(),
 | 
				
			||||||
		ContentType: DefaultContentType,
 | 
							ContentType: DefaultContentType,
 | 
				
			||||||
		Codecs:      DefaultCodecs,
 | 
							Codecs:      make(map[string]codec.Codec),
 | 
				
			||||||
		CallOptions: CallOptions{
 | 
							CallOptions: CallOptions{
 | 
				
			||||||
			Context:        context.Background(),
 | 
								Context:        context.Background(),
 | 
				
			||||||
			Backoff:        DefaultBackoff,
 | 
								Backoff:        DefaultBackoff,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,9 +49,11 @@ type Meter interface {
 | 
				
			|||||||
	Set(opts ...Option) Meter
 | 
						Set(opts ...Option) Meter
 | 
				
			||||||
	// Histogram get or create histogram
 | 
						// Histogram get or create histogram
 | 
				
			||||||
	Histogram(name string, labels ...string) Histogram
 | 
						Histogram(name string, labels ...string) Histogram
 | 
				
			||||||
 | 
						// HistogramExt get or create histogram with specified quantiles
 | 
				
			||||||
 | 
						HistogramExt(name string, quantiles []float64, labels ...string) Histogram
 | 
				
			||||||
	// Summary get or create summary
 | 
						// Summary get or create summary
 | 
				
			||||||
	Summary(name string, labels ...string) Summary
 | 
						Summary(name string, labels ...string) Summary
 | 
				
			||||||
	// SummaryExt get or create summary with spcified quantiles and window time
 | 
						// SummaryExt get or create summary with specified quantiles and window time
 | 
				
			||||||
	SummaryExt(name string, window time.Duration, quantiles []float64, labels ...string) Summary
 | 
						SummaryExt(name string, window time.Duration, quantiles []float64, labels ...string) Summary
 | 
				
			||||||
	// Write writes metrics to io.Writer
 | 
						// Write writes metrics to io.Writer
 | 
				
			||||||
	Write(w io.Writer, opts ...Option) error
 | 
						Write(w io.Writer, opts ...Option) error
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,6 +70,11 @@ func (r *noopMeter) Histogram(_ string, labels ...string) Histogram {
 | 
				
			|||||||
	return &noopHistogram{labels: labels}
 | 
						return &noopHistogram{labels: labels}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// HistogramExt implements the Meter interface
 | 
				
			||||||
 | 
					func (r *noopMeter) HistogramExt(_ string, quantiles []float64, labels ...string) Histogram {
 | 
				
			||||||
 | 
						return &noopHistogram{labels: labels}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Set implements the Meter interface
 | 
					// Set implements the Meter interface
 | 
				
			||||||
func (r *noopMeter) Set(opts ...Option) Meter {
 | 
					func (r *noopMeter) Set(opts ...Option) Meter {
 | 
				
			||||||
	m := &noopMeter{opts: r.opts}
 | 
						m := &noopMeter{opts: r.opts}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,8 @@ import (
 | 
				
			|||||||
	"context"
 | 
						"context"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var DefaultQuantiles = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Option powers the configuration for metrics implementations:
 | 
					// Option powers the configuration for metrics implementations:
 | 
				
			||||||
type Option func(*Options)
 | 
					type Option func(*Options)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -23,6 +25,8 @@ type Options struct {
 | 
				
			|||||||
	WriteProcessMetrics bool
 | 
						WriteProcessMetrics bool
 | 
				
			||||||
	// WriteFDMetrics flag to write fd metrics
 | 
						// WriteFDMetrics flag to write fd metrics
 | 
				
			||||||
	WriteFDMetrics bool
 | 
						WriteFDMetrics bool
 | 
				
			||||||
 | 
						// Quantiles specifies buckets for histogram
 | 
				
			||||||
 | 
						Quantiles []float64
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NewOptions prepares a set of options:
 | 
					// NewOptions prepares a set of options:
 | 
				
			||||||
@@ -61,14 +65,12 @@ func Address(value string) Option {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					// Quantiles defines the desired spread of statistics for histogram metrics:
 | 
				
			||||||
// TimingObjectives defines the desired spread of statistics for histogram / timing metrics:
 | 
					func Quantiles(quantiles []float64) Option {
 | 
				
			||||||
func TimingObjectives(value map[float64]float64) Option {
 | 
					 | 
				
			||||||
	return func(o *Options) {
 | 
						return func(o *Options) {
 | 
				
			||||||
		o.TimingObjectives = value
 | 
							o.Quantiles = quantiles
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Labels add the meter labels
 | 
					// Labels add the meter labels
 | 
				
			||||||
func Labels(ls ...string) Option {
 | 
					func Labels(ls ...string) Option {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,6 @@ import (
 | 
				
			|||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"go.unistack.org/micro/v4/codec"
 | 
					 | 
				
			||||||
	"go.unistack.org/micro/v4/logger"
 | 
						"go.unistack.org/micro/v4/logger"
 | 
				
			||||||
	"go.unistack.org/micro/v4/register"
 | 
						"go.unistack.org/micro/v4/register"
 | 
				
			||||||
	maddr "go.unistack.org/micro/v4/util/addr"
 | 
						maddr "go.unistack.org/micro/v4/util/addr"
 | 
				
			||||||
@@ -14,11 +13,6 @@ import (
 | 
				
			|||||||
	"go.unistack.org/micro/v4/util/rand"
 | 
						"go.unistack.org/micro/v4/util/rand"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// DefaultCodecs will be used to encode/decode
 | 
					 | 
				
			||||||
var DefaultCodecs = map[string]codec.Codec{
 | 
					 | 
				
			||||||
	"application/octet-stream": codec.NewCodec(),
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type rpcHandler struct {
 | 
					type rpcHandler struct {
 | 
				
			||||||
	opts    HandlerOptions
 | 
						opts    HandlerOptions
 | 
				
			||||||
	handler interface{}
 | 
						handler interface{}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user