Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
update redial time to 10s instead of 5s
Browse files Browse the repository at this point in the history
  • Loading branch information
odeke-em committed Oct 16, 2018
1 parent 7528586 commit 7c99379
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (ae *Exporter) connected() bool {
return atomic.LoadInt32(&ae.connectionState) == sConnected
}

const defaultConnReattemptPeriod = 5000 * time.Millisecond
const defaultConnReattemptPeriod = 10 * time.Second

func (ae *Exporter) indefiniteBackgroundConnection() error {
defer func() {
Expand Down
2 changes: 2 additions & 0 deletions load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"strings"
"sync"
"testing"
"time"

"google.golang.org/grpc"

Expand Down Expand Up @@ -74,6 +75,7 @@ func TestExportsUnderLoad_issue13(t *testing.T) {
exporter, err := ocagent.NewExporter(
ocagent.WithInsecure(),
ocagent.WithServiceName("go-app"),
ocagent.WithReconnectionPeriod(50*time.Millisecond),
ocagent.WithAddress(agentAddr))
if err != nil {
t.Fatalf("Failed to create the agent exporter: %v", err)
Expand Down
18 changes: 14 additions & 4 deletions ocagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ func TestNewExporter_endToEnd(t *testing.T) {
defer ma.stop()

serviceName := "endToEnd_test"
exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(ma.address), ocagent.WithServiceName(serviceName))
exp, err := ocagent.NewExporter(ocagent.WithInsecure(),
ocagent.WithAddress(ma.address),
ocagent.WithReconnectionPeriod(50*time.Millisecond),
ocagent.WithServiceName(serviceName))
if err != nil {
t.Fatalf("Failed to create a new agent exporter: %v", err)
}
Expand Down Expand Up @@ -208,7 +211,9 @@ func TestNewExporter_invokeStartThenStopManyTimes(t *testing.T) {
ma := runMockAgent(t)
defer ma.stop()

exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(ma.address))
exp, err := ocagent.NewExporter(ocagent.WithInsecure(),
ocagent.WithReconnectionPeriod(50*time.Millisecond),
ocagent.WithAddress(ma.address))
if err != nil {
t.Fatal("Surprisingly connected with a bad port")
}
Expand Down Expand Up @@ -301,7 +306,9 @@ func TestNewExporter_agentOnBadConnection(t *testing.T) {
_, agentPortStr, _ := net.SplitHostPort(ln.Addr().String())

address := fmt.Sprintf("localhost:%s", agentPortStr)
exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(address))
exp, err := ocagent.NewExporter(ocagent.WithInsecure(),
ocagent.WithReconnectionPeriod(50*time.Millisecond),
ocagent.WithAddress(address))
if err != nil {
t.Fatalf("Despite an indefinite background reconnection, got error: %v", err)
}
Expand All @@ -312,7 +319,10 @@ func TestNewExporter_withAddress(t *testing.T) {
ma := runMockAgent(t)
defer ma.stop()

exp, err := ocagent.NewUnstartedExporter(ocagent.WithInsecure(), ocagent.WithAddress(ma.address))
exp, err := ocagent.NewUnstartedExporter(
ocagent.WithInsecure(),
ocagent.WithReconnectionPeriod(50*time.Millisecond),
ocagent.WithAddress(ma.address))
if err != nil {
t.Fatal("Surprisingly connected with a bad port")
}
Expand Down
5 changes: 4 additions & 1 deletion transform_spans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func TestOCSpanToProtoSpan_endToEnd(t *testing.T) {
defer agent.stop()

serviceName := "spanTranslation"
exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(agent.address), ocagent.WithServiceName(serviceName))
exp, err := ocagent.NewExporter(ocagent.WithInsecure(),
ocagent.WithAddress(agent.address),
ocagent.WithReconnectionPeriod(50*time.Millisecond),
ocagent.WithServiceName(serviceName))
if err != nil {
t.Fatalf("Failed to create a new agent exporter: %v", err)
}
Expand Down

0 comments on commit 7c99379

Please sign in to comment.