Skip to content

Commit

Permalink
Bumped OpenTelemetry Collector to v0.16.0
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
  • Loading branch information
jpkrohling committed Dec 3, 2020
1 parent f0ea1b8 commit 32f47b1
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes by Version
==================

0.16.0 (2020-12-03)
-------------------
* Fix image prefix for release image ([#133](https://github.com/open-telemetry/opentelemetry-operator/pull/133), [@jpkrohling](https://github.com/jpkrohling))
* Explicitly set Service Port Protocol for Jaeger Receivers ([#117](https://github.com/open-telemetry/opentelemetry-operator/pull/117), [@KingJ](https://github.com/KingJ))

0.15.0 (2020-11-27)
-------------------
* Bumped OpenTelemetry Collector to v0.15.0 ([#131](https://github.com/open-telemetry/opentelemetry-operator/pull/131), [@jpkrohling](https://github.com/jpkrohling))
Expand Down
1 change: 0 additions & 1 deletion pkg/collector/parser/receiver_generic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func TestDownstreamParsers(t *testing.T) {
}{
{"zipkin", "zipkin", "__zipkin", 9411, parser.NewZipkinReceiverParser},
{"opencensus", "opencensus", "__opencensus", 55678, parser.NewOpenCensusReceiverParser},
{"otlp", "otlp", "__otlp", 55680, parser.NewOTLPReceiverParser},

// contrib receivers
{"carbon", "carbon", "__carbon", 2003, parser.NewCarbonReceiverParser},
Expand Down
57 changes: 49 additions & 8 deletions pkg/collector/parser/receiver_otlp.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,61 @@
package parser

import "github.com/go-logr/logr"
import (
"fmt"

const parserNameOTLP = "__otlp"
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
)

var _ ReceiverParser = &OTLPReceiverParser{}

const (
parserNameOTLP = "__otlp"

defaultOTLPLegacyPort int32 = 55680
defaultOTLPGRPCPort int32 = 4317
)

// OTLPReceiverParser parses the configuration for OTLP receivers
type OTLPReceiverParser struct {
logger logr.Logger
name string
config map[interface{}]interface{}
}

// NewOTLPReceiverParser builds a new parser for OTLP receivers
func NewOTLPReceiverParser(logger logr.Logger, name string, config map[interface{}]interface{}) ReceiverParser {
return &GenericReceiver{
logger: logger,
name: name,
config: config,
defaultPort: 55680,
parserName: parserNameOTLP,
return &OTLPReceiverParser{
logger: logger,
name: name,
config: config,
}
}

// Ports returns all the service ports for all protocols in this parser
func (o *OTLPReceiverParser) Ports() ([]corev1.ServicePort, error) {
port := singlePortFromConfigEndpoint(o.logger, o.name, o.config)
if port != nil {
return []corev1.ServicePort{*port}, nil
}

return []corev1.ServicePort{
{
Port: defaultOTLPGRPCPort,
Name: portName(o.name, defaultGRPCPort),
},
{
Port: defaultOTLPLegacyPort,
Name: portName(fmt.Sprintf("%s-legacy", o.name), defaultOTLPLegacyPort),
},
}, nil
}

// ParserName returns the name of this parser
func (o *OTLPReceiverParser) ParserName() string {
return parserNameOTLP
}

func init() {
Register("otlp", NewOTLPReceiverParser)
}
64 changes: 63 additions & 1 deletion pkg/collector/parser/receiver_otlp_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,65 @@
package parser

// all tests for the OTLP parser are currently part of the test TestDownstreamParsers
import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestOTLPSelfRegisters(t *testing.T) {
// verify
assert.True(t, IsRegistered("otlp"))
}

func TestOTLPIsFoundByName(t *testing.T) {
// test
p := For(logger, "otlp", map[interface{}]interface{}{})

// verify
assert.Equal(t, "__otlp", p.ParserName())
}

func TestOTLPPortsOverridden(t *testing.T) {
// prepare
builder := NewOTLPReceiverParser(logger, "otlp", map[interface{}]interface{}{
"endpoint": "0.0.0.0:1234",
})

// test
ports, err := builder.Ports()

// verify
assert.NoError(t, err)
assert.Len(t, ports, 1)
assert.EqualValues(t, 1234, ports[0].Port)
}

func TestOTLPExposeDefaultPorts(t *testing.T) {
// prepare
builder := NewOTLPReceiverParser(logger, "otlp", map[interface{}]interface{}{})

expectedResults := map[string]struct {
portNumber int32
seen bool
}{
"otlp": {portNumber: 4317},
"otlp-legacy": {portNumber: 55680},
}

// test
ports, err := builder.Ports()

// verify
assert.NoError(t, err)
assert.Len(t, ports, 2)

for _, port := range ports {
r := expectedResults[port.Name]
r.seen = true
expectedResults[port.Name] = r
assert.EqualValues(t, r.portNumber, port.Port)
}
for k, v := range expectedResults {
assert.True(t, v.seen, "the port %s wasn't included in the service ports", k)
}
}
4 changes: 2 additions & 2 deletions versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# by default with the OpenTelemetry Operator. This would usually be the latest
# stable OpenTelemetry version. When you update this file, make sure to update the
# the docs as well.
opentelemetry-collector=0.15.0
opentelemetry-collector=0.16.0

# Represents the next release of the OpenTelemetry Operator.
operator=0.15.0
operator=0.16.0

0 comments on commit 32f47b1

Please sign in to comment.