-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore][pkg/stanza] Cleanup uri parser operator files (#32119)
Contributes to #32058
- Loading branch information
1 parent
5c7e342
commit 349156c
Showing
3 changed files
with
49 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package uri // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/uri" | ||
|
||
import ( | ||
"go.uber.org/zap" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/helper" | ||
) | ||
|
||
const operatorType = "uri_parser" | ||
|
||
func init() { | ||
operator.Register(operatorType, func() operator.Builder { return NewConfig() }) | ||
} | ||
|
||
// NewConfig creates a new uri parser config with default values. | ||
func NewConfig() *Config { | ||
return NewConfigWithID(operatorType) | ||
} | ||
|
||
// NewConfigWithID creates a new uri parser config with default values. | ||
func NewConfigWithID(operatorID string) *Config { | ||
return &Config{ | ||
ParserConfig: helper.NewParserConfig(operatorID, operatorType), | ||
} | ||
} | ||
|
||
// Config is the configuration of a uri parser operator. | ||
type Config struct { | ||
helper.ParserConfig `mapstructure:",squash"` | ||
} | ||
|
||
// Build will build a uri parser operator. | ||
func (c Config) Build(logger *zap.SugaredLogger) (operator.Operator, error) { | ||
parserOperator, err := c.ParserConfig.Build(logger) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &Parser{ | ||
ParserOperator: parserOperator, | ||
}, nil | ||
} |
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
File renamed without changes.