-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
fa35fee
commit 5869426
Showing
62 changed files
with
1,019 additions
and
707 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v5.14.1 | ||
v5.14.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.