Skip to content

[receiver/wavefront] unexport WavefrontParser #40105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/unexport_wavefrontparser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: wavefrontreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Unexport WavefrontParser struct

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [40105]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
2 changes: 1 addition & 1 deletion receiver/wavefrontreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (r *metricsReceiver) Start(ctx context.Context, host component.Host) error
TCPIdleTimeout: r.cfg.TCPIdleTimeout,
Parser: &protocol.Config{
Type: "plaintext", // TODO: update after other parsers are implemented for Carbon receiver.
Config: &WavefrontParser{
Config: &wavefrontParser{
ExtractCollectdTags: r.cfg.ExtractCollectdTags,
},
},
Expand Down
14 changes: 7 additions & 7 deletions receiver/wavefrontreceiver/wavefront_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver/protocol"
)

// WavefrontParser converts metrics in the Wavefront format, see
// wavefrontParser converts metrics in the Wavefront format, see
// https://docs.wavefront.com/wavefront_data_format.html#metrics-data-format-syntax,
// into the internal format of the Collector
type WavefrontParser struct {
type wavefrontParser struct {
ExtractCollectdTags bool `mapstructure:"extract_collectd_tags"`
}

var (
_ protocol.Parser = (*WavefrontParser)(nil)
_ protocol.ParserConfig = (*WavefrontParser)(nil)
_ protocol.Parser = (*wavefrontParser)(nil)
_ protocol.ParserConfig = (*wavefrontParser)(nil)
)

// Only two chars can be escaped per Wavefront SDK, see
Expand All @@ -37,7 +37,7 @@ var escapedCharReplacer = strings.NewReplacer(
)

// BuildParser creates a new Parser instance that receives Wavefront metric data.
func (wp *WavefrontParser) BuildParser() (protocol.Parser, error) {
func (wp *wavefrontParser) BuildParser() (protocol.Parser, error) {
return wp, nil
}

Expand All @@ -50,7 +50,7 @@ func (wp *WavefrontParser) BuildParser() (protocol.Parser, error) {
// "<metricName> <metricValue> [<timestamp>] source=<source> [pointTags]"
//
// Detailed description of each element is available on the link above.
func (wp *WavefrontParser) Parse(line string) (pmetric.Metric, error) {
func (wp *wavefrontParser) Parse(line string) (pmetric.Metric, error) {
parts := strings.SplitN(line, " ", 3)
if len(parts) < 3 {
return pmetric.Metric{}, fmt.Errorf("invalid wavefront metric [%s]", line)
Expand Down Expand Up @@ -113,7 +113,7 @@ func (wp *WavefrontParser) Parse(line string) (pmetric.Metric, error) {
return metric, nil
}

func (wp *WavefrontParser) injectCollectDLabels(
func (wp *wavefrontParser) injectCollectDLabels(
metricName string,
attributes pcommon.Map,
) string {
Expand Down
2 changes: 1 addition & 1 deletion receiver/wavefrontreceiver/wavefront_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func Test_wavefrontParser_Parse(t *testing.T) {

for _, tt := range tests {
t.Run(tt.line, func(t *testing.T) {
p := WavefrontParser{ExtractCollectdTags: tt.extractCollectDTags}
p := wavefrontParser{ExtractCollectdTags: tt.extractCollectDTags}
got, err := p.Parse(tt.line)
if tt.missingTimestamp {
// The timestamp was actually generated by the parser.
Expand Down
Loading