-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-contrib-mdatagen-test
- Loading branch information
Showing
29 changed files
with
727 additions
and
202 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,25 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: new_component | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: pipeline | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Adds new `pipeline` module to house the concept of pipeline ID and Signal. | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [11209] | ||
|
||
# (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: | ||
|
||
# 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] |
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,20 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: 'enhancement' | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: consumertest | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Introduce SampleCount method in ProfilesSink struct. | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [11225] | ||
|
||
# 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] |
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
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
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 @@ | ||
include ../../Makefile.Common |
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,11 @@ | ||
module go.opentelemetry.io/collector/internal/globalsignal | ||
|
||
go 1.22.0 | ||
|
||
require github.com/stretchr/testify v1.9.0 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,50 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package globalsignal // import "go.opentelemetry.io/collector/internal/globalsignal" | ||
|
||
import ( | ||
"fmt" | ||
"regexp" | ||
) | ||
|
||
// Signal represents the signals supported by the collector. | ||
type Signal struct { | ||
name string | ||
} | ||
|
||
// String returns the string representation of the signal. | ||
func (s Signal) String() string { | ||
return s.name | ||
} | ||
|
||
// MarshalText marshals the Signal. | ||
func (s Signal) MarshalText() (text []byte, err error) { | ||
return []byte(s.name), nil | ||
} | ||
|
||
// signalRegex is used to validate the signal. | ||
// A signal must consist of 1 to 62 lowercase ASCII alphabetic characters. | ||
var signalRegex = regexp.MustCompile(`^[a-z]{1,62}$`) | ||
|
||
// NewSignal creates a Signal. It returns an error if the Signal is invalid. | ||
// A Signal must consist of 1 to 62 lowercase ASCII alphabetic characters. | ||
func NewSignal(signal string) (Signal, error) { | ||
if len(signal) == 0 { | ||
return Signal{}, fmt.Errorf("signal must not be empty") | ||
} | ||
if !signalRegex.MatchString(signal) { | ||
return Signal{}, fmt.Errorf("invalid character(s) in type %q", signal) | ||
} | ||
return Signal{name: signal}, nil | ||
} | ||
|
||
// MustNewSignal creates a Signal. It panics if the Signal is invalid. | ||
// A signal must consist of 1 to 62 lowercase ASCII alphabetic characters. | ||
func MustNewSignal(signal string) Signal { | ||
s, err := NewSignal(signal) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return s | ||
} |
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 globalsignal | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_NewSignal(t *testing.T) { | ||
s, err := NewSignal("traces") | ||
require.NoError(t, err) | ||
assert.Equal(t, Signal{name: "traces"}, s) | ||
} | ||
|
||
func Test_NewSignal_Invalid(t *testing.T) { | ||
_, err := NewSignal("") | ||
require.Error(t, err) | ||
_, err = NewSignal("TRACES") | ||
require.Error(t, err) | ||
} | ||
|
||
func Test_MustNewSignal(t *testing.T) { | ||
s := MustNewSignal("traces") | ||
assert.Equal(t, Signal{name: "traces"}, s) | ||
} | ||
|
||
func Test_Signal_String(t *testing.T) { | ||
s := MustNewSignal("traces") | ||
assert.Equal(t, "traces", s.String()) | ||
} | ||
|
||
func Test_Signal_MarshalText(t *testing.T) { | ||
s := MustNewSignal("traces") | ||
b, err := s.MarshalText() | ||
require.NoError(t, err) | ||
assert.Equal(t, []byte("traces"), b) | ||
} |
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
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 @@ | ||
include ../Makefile.Common |
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,16 @@ | ||
module go.opentelemetry.io/collector/pipeline | ||
|
||
go 1.22.0 | ||
|
||
require ( | ||
github.com/stretchr/testify v1.9.0 | ||
go.opentelemetry.io/collector/internal/globalsignal v0.109.0 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) | ||
|
||
replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.