Skip to content

Commit

Permalink
Update OTelCol package (#27)
Browse files Browse the repository at this point in the history
Making this update requires to change the tags used in StackDriver config, since per enforcement from OTelCol all need to be using underscores instead of dashes. Opportunistic fix: avoided pop-ups on mac during tests for zipkinscribereceiver package.
  • Loading branch information
Paulo Janotti authored Oct 17, 2019
1 parent e933f81 commit 49a5142
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
6 changes: 3 additions & 3 deletions exporter/stackdriverexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import "github.com/open-telemetry/opentelemetry-collector/config/configmodels"
type Config struct {
configmodels.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
ProjectID string `mapstructure:"project"`
Prefix string `mapstructure:"metric-prefix"`
Prefix string `mapstructure:"metric_prefix"`
Endpoint string `mapstructure:"endpoint"`
NumOfWorkers int `mapstructure:"number-of-workers"`
SkipCreateMetricDescriptor bool `mapstructure:"skip-create-metric-descriptor"`
NumOfWorkers int `mapstructure:"number_of_workers"`
SkipCreateMetricDescriptor bool `mapstructure:"skip_create_metric_descriptor"`
}
3 changes: 3 additions & 0 deletions exporter/stackdriverexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ import (

"github.com/stretchr/testify/assert"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector/config/configcheck"
)

func TestCreateDefaultConfig(t *testing.T) {
factory := Factory{}
cfg := factory.CreateDefaultConfig()
assert.NotNil(t, cfg, "failed to create default config")
assert.NoError(t, configcheck.ValidateConfig(cfg))
}

func TestCreateExporter(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion exporter/stackdriverexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.12
require (
// TODO: pin a released version
contrib.go.opencensus.io/exporter/stackdriver v0.12.8-0.20190917133925-4339afab4a99
github.com/open-telemetry/opentelemetry-collector v0.2.0
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191016224815-dfabfb0c1d1e
github.com/stretchr/testify v1.4.0
go.uber.org/zap v1.10.0
google.golang.org/api v0.10.0
Expand Down
2 changes: 2 additions & 0 deletions exporter/stackdriverexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/open-telemetry/opentelemetry-collector v0.2.0 h1:38/NrGdEEXufWqYFkW/6yeW3koRvb1QbE/2owKSNQvI=
github.com/open-telemetry/opentelemetry-collector v0.2.0/go.mod h1:zZf9V+57o0Fd3ik5HzaHamVsWhudJTOwnKw9kJvWoDo=
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191016224815-dfabfb0c1d1e h1:poxNKN8teT8QjLK6LwKN52cNQEPqHIOEsmPJv5ssZUU=
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191016224815-dfabfb0c1d1e/go.mod h1:zZf9V+57o0Fd3ik5HzaHamVsWhudJTOwnKw9kJvWoDo=
github.com/opentracing-contrib/go-stdlib v0.0.0-20190519235532-cf7a6c988dc9/go.mod h1:PLldrQSroqzH70Xl+1DQcGnefIbqsKR7UDaiux3zV+w=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
Expand Down
6 changes: 3 additions & 3 deletions exporter/stackdriverexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ exporters:
stackdriver:
stackdriver/customname:
project: my-project
metric-prefix: prefix
metric_prefix: prefix
endpoint: test-endpoint
number-of-workers: 3
skip-create-metric-descriptor: true
number_of_workers: 3
skip_create_metric_descriptor: true
stackdriver/disabled: # will be ignored
disabled: true

Expand Down
5 changes: 3 additions & 2 deletions receiver/zipkinscribereceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"context"
"testing"

"go.uber.org/zap"

"github.com/stretchr/testify/assert"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector/config/configcheck"
"github.com/open-telemetry/opentelemetry-collector/config/configerror"
"github.com/open-telemetry/opentelemetry-collector/consumer/consumerdata"
)
Expand All @@ -30,6 +30,7 @@ func TestCreateDefaultConfig(t *testing.T) {
factory := &Factory{}
cfg := factory.CreateDefaultConfig()
assert.NotNil(t, cfg, "failed to create default config")
assert.NoError(t, configcheck.ValidateConfig(cfg))
}

type mockTraceConsumer struct {
Expand Down
2 changes: 1 addition & 1 deletion receiver/zipkinscribereceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/golang/protobuf v1.3.2
github.com/jaegertracing/jaeger v1.14.0
github.com/omnition/scribe-go v1.0.0
github.com/open-telemetry/opentelemetry-collector v0.2.0
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191016224815-dfabfb0c1d1e
github.com/stretchr/testify v1.4.0
go.uber.org/zap v1.10.0
)
2 changes: 2 additions & 0 deletions receiver/zipkinscribereceiver/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/open-telemetry/opentelemetry-collector v0.2.0 h1:38/NrGdEEXufWqYFkW/6yeW3koRvb1QbE/2owKSNQvI=
github.com/open-telemetry/opentelemetry-collector v0.2.0/go.mod h1:zZf9V+57o0Fd3ik5HzaHamVsWhudJTOwnKw9kJvWoDo=
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191016224815-dfabfb0c1d1e h1:poxNKN8teT8QjLK6LwKN52cNQEPqHIOEsmPJv5ssZUU=
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191016224815-dfabfb0c1d1e/go.mod h1:zZf9V+57o0Fd3ik5HzaHamVsWhudJTOwnKw9kJvWoDo=
github.com/opentracing-contrib/go-stdlib v0.0.0-20190519235532-cf7a6c988dc9/go.mod h1:PLldrQSroqzH70Xl+1DQcGnefIbqsKR7UDaiux3zV+w=
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
Expand Down
8 changes: 4 additions & 4 deletions receiver/zipkinscribereceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestNewReceiver(t *testing.T) {

func TestBadEncodedMessage(t *testing.T) {
sink := &mockTraceSink{}
traceReceiver, err := New(":0", "zipkin", sink)
traceReceiver, err := New("localhost:0", "zipkin", sink)
if err != nil {
t.Fatalf("Failed to create receiver: %v", err)
}
Expand All @@ -101,7 +101,7 @@ func TestBadEncodedMessage(t *testing.T) {

func TestNonEqualCategoryIsIgnored(t *testing.T) {
sink := &mockTraceSink{}
traceReceiver, err := New(":0", "not-zipkin", sink)
traceReceiver, err := New("localhost:0", "not-zipkin", sink)
if err != nil {
t.Fatalf("Failed to create receiver: %v", err)
}
Expand All @@ -127,7 +127,7 @@ func TestNonEqualCategoryIsIgnored(t *testing.T) {
}

func TestScribeReceiverPortAlreadyInUse(t *testing.T) {
l, err := net.Listen("tcp", ":0")
l, err := net.Listen("tcp", "localhost:0")
if err != nil {
t.Fatalf("failed to open a port: %v", err)
}
Expand All @@ -144,7 +144,7 @@ func TestScribeReceiverPortAlreadyInUse(t *testing.T) {
}

func TestScribeReceiverServer(t *testing.T) {
const endpoint = ":9410"
const endpoint = "localhost:9410"

messages := []*scribe.LogEntry{
{
Expand Down

0 comments on commit 49a5142

Please sign in to comment.