Skip to content

Commit

Permalink
Add tests comparing current and bridge outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHelmuth committed May 23, 2023
1 parent 94365e4 commit e3ec25e
Show file tree
Hide file tree
Showing 7 changed files with 934 additions and 16 deletions.
19 changes: 4 additions & 15 deletions internal/filter/filterottl/bridge.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// 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.
// SPDX-License-Identifier: Apache-2.0

package filterottl // import "github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter/filterottl"

Expand All @@ -31,15 +20,15 @@ import (
const (
serviceNameStaticStatement = `resource.attributes["service.name"] == "%v"`
spanNameStaticStatement = `name == "%v"`
spanKindStaticStatement = `kind == "%v"`
spanKindStaticStatement = `kind.deprecated_string == "%v"`
scopeNameStaticStatement = `instrumentation_scope.name == "%v"`
scopeVersionStaticStatement = `instrumentation_scope.version == "%v"`
attributesStaticStatement = `attributes["%v"] == %v`
resourceAttributesStaticStatement = `resource.attributes["%v"] == %v`

serviceNameRegexStatement = `IsMatch(resource.attributes["service.name"], "%v")`
spanNameRegexStatement = `IsMatch(name, "%v")`
spanKindRegexStatement = `IsMatch(kind, "%v")`
spanKindRegexStatement = `IsMatch(kind.deprecated_string, "%v")`
scopeNameRegexStatement = `IsMatch(instrumentation_scope.name, "%v")`
scopeVersionRegexStatement = `IsMatch(instrumentation_scope.version, "%v")`
attributesRegexStatement = `IsMatch(attributes["%v"], "%v")`
Expand Down Expand Up @@ -177,7 +166,7 @@ func createAttributeConditions(template string, input []filterconfig.Attribute,
if matchType == filterset.Strict {
value = convertAttribute(attribute.Value)
} else {
value = attribute.Key
value = attribute.Value
}
attributeConditions = append(attributeConditions, fmt.Sprintf(template, attribute.Key, value))
}
Expand Down
Loading

0 comments on commit e3ec25e

Please sign in to comment.