Skip to content

Commit

Permalink
rename files
Browse files Browse the repository at this point in the history
  • Loading branch information
black-adder committed Apr 4, 2017
1 parent b8e8a5e commit 79d651a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
12 changes: 6 additions & 6 deletions cmd/agent/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ const (

defaultSamplingServerHostPort = "localhost:5778"

agentServiceName = "jaeger-agent"
collectorServiceName = "jaeger-collector"
agentServiceName = "jaeger-agent"
defaultCollectorServiceName = "jaeger-collector"

jaegerModel model = "jaeger"
zipkinModel = "zipkin"
Expand Down Expand Up @@ -85,7 +85,7 @@ type Builder struct {
DiscoveryMinPeers int `yaml:"minPeers"`

// CollectorServiceName is the name that Jaeger Collector's TChannel server
// broadcasts.
// responds to.
CollectorServiceName string `yaml:"collectorServiceName"`

discoverer discovery.Discoverer
Expand Down Expand Up @@ -201,7 +201,7 @@ func (b *Builder) CreateAgent(mFactory metrics.Factory, logger zap.Logger) (*Age
channel, _ := tchannel.NewChannel(agentServiceName, nil)

if b.CollectorServiceName == "" {
b.CollectorServiceName = collectorServiceName
b.CollectorServiceName = defaultCollectorServiceName
}

discoveryMgr, err := b.enableDiscovery(channel, logger)
Expand All @@ -212,7 +212,7 @@ func (b *Builder) CreateAgent(mFactory metrics.Factory, logger zap.Logger) (*Age
if discoveryMgr == nil && b.CollectorHostPort != "" {
clientOpts = &tchannelThrift.ClientOptions{HostPort: b.CollectorHostPort}
}
rep := reporter.NewTCollectorReporter(b.CollectorServiceName, channel, mFactory, logger, clientOpts)
rep := reporter.NewTChannelReporter(b.CollectorServiceName, channel, mFactory, logger, clientOpts)
if b.otherReporters != nil {
reps := append([]reporter.Reporter{}, b.otherReporters...)
reps = append(reps, rep)
Expand Down Expand Up @@ -258,7 +258,7 @@ func (b *Builder) GetProcessors(rep reporter.Reporter, mFactory metrics.Factory)

// GetSamplingServer creates an HTTP server that provides sampling strategies to client libraries.
func (c SamplingServerConfiguration) GetSamplingServer(svc string, channel *tchannel.Channel, mFactory metrics.Factory, clientOpts *tchannelThrift.ClientOptions) *http.Server {
samplingMgr := sampling.NewTCollectorSamplingManagerProxy(svc, channel, mFactory, clientOpts)
samplingMgr := sampling.NewCollectorProxy(svc, channel, mFactory, clientOpts)
if c.HostPort == "" {
c.HostPort = defaultSamplingServerHostPort
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/processors/thrift_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func createProcessor(t *testing.T, mFactory metrics.Factory, tFactory thrift.TPr
func initCollectorAndReporter(t *testing.T) (*metrics.LocalFactory, *testutils.MockTCollector, reporter.Reporter) {
metricsFactory, collector := testutils.InitMockCollector(t)

reporter := reporter.NewTCollectorReporter("jaeger-collector", collector.Channel, metricsFactory, zap.New(zap.NullEncoder()), nil)
reporter := reporter.NewTChannelReporter("jaeger-collector", collector.Channel, metricsFactory, zap.New(zap.NullEncoder()), nil)

return metricsFactory, collector, reporter
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ type batchMetrics struct {
SpansFailures metrics.Counter `metric:"spans.failures"`
}

// tcollectorReporter forwards received spans to central collector tier
type tcollectorReporter struct {
// tchannelReporter forwards received spans to central collector tier
type tchannelReporter struct {
zClient zipkincore.TChanZipkinCollector
jClient jaeger.TChanCollector
batchesMetrics map[string]batchMetrics
logger zap.Logger
}

// NewTCollectorReporter creates new tcollectorReporter
func NewTCollectorReporter(svc string, channel *tchannel.Channel, mFactory metrics.Factory, zlogger zap.Logger, clientOpts *thrift.ClientOptions) Reporter {
// NewTChannelReporter creates new tchannelReporter
func NewTChannelReporter(svc string, channel *tchannel.Channel, mFactory metrics.Factory, zlogger zap.Logger, clientOpts *thrift.ClientOptions) Reporter {
thriftClient := thrift.NewClient(channel, svc, clientOpts)
zClient := zipkincore.NewTChanZipkinCollectorClient(thriftClient)
jClient := jaeger.NewTChanCollectorClient(thriftClient)
Expand All @@ -75,13 +75,13 @@ func NewTCollectorReporter(svc string, channel *tchannel.Channel, mFactory metri
metrics.Init(&bm, nsByType, nil)
batchesMetrics[s] = bm
}
rep := &tcollectorReporter{zClient: zClient, jClient: jClient, logger: zlogger, batchesMetrics: batchesMetrics}
rep := &tchannelReporter{zClient: zClient, jClient: jClient, logger: zlogger, batchesMetrics: batchesMetrics}

return rep
}

// EmitZipkinBatch implements EmitZipkinBatch() of Reporter
func (r *tcollectorReporter) EmitZipkinBatch(spans []*zipkincore.Span) error {
func (r *tchannelReporter) EmitZipkinBatch(spans []*zipkincore.Span) error {
submissionFunc := func(ctx thrift.Context) error {
_, err := r.zClient.SubmitZipkinBatch(ctx, spans)
return err
Expand All @@ -95,7 +95,7 @@ func (r *tcollectorReporter) EmitZipkinBatch(spans []*zipkincore.Span) error {
}

// EmitBatch implements EmitBatch() of Reporter
func (r *tcollectorReporter) EmitBatch(batch *jaeger.Batch) error {
func (r *tchannelReporter) EmitBatch(batch *jaeger.Batch) error {
submissionFunc := func(ctx thrift.Context) error {
_, err := r.jClient.SubmitBatches(ctx, []*jaeger.Batch{batch})
return err
Expand All @@ -108,7 +108,7 @@ func (r *tcollectorReporter) EmitBatch(batch *jaeger.Batch) error {
)
}

func (r *tcollectorReporter) submitAndReport(submissionFunc func(ctx thrift.Context) error, errMsg string, size int64, batchMetrics batchMetrics) error {
func (r *tchannelReporter) submitAndReport(submissionFunc func(ctx thrift.Context) error, errMsg string, size int64, batchMetrics batchMetrics) error {
ctx, cancel := tchannel.NewContextBuilder(time.Second).DisableTracing().Build()
defer cancel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ import (
func initRequirements(t *testing.T) (*metrics.LocalFactory, *testutils.MockTCollector, Reporter) {
metricsFactory, collector := testutils.InitMockCollector(t)

reporter := NewTCollectorReporter("jaeger-collector", collector.Channel, metricsFactory, zap.New(zap.NullEncoder()), nil)
reporter := NewTChannelReporter("jaeger-collector", collector.Channel, metricsFactory, zap.New(zap.NullEncoder()), nil)

return metricsFactory, collector, reporter
}

func TestZipkinTCollectorReporterSuccess(t *testing.T) {
func TestZipkinTChannelReporterSuccess(t *testing.T) {
metricsFactory, collector, reporter := initRequirements(t)
defer collector.Close()

Expand All @@ -60,7 +60,7 @@ func TestZipkinTCollectorReporterSuccess(t *testing.T) {
checkCounters(t, metricsFactory, 1, 1, 0, 0, "zipkin")
}

func TestZipkinTCollectorReporterFailure(t *testing.T) {
func TestZipkinTChannelReporterFailure(t *testing.T) {
metricsFactory, collector, reporter := initRequirements(t)
defer collector.Close()

Expand All @@ -78,7 +78,7 @@ func submitTestZipkinBatch(reporter Reporter) error {
return reporter.EmitZipkinBatch([]*zipkincore.Span{span})
}

func TestJaegerTCollectorReporterSuccess(t *testing.T) {
func TestJaegerTChannelReporterSuccess(t *testing.T) {
metricsFactory, collector, reporter := initRequirements(t)
defer collector.Close()

Expand All @@ -93,7 +93,7 @@ func TestJaegerTCollectorReporterSuccess(t *testing.T) {
checkCounters(t, metricsFactory, 1, 1, 0, 0, "jaeger")
}

func TestJaegerTCollectorReporterFailure(t *testing.T) {
func TestJaegerTChannelReporterFailure(t *testing.T) {
metricsFactory, collector, reporter := initRequirements(t)
defer collector.Close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/uber/jaeger/thrift-gen/sampling"
)

type tcollectorSamplingProxy struct {
type collectorProxy struct {
client sampling.TChanSamplingManager
metrics struct {
// Number of successful sampling rate responses from collector
Expand All @@ -41,16 +41,16 @@ type tcollectorSamplingProxy struct {
}
}

// NewTCollectorSamplingManagerProxy implements Manager by proxying the requests to tcollector.
func NewTCollectorSamplingManagerProxy(svc string, channel *tchannel.Channel, mFactory metrics.Factory, clientOpts *thrift.ClientOptions) Manager {
// NewCollectorProxy implements Manager by proxying the requests to collector.
func NewCollectorProxy(svc string, channel *tchannel.Channel, mFactory metrics.Factory, clientOpts *thrift.ClientOptions) Manager {
thriftClient := thrift.NewClient(channel, svc, clientOpts)
client := sampling.NewTChanSamplingManagerClient(thriftClient)
res := &tcollectorSamplingProxy{client: client}
res := &collectorProxy{client: client}
metrics.Init(&res.metrics, mFactory, nil)
return res
}

func (c *tcollectorSamplingProxy) GetSamplingStrategy(serviceName string) (*sampling.SamplingStrategyResponse, error) {
func (c *collectorProxy) GetSamplingStrategy(serviceName string) (*sampling.SamplingStrategyResponse, error) {
ctx, cancel := tchannel.NewContextBuilder(time.Second).DisableTracing().Build()
defer cancel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"github.com/uber/jaeger/cmd/agent/app/testutils"
)

func TestTCollectorProxy(t *testing.T) {
func TestCollectorProxy(t *testing.T) {
metricsFactory, collector := testutils.InitMockCollector(t)
defer collector.Close()

Expand All @@ -45,7 +45,7 @@ func TestTCollectorProxy(t *testing.T) {
MaxTracesPerSecond: 10,
}})

mgr := NewTCollectorSamplingManagerProxy("jaeger-collector", collector.Channel, metricsFactory, nil)
mgr := NewCollectorProxy("jaeger-collector", collector.Channel, metricsFactory, nil)

resp, err := mgr.GetSamplingStrategy("service1")
require.NoError(t, err)
Expand All @@ -64,7 +64,7 @@ func TestTCollectorProxy(t *testing.T) {
func TestTCollectorProxyClientErrorPropagates(t *testing.T) {
mFactory := metrics.NewLocalFactory(time.Minute)
client := &failingClient{}
proxy := &tcollectorSamplingProxy{client: client}
proxy := &collectorProxy{client: client}
metrics.Init(&proxy.metrics, mFactory, nil)
_, err := proxy.GetSamplingStrategy("test")
assert.EqualError(t, err, "error")
Expand Down

0 comments on commit 79d651a

Please sign in to comment.