Skip to content

Commit

Permalink
Merge branch 'main' into codeboten/update-config-dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
codeboten authored Jan 24, 2025
2 parents e30a30f + 2447a81 commit f2cddc3
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 18 deletions.
25 changes: 25 additions & 0 deletions .chloggen/fieldalignment_generated_others.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: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: apply fieldalignment to generated code

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

# (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: []
26 changes: 26 additions & 0 deletions .chloggen/mx-psi_metricslevel-detailed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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.TelemetrySettings.MetricsLevel` in favor of using views and 'Enabled' method.

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

# (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: |
- Components will temporarily need the service to support using views.
# 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]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/mdatagen/internal/templates/component_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ func TestComponentLifecycle(t *testing.T) {
factory := NewFactory()

tests := []struct{
name string
createFn func(ctx context.Context, set processor.Settings, cfg component.Config) (component.Component, error)
name string
}{
{{ if supportsLogs }}
{
Expand Down Expand Up @@ -266,8 +266,8 @@ func TestComponentLifecycle(t *testing.T) {
factory := NewFactory()

tests := []struct{
name string
createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error)
name string
}{
{{ if supportsLogs }}
{
Expand Down Expand Up @@ -335,8 +335,8 @@ func TestComponentLifecycle(t *testing.T) {
factory := NewFactory()

tests := []struct{
name string
createFn func(ctx context.Context, set scraper.Settings, cfg component.Config) (component.Component, error)
name string
}{
{{ if supportsLogs }}
{
Expand Down Expand Up @@ -440,8 +440,8 @@ func TestComponentLifecycle(t *testing.T) {
factory := NewFactory()

tests := []struct{
name string
createFn func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error)
name string
}{
{{ if supportsLogsToLogs }}
{
Expand Down
2 changes: 1 addition & 1 deletion component/componenttest/nop_telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ func TestNewNopTelemetrySettings(t *testing.T) {
assert.NotPanics(t, func() {
nts.MeterProvider.Meter("test")
})
assert.Equal(t, configtelemetry.LevelNone, nts.MetricsLevel)
assert.Equal(t, configtelemetry.LevelNone, nts.MetricsLevel) //nolint:staticcheck
assert.Equal(t, 0, nts.Resource.Attributes().Len())
}
2 changes: 1 addition & 1 deletion component/componenttest/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewTelemetry(opts ...TelemetryOption) Telemetry {
func (tt *Telemetry) NewTelemetrySettings() component.TelemetrySettings {
set := NewNopTelemetrySettings()
set.MeterProvider = tt.meterProvider
set.MetricsLevel = configtelemetry.LevelDetailed
set.MetricsLevel = configtelemetry.LevelDetailed //nolint:staticcheck //SA1019
set.TracerProvider = tt.traceProvider
return set
}
Expand Down
2 changes: 1 addition & 1 deletion component/componenttest/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestNewTelemetry(t *testing.T) {
assert.NotNil(t, tel.Reader)
assert.NotNil(t, tel.SpanRecorder)
set := tel.NewTelemetrySettings()
assert.Equal(t, configtelemetry.LevelDetailed, set.MetricsLevel)
assert.Equal(t, configtelemetry.LevelDetailed, set.MetricsLevel) //nolint:staticcheck //SA1019
assert.IsType(t, &sdktrace.TracerProvider{}, set.TracerProvider)
assert.IsType(t, &sdkmetric.MeterProvider{}, set.MeterProvider)
require.NoError(t, tel.Shutdown(context.Background()))
Expand Down
3 changes: 3 additions & 0 deletions component/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ type TelemetrySettings struct {
// MetricsLevel represents the configuration value set when the collector
// is configured. Components may use this level to decide whether it is
// appropriate to avoid computationally expensive calculations.
//
// Deprecated: [v0.119.0] Use https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric@v1.34.0/internal/x#readme-instrument-enabled instead.
// Components will temporarily need to add a view to `service/telemetry` to drop metrics based on the level.
MetricsLevel configtelemetry.Level

// Resource contains the resource attributes for the collector's telemetry.
Expand Down
3 changes: 1 addition & 2 deletions config/confighttp/confighttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"go.opentelemetry.io/collector/config/configauth"
"go.opentelemetry.io/collector/config/configcompression"
"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/extension/auth"
"go.opentelemetry.io/collector/extension/auth/authtest"
Expand All @@ -49,7 +48,7 @@ var (
dummyID = component.MustNewID("dummy")
nonExistingID = component.MustNewID("nonexisting")
// Omit TracerProvider and MeterProvider in TelemetrySettings as otelhttp.Transport cannot be introspected
nilProvidersSettings = component.TelemetrySettings{Logger: zap.NewNop(), MetricsLevel: configtelemetry.LevelNone}
nilProvidersSettings = component.TelemetrySettings{Logger: zap.NewNop()}
)

func TestAllHTTPClientSettings(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion config/confighttp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
go.opentelemetry.io/collector/config/configauth v0.118.0
go.opentelemetry.io/collector/config/configcompression v1.24.0
go.opentelemetry.io/collector/config/configopaque v1.24.0
go.opentelemetry.io/collector/config/configtelemetry v0.118.0
go.opentelemetry.io/collector/config/configtls v1.24.0
go.opentelemetry.io/collector/extension/auth v0.118.0
go.opentelemetry.io/collector/extension/auth/authtest v0.118.0
Expand All @@ -35,6 +34,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.118.0 // indirect
go.opentelemetry.io/collector/extension v0.118.0 // indirect
go.opentelemetry.io/collector/pdata v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.34.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion connector/forwardconnector/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion processor/batchprocessor/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion receiver/nopreceiver/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion receiver/otlpreceiver/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f2cddc3

Please sign in to comment.