forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] Expose namedpipe config on all platforms (open-telemetry#29857)
Fixes open-telemetry#29855 Follows pattern of open-telemetry#29754
- Loading branch information
1 parent
0584410
commit 7d788f5
Showing
4 changed files
with
62 additions
and
32 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,41 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package namedpipe // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/input/namedpipe" | ||
|
||
import ( | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/helper" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/split" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/trim" | ||
) | ||
|
||
const ( | ||
operatorType = "namedpipe" | ||
DefaultMaxLogSize = 1024 * 1024 | ||
) | ||
|
||
func NewConfig() *Config { | ||
return NewConfigWithID(operatorType) | ||
} | ||
|
||
// NewConfig creates a new stdin input config with default values | ||
func NewConfigWithID(operatorID string) *Config { | ||
return &Config{ | ||
InputConfig: helper.NewInputConfig(operatorID, operatorType), | ||
} | ||
} | ||
|
||
// Config is the configuration of a stdin input operator. | ||
type Config struct { | ||
helper.InputConfig `mapstructure:",squash"` | ||
BaseConfig `mapstructure:",squash"` | ||
} | ||
|
||
type BaseConfig struct { | ||
Path string `mapstructure:"path"` | ||
Permissions uint32 `mapstructure:"mode"` | ||
Encoding string `mapstructure:"encoding"` | ||
SplitConfig split.Config `mapstructure:"multiline,omitempty"` | ||
TrimConfig trim.Config `mapstructure:",squash"` | ||
MaxLogSize int `mapstructure:"max_log_size"` | ||
} |
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,18 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build !linux | ||
// +build !linux | ||
|
||
package namedpipe // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/input/namedpipe" | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator" | ||
"go.uber.org/zap" | ||
) | ||
|
||
func (c *Config) Build(logger *zap.SugaredLogger) (operator.Operator, error) { | ||
return nil, errors.New("namedpipe input operator is only supported on linux") | ||
} |
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