Skip to content

Commit

Permalink
Release v0.37.0 (#848)
Browse files Browse the repository at this point in the history
* Update core/contrib deps

* Update renamed components

* Update signalfx exporter for contrib #5756

* Update CHANGELOG.md

* Fix breaking config map and tracer changes

* Account for k8s_tagger rename

* Rename k8s_tagger to k8sattributes

* reduce collectd-cassandra test flake

* improve k8s_tagger rename test

* Update hec tls config map usage

* move from retracted 0.37.0 to 0.37.1

* Update changelog

* Update bundled Smart Agent to v5.14.2

* Update github.com/signalfx/signalfx-agent to main

Co-authored-by: Ryan Fitzpatrick <[email protected]>
  • Loading branch information
jeffreyc-splunk and Ryan Fitzpatrick authored Oct 18, 2021
1 parent fa35fee commit 5869426
Show file tree
Hide file tree
Showing 62 changed files with 1,019 additions and 707 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@
## Unreleased

- Add Chocolately package support. (#724)
- Add Hashicorp Nomad Support. (#819)

## v0.37.0

This Splunk OpenTelemetry Connector release includes changes from the [opentelemetry-collector v0.37.0](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v0.37.0) and the [opentelemetry-collector-contrib v0.37.1](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.37.1) releases. Due to go modules dep issues, the Collector Contrib release 0.37.0 has been retracted in favor of 0.37.1.

### 💡 Enhancements 💡

- `signalfx` exporter: Add support for per cpu metrics [#5756](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/5756)
- Add [Hashicorp Nomad](https://github.com/signalfx/splunk-otel-collector/tree/main/deployments/nomad) support (#819)
- Add config converter function to unsquash Splunk HEC exporter tls fields (#832)
- Rename `k8s_tagger` processor config entries to [`k8sattributes`](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/5384) (#848)
- Update bundled Smart Agent to [v5.14.2](https://github.com/signalfx/signalfx-agent/releases/tag/v5.14.2)

## v0.36.1

Expand Down
31 changes: 15 additions & 16 deletions cmd/otelcol/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ func main() {
configconverter.RemoveBallastKey,
configconverter.MoveOTLPInsecureKey,
configconverter.MoveHecTLS,
configconverter.RenameK8sTagger,
)
}

serviceParams := service.CollectorSettings{
BuildInfo: info,
Factories: factories,
ParserProvider: parserProvider,
BuildInfo: info,
Factories: factories,
ConfigMapProvider: parserProvider,
}

if err := run(serviceParams); err != nil {
Expand Down Expand Up @@ -343,26 +344,24 @@ func setDefaultEnvVars() {
}

// Returns a ParserProvider that reads configuration YAML from an environment variable when applicable.
func newBaseParserProvider() parserprovider.ParserProvider {
_, configPathFlag := getKeyValue(os.Args[1:], "--config")
configPathVar := os.Getenv(configEnvVarName)
func newBaseParserProvider() parserprovider.MapProvider {
var configPath string
var ok bool
if ok, configPath = getKeyValue(os.Args[1:], "--config"); !ok {
configPath = os.Getenv(configEnvVarName)
}
configYaml := os.Getenv(configYamlEnvVarName)

if configPathFlag == "" && configPathVar == "" && configYaml != "" {
return parserprovider.NewInMemory(bytes.NewBufferString(configYaml))
if configPath == "" && configYaml != "" {
return parserprovider.NewInMemoryMapProvider(bytes.NewBufferString(configYaml))
}

return parserprovider.Default()
return parserprovider.NewDefaultMapProvider(configPath, nil)
}

func runInteractive(settings service.CollectorSettings) error {
app, err := service.New(settings)
if err != nil {
return fmt.Errorf("failed to construct the application: %w", err)
}

cmd := service.NewCommand(app)
if err = cmd.Execute(); err != nil {
cmd := service.NewCommand(settings)
if err := cmd.Execute(); err != nil {
return fmt.Errorf("application run finished with error: %w", err)
}

Expand Down
252 changes: 129 additions & 123 deletions go.mod

Large diffs are not rendered by default.

491 changes: 259 additions & 232 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/buildscripts/packaging/smart-agent-release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v5.14.1
v5.14.2
8 changes: 4 additions & 4 deletions internal/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbyattrsprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor"
Expand All @@ -57,7 +57,6 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer/consumererror"
"go.opentelemetry.io/collector/exporter/loggingexporter"
"go.opentelemetry.io/collector/exporter/otlpexporter"
"go.opentelemetry.io/collector/exporter/otlphttpexporter"
Expand All @@ -66,6 +65,7 @@ import (
"go.opentelemetry.io/collector/processor/batchprocessor"
"go.opentelemetry.io/collector/processor/memorylimiterprocessor"
"go.opentelemetry.io/collector/receiver/otlpreceiver"
"go.uber.org/multierr"

"github.com/signalfx/splunk-otel-collector/internal/exporter/httpsinkexporter"
"github.com/signalfx/splunk-otel-collector/internal/extension/smartagentextension"
Expand Down Expand Up @@ -137,7 +137,7 @@ func Get() (component.Factories, error) {
batchprocessor.NewFactory(),
filterprocessor.NewFactory(),
groupbyattrsprocessor.NewFactory(),
k8sprocessor.NewFactory(),
k8sattributesprocessor.NewFactory(),
memorylimiterprocessor.NewFactory(),
metricstransformprocessor.NewFactory(),
probabilisticsamplerprocessor.NewFactory(),
Expand All @@ -156,5 +156,5 @@ func Get() (component.Factories, error) {
Exporters: exporters,
}

return factories, consumererror.Combine(errs)
return factories, multierr.Combine(errs...)
}
5 changes: 3 additions & 2 deletions internal/components/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package components

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -64,7 +65,7 @@ func TestDefaultComponents(t *testing.T) {
"batch",
"filter",
"groupbyattrs",
"k8s_tagger",
"k8sattributes",
"memory_limiter",
"metricstransform",
"probabilistic_sampler",
Expand Down Expand Up @@ -107,7 +108,7 @@ func TestDefaultComponents(t *testing.T) {
assert.Len(t, procs, len(expectedProcessors))
for _, k := range expectedProcessors {
v, ok := procs[k]
require.True(t, ok)
require.True(t, ok, fmt.Sprintf("Missing expected processor %s", k))
assert.Equal(t, k, v.Type())
}

Expand Down
68 changes: 68 additions & 0 deletions internal/configconverter/k8s_tagger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package configconverter

import (
"fmt"
"log"
"reflect"
"regexp"

"go.opentelemetry.io/collector/config"
)

// RenameK8sTagger will replace k8s_tagger processor items with k8sattributes ones.
func RenameK8sTagger(in *config.Map) *config.Map {
tagger := "k8s_tagger(/\\w+:{0,2})?"
taggerRe, _ := regexp.Compile(tagger)
keyExpr := fmt.Sprintf("processors::%s(.+)?", tagger)
k8sTaggerKeyRe, _ := regexp.Compile(keyExpr)

const serviceExpr = "service(.+)processors"
serviceEntryRe, _ := regexp.Compile(serviceExpr)

found := false
out := config.NewMap()
for _, k := range in.AllKeys() {
v := in.Get(k)
if match := k8sTaggerKeyRe.FindStringSubmatch(k); match != nil {
k8sAttributesKey := fmt.Sprintf("processors::k8sattributes%s%s", match[1], match[2])
out.Set(k8sAttributesKey, v)
if !found {
log.Println("[WARNING] `k8s_tagger` processor was renamed to `k8sattributes`. Please update your config accordingly.")
}
found = true
} else {
if serviceEntryRe.MatchString(k) {
kind := reflect.TypeOf(v).Kind()
if kind == reflect.Slice {
if sliceOfInterfaces, ok := v.([]interface{}); ok {
for i, val := range sliceOfInterfaces {
if strVal, ok := val.(string); ok {
if match = taggerRe.FindStringSubmatch(strVal); match != nil {
k8sAttributeEntry := fmt.Sprintf("k8sattributes%s", match[1])
sliceOfInterfaces[i] = k8sAttributeEntry
}
}
}
v = sliceOfInterfaces
}
}
}
out.Set(k, v)
}
}
return out
}
50 changes: 50 additions & 0 deletions internal/configconverter/k8s_tagger_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package configconverter

import (
"context"
"testing"

"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
)

func TestRenameK8sTaggerTestRenameK8sTagger(t *testing.T) {
pp := &converterProvider{
wrapped: &fileParserProvider{fileName: "testdata/k8s-tagger.yaml"},
cfgMapFuncs: []CfgMapFunc{RenameK8sTagger},
}
expected, err := config.NewMapFromFile("testdata/k8sattributes.yaml")
require.NoError(t, err)

actual, err := pp.Get(context.Background())
require.NoError(t, err)
require.Equal(t, expected.ToStringMap(), actual.ToStringMap())
}
6 changes: 3 additions & 3 deletions internal/configconverter/move_hec_tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"log"
"regexp"

"go.opentelemetry.io/collector/config/configparser"
"go.opentelemetry.io/collector/config"
)

func MoveHecTLS(in *configparser.ConfigMap) *configparser.ConfigMap {
func MoveHecTLS(in *config.Map) *config.Map {
const expression = "exporters::splunk_hec(/\\w+)?::(insecure_skip_verify|ca_file|cert_file|key_file)"
re, _ := regexp.Compile(expression)
out := configparser.NewConfigMap()
out := config.NewMap()
unsupportedKeyFound := false
for _, k := range in.AllKeys() {
v := in.Get(k)
Expand Down
6 changes: 3 additions & 3 deletions internal/configconverter/move_otlp_insecure.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"log"
"regexp"

"go.opentelemetry.io/collector/config/configparser"
"go.opentelemetry.io/collector/config"
)

func MoveOTLPInsecureKey(in *configparser.ConfigMap) *configparser.ConfigMap {
func MoveOTLPInsecureKey(in *config.Map) *config.Map {
const expr = "exporters::otlp(/\\w+)?::insecure"
insecureRE, _ := regexp.Compile(expr)
out := configparser.NewConfigMap()
out := config.NewMap()
var deprecatedOTLPConfigFound bool
for _, k := range in.AllKeys() {
v := in.Get(k)
Expand Down
14 changes: 7 additions & 7 deletions internal/configconverter/parser_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ import (
"context"
"fmt"

"go.opentelemetry.io/collector/config/configparser"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/service/parserprovider"
)

// converterProvider wraps a ParserProvider and accepts a list of functions that
// convert ConfigMaps. The idea is for this type to conform to the open-closed
// principle.
type converterProvider struct {
wrapped parserprovider.ParserProvider
wrapped parserprovider.MapProvider
cfgMapFuncs []CfgMapFunc
}

type CfgMapFunc func(*configparser.ConfigMap) *configparser.ConfigMap
type CfgMapFunc func(*config.Map) *config.Map

var _ parserprovider.ParserProvider = (*converterProvider)(nil)
var _ parserprovider.MapProvider = (*converterProvider)(nil)

func ParserProvider(wrapped parserprovider.ParserProvider, funcs ...CfgMapFunc) parserprovider.ParserProvider {
func ParserProvider(wrapped parserprovider.MapProvider, funcs ...CfgMapFunc) parserprovider.MapProvider {
return &converterProvider{wrapped: wrapped, cfgMapFuncs: funcs}
}

func (p converterProvider) Get(ctx context.Context) (*configparser.ConfigMap, error) {
func (p converterProvider) Get(ctx context.Context) (*config.Map, error) {
cfgMap, err := p.wrapped.Get(ctx)
if err != nil {
return nil, fmt.Errorf("converterProvider.Get(): %w", err)
Expand All @@ -48,7 +48,7 @@ func (p converterProvider) Get(ctx context.Context) (*configparser.ConfigMap, er
cfgMap = cfgMapFunc(cfgMap)
}

out := configparser.NewConfigMap()
out := config.NewMap()
for _, k := range cfgMap.AllKeys() {
out.Set(k, cfgMap.Get(k))
}
Expand Down
6 changes: 3 additions & 3 deletions internal/configconverter/parser_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config/configparser"
"go.opentelemetry.io/collector/config"
)

func TestMemLimitBallastRemoverPP(t *testing.T) {
Expand Down Expand Up @@ -58,8 +58,8 @@ type fileParserProvider struct {
fileName string
}

func (fpp fileParserProvider) Get(context.Context) (*configparser.ConfigMap, error) {
return configparser.NewConfigMapFromFile(fpp.fileName)
func (fpp fileParserProvider) Get(context.Context) (*config.Map, error) {
return config.NewMapFromFile(fpp.fileName)
}

func (fpp fileParserProvider) Close(context.Context) error {
Expand Down
6 changes: 3 additions & 3 deletions internal/configconverter/remove_ballast_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ import (
"log"
"regexp"

"go.opentelemetry.io/collector/config/configparser"
"go.opentelemetry.io/collector/config"
)

// RemoveBallastKey is a CfgMapFunc that removes a ballast_size_mib on a
// memory_limiter processor config if it exists. This config key will go away at
// some point (or already has) at which point its presence in a config will
// prevent the Collector from starting.
func RemoveBallastKey(cfgMap *configparser.ConfigMap) *configparser.ConfigMap {
func RemoveBallastKey(cfgMap *config.Map) *config.Map {
const expr = "processors::memory_limiter(/\\w+)?::ballast_size_mib"
ballastKeyRegexp, _ := regexp.Compile(expr)

out := configparser.NewConfigMap()
out := config.NewMap()
for _, k := range cfgMap.AllKeys() {
if ballastKeyRegexp.MatchString(k) {
log.Println("[WARNING] `ballast_size_mib` parameter in `memory_limiter` processor is " +
Expand Down
Loading

0 comments on commit 5869426

Please sign in to comment.