Skip to content

Commit

Permalink
Merge branch 'main' into configgrpc-add-context
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHelmuth authored Feb 26, 2024
2 parents 003611b + 4ae8d2b commit ab1124c
Show file tree
Hide file tree
Showing 43 changed files with 845 additions and 312 deletions.
25 changes: 25 additions & 0 deletions .chloggen/confighttp-remove-deprecated-items.yaml
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: breaking

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove deprecated `HTTPClientSettings`, `NewDefaultHTTPClientSettings`, and `CORSSettings`.

# One or more tracking issues or pull requests related to the change
issues: [9625]

# (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: []
25 changes: 25 additions & 0 deletions .chloggen/confignet-remove-deprecated-structs.yaml
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: breaking

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Removes deprecated `NetAddr` and `TCPAddr`

# One or more tracking issues or pull requests related to the change
issues: [9614]

# (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: []
25 changes: 25 additions & 0 deletions .chloggen/deprecate_ErrNilNextConsumer.yaml
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: deprecation

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

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

# One or more tracking issues or pull requests related to the change
issues: [9526]

# (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]
25 changes: 25 additions & 0 deletions .chloggen/implement_contract_checker.yaml
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: enhancement

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: add support for metrics in contract checker

# One or more tracking issues or pull requests related to the change
issues: [9551]

# (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]
25 changes: 25 additions & 0 deletions .chloggen/make-metadata-thread-safe.yaml
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: bug_fix

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Make `Metadata.Get` thread safe

# One or more tracking issues or pull requests related to the change
issues: [9595]

# (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: []
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@e675ced7a7522a761fc9c8eb26682c8b27c42b2b # v3.24.1
uses: github/codeql-action/init@e2e140ad1441662206e8f97754b166877dfa1c73 # v3.24.4
with:
languages: go

- name: Autobuild
uses: github/codeql-action/autobuild@e675ced7a7522a761fc9c8eb26682c8b27c42b2b # v3.24.1
uses: github/codeql-action/autobuild@e2e140ad1441662206e8f97754b166877dfa1c73 # v3.24.4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e675ced7a7522a761fc9c8eb26682c8b27c42b2b # v3.24.1
uses: github/codeql-action/analyze@e2e140ad1441662206e8f97754b166877dfa1c73 # v3.24.4
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@1a077f8f6c71a45340c26ca0b877e00459e5f443 # v2.24.1
uses: github/codeql-action/upload-sarif@80eb8d5395c1d8edac424890a2dc323568ba25fb # v2.24.4
with:
sarif_file: results.sarif
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ restore-contrib:
@echo Restoring contrib at $(CONTRIB_PATH) to its original state
@$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit \
-dropreplace go.opentelemetry.io/collector \
-dropreplace go.opentelemetry.io/collector/component
-dropreplace go.opentelemetry.io/collector/component \
-dropreplace go.opentelemetry.io/collector/config/configauth \
-dropreplace go.opentelemetry.io/collector/config/configcompression \
-dropreplace go.opentelemetry.io/collector/config/configgrpc \
-dropreplace go.opentelemetry.io/collector/config/confighttp \
Expand Down Expand Up @@ -328,7 +329,7 @@ restore-contrib:
-dropreplace go.opentelemetry.io/collector/extension/auth \
-dropreplace go.opentelemetry.io/collector/extension/ballastextension \
-dropreplace go.opentelemetry.io/collector/extension/memorylimiterextension \
-dropreplace go.opentelemetry.io/collector/extension/zpagestextension \
-dropreplace go.opentelemetry.io/collector/extension/zpagesextension \
-dropreplace go.opentelemetry.io/collector/featuregate \
-dropreplace go.opentelemetry.io/collector/otelcol \
-dropreplace go.opentelemetry.io/collector/pdata \
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<a href="https://github.com/open-telemetry/opentelemetry-collector/releases">
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/open-telemetry/opentelemetry-collector?include_prereleases&style=for-the-badge">
</a>
<a href="https://www.bestpractices.dev/projects/8404"><img src="https://www.bestpractices.dev/projects/8404/badge">
</a>
</p>

<p align="center">
Expand Down
26 changes: 11 additions & 15 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,28 +141,24 @@ func FromContext(ctx context.Context) Info {

// NewMetadata creates a new Metadata object to use in Info. md is used as-is.
func NewMetadata(md map[string][]string) Metadata {
c := make(map[string][]string, len(md))
for k, v := range md {
c[strings.ToLower(k)] = v
}
return Metadata{
data: md,
data: c,
}
}

// Get gets the value of the key from metadata, returning a copy.
func (m Metadata) Get(key string) []string {
vals := m.data[key]
if len(m.data) == 0 {
return nil
}

vals := m.data[strings.ToLower(key)]
if len(vals) == 0 {
// we didn't find the key, but perhaps it just has different cases?
for k, v := range m.data {
if strings.EqualFold(key, k) {
vals = v
// we optimize for the next lookup
m.data[key] = v
}
}

// if it's still not found, it's really not here
if len(vals) == 0 {
return nil
}
return nil
}

ret := make([]string, len(vals))
Expand Down
10 changes: 8 additions & 2 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ func TestFromContext(t *testing.T) {
}

func TestMetadata(t *testing.T) {
source := map[string][]string{"test-key": {"test-val"}}
source := map[string][]string{"test-key": {"test-val"}, "TEST-KEY-2": {"test-val"}}
md := NewMetadata(source)
assert.Equal(t, []string{"test-val"}, md.Get("test-key"))
assert.Equal(t, []string{"test-val"}, md.Get("test-KEY")) // case insensitive lookup
assert.Equal(t, []string{"test-val"}, md.Get("test-KEY")) // case insensitive lookup
assert.Equal(t, []string{"test-val"}, md.Get("test-key-2")) // case insensitive lookup

// test if copy. In regular use, source cannot change
val := md.Get("test-key")
Expand All @@ -89,3 +90,8 @@ func TestMetadata(t *testing.T) {

assert.Empty(t, md.Get("non-existent-key"))
}

func TestUninstantiatedMetadata(t *testing.T) {
i := Info{}
assert.Empty(t, i.Metadata.Get("test"))
}
2 changes: 1 addition & 1 deletion cmd/builder/internal/builder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"go.uber.org/zap"
)

const defaultOtelColVersion = "0.94.0"
const defaultOtelColVersion = "0.95.0"

// ErrInvalidGoMod indicates an invalid gomod
var ErrInvalidGoMod = errors.New("invalid gomod specification for module")
Expand Down
17 changes: 17 additions & 0 deletions cmd/mdatagen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,23 @@ Some info about a component
componentClass: "extension",
distros: []string{"contrib"},
},
{
name: "readme with status with codeowners and seeking new",
markdown: `# Some component
<!-- status autogenerated section -->
<!-- end autogenerated section -->
Some info about a component
`,
outputFile: "readme_with_status_codeowners_and_seeking_new.md",
componentClass: "receiver",
distros: []string{"contrib"},
codeowners: &Codeowners{
Active: []string{"foo"},
SeekingNew: true,
},
},
{
name: "readme with status with codeowners and emeritus",
markdown: `# Some component
Expand Down
2 changes: 2 additions & 0 deletions cmd/mdatagen/statusdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type Codeowners struct {
Active []string `mapstructure:"active"`
// Emeritus codeowners
Emeritus []string `mapstructure:"emeritus"`
// Whether new codeowners are being sought
SeekingNew bool `mapstructure:"seeking_new"`
}

type Status struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mdatagen/templates/readme.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{- if .Status.Codeowners }}
{{- $codeowners := userLinks .Status.Codeowners.Active }}
{{- $emeritus := userLinks .Status.Codeowners.Emeritus }}
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | {{ stringsJoin $codeowners ", " }} |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | {{ stringsJoin $codeowners ", " }} {{ if .Status.Codeowners.SeekingNew }}\| Seeking more code owners! {{ end }}|
{{- if $emeritus }}
| Emeritus | {{ stringsJoin $emeritus ", " }} |
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Some component

<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [beta]: metrics |
| Distributions | [contrib] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Ffoo%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Ffoo) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Ffoo%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Ffoo) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@foo](https://www.github.com/foo) \| Seeking more code owners! |

[beta]: https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
<!-- end autogenerated section -->

Some info about a component
11 changes: 6 additions & 5 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
)

require (
cloud.google.com/go/compute/metadata v0.2.4-0.20230617002413-005d2dfb6b68 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand Down Expand Up @@ -100,8 +100,8 @@ require (
go.opentelemetry.io/collector/semconv v0.95.0 // indirect
go.opentelemetry.io/collector/service v0.95.0 // indirect
go.opentelemetry.io/contrib/config v0.3.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.23.0 // indirect
go.opentelemetry.io/contrib/zpages v0.48.0 // indirect
go.opentelemetry.io/otel v1.23.1 // indirect
Expand All @@ -122,10 +122,11 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
gonum.org/v1/gonum v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240221002015-b0ce06bbee7c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit ab1124c

Please sign in to comment.