Skip to content

Commit 1f8cff9

Browse files
atoulmegithub-actions[bot]
authored andcommitted
[receiver/wavefront] unexport WavefrontParser (open-telemetry#40105)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ff7438b commit 1f8cff9

File tree

4 files changed

+36
-9
lines changed

4 files changed

+36
-9
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: wavefrontreceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Unexport WavefrontParser struct
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [40105]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [api]

receiver/wavefrontreceiver/receiver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (r *metricsReceiver) Start(ctx context.Context, host component.Host) error
4949
TCPIdleTimeout: r.cfg.TCPIdleTimeout,
5050
Parser: &protocol.Config{
5151
Type: "plaintext", // TODO: update after other parsers are implemented for Carbon receiver.
52-
Config: &WavefrontParser{
52+
Config: &wavefrontParser{
5353
ExtractCollectdTags: r.cfg.ExtractCollectdTags,
5454
},
5555
},

receiver/wavefrontreceiver/wavefront_parser.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ import (
1717
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver/protocol"
1818
)
1919

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

2727
var (
28-
_ protocol.Parser = (*WavefrontParser)(nil)
29-
_ protocol.ParserConfig = (*WavefrontParser)(nil)
28+
_ protocol.Parser = (*wavefrontParser)(nil)
29+
_ protocol.ParserConfig = (*wavefrontParser)(nil)
3030
)
3131

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

3939
// BuildParser creates a new Parser instance that receives Wavefront metric data.
40-
func (wp *WavefrontParser) BuildParser() (protocol.Parser, error) {
40+
func (wp *wavefrontParser) BuildParser() (protocol.Parser, error) {
4141
return wp, nil
4242
}
4343

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

116-
func (wp *WavefrontParser) injectCollectDLabels(
116+
func (wp *wavefrontParser) injectCollectDLabels(
117117
metricName string,
118118
attributes pcommon.Map,
119119
) string {

receiver/wavefrontreceiver/wavefront_parser_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func Test_wavefrontParser_Parse(t *testing.T) {
284284

285285
for _, tt := range tests {
286286
t.Run(tt.line, func(t *testing.T) {
287-
p := WavefrontParser{ExtractCollectdTags: tt.extractCollectDTags}
287+
p := wavefrontParser{ExtractCollectdTags: tt.extractCollectDTags}
288288
got, err := p.Parse(tt.line)
289289
if tt.missingTimestamp {
290290
// The timestamp was actually generated by the parser.

0 commit comments

Comments
 (0)