Skip to content

Commit

Permalink
Merge branch 'main' into renovate/all-golang.orgx-packages
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdandrutu authored Jan 6, 2025
2 parents cc60b0a + de320aa commit efa5900
Show file tree
Hide file tree
Showing 80 changed files with 2,057 additions and 253 deletions.
25 changes: 25 additions & 0 deletions .chloggen/dep-comp-test.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: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate component_test in favor of metadatatest

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

# (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/experimental.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: extension/experimental

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate extension/experimental in favor of extension/xextension

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

# (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]
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exporter/nopexporter @open-telemetry/collector-approvers @evan-bradle
pdata/ @open-telemetry/collector-approvers @BogdanDrutu @dmitryax
receiver/nopreceiver @open-telemetry/collector-approvers @evan-bradley
service/internal/graph @open-telemetry/collector-approvers @djaglowski
extension/experimental/storage @open-telemetry/collector-approvers @swiatekm
extension/xextension @open-telemetry/collector-approvers @swiatekm

# Profiling-related modules
pdata/pprofile @open-telemetry/collector-approvers @mx-psi @dmathieu
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/build-and-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ permissions: read-all

jobs:
windows-unittest:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -41,7 +45,11 @@ jobs:
run: make gotest

windows-service-test:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
2 changes: 1 addition & 1 deletion cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ var replaceModules = []string{
"/extension",
"/extension/auth",
"/extension/auth/authtest",
"/extension/experimental/storage",
"/extension/extensioncapabilities",
"/extension/extensiontest",
"/extension/zpagesextension",
"/extension/xextension",
"/featuregate",
"/internal/memorylimiter",
"/internal/fanoutconsumer",
Expand Down
2 changes: 1 addition & 1 deletion cmd/builder/test/core.builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ replaces:
- go.opentelemetry.io/collector/extension => ${WORKSPACE_DIR}/extension
- go.opentelemetry.io/collector/extension/auth => ${WORKSPACE_DIR}/extension/auth
- go.opentelemetry.io/collector/extension/auth/authtest => ${WORKSPACE_DIR}/extension/auth/authtest
- go.opentelemetry.io/collector/extension/experimental/storage => ${WORKSPACE_DIR}/extension/experimental/storage
- go.opentelemetry.io/collector/extension/extensioncapabilities => ${WORKSPACE_DIR}/extension/extensioncapabilities
- go.opentelemetry.io/collector/extension/extensiontest => ${WORKSPACE_DIR}/extension/extensiontest
- go.opentelemetry.io/collector/extension/zpagesextension => ${WORKSPACE_DIR}/extension/zpagesextension
- go.opentelemetry.io/collector/extension/xextension => ${WORKSPACE_DIR}/extension/xextension
- go.opentelemetry.io/collector/featuregate => ${WORKSPACE_DIR}/featuregate
- go.opentelemetry.io/collector/internal/memorylimiter => ${WORKSPACE_DIR}/internal/memorylimiter
- go.opentelemetry.io/collector/internal/fanoutconsumer => ${WORKSPACE_DIR}/internal/fanoutconsumer
Expand Down
6 changes: 6 additions & 0 deletions cmd/mdatagen/internal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func run(ymlPath string) error {
if err = os.MkdirAll(codeDir, 0o700); err != nil {
return fmt.Errorf("unable to create output directory %q: %w", codeDir, err)
}
testDir := filepath.Join(ymlDir, "internal", md.GeneratedPackageName+"test")
if err = os.MkdirAll(testDir, 0o700); err != nil {
return fmt.Errorf("unable to create output test directory %q: %w", codeDir, err)
}
if md.Status != nil {
if md.Status.Class != "cmd" && md.Status.Class != "pkg" && !md.Status.NotComponent {
if err = generateFile(filepath.Join(tmplDir, "status.go.tmpl"),
Expand Down Expand Up @@ -114,6 +118,8 @@ func run(ymlPath string) error {
}
toGenerate[filepath.Join(tmplDir, "telemetry.go.tmpl")] = filepath.Join(codeDir, "generated_telemetry.go")
toGenerate[filepath.Join(tmplDir, "telemetry_test.go.tmpl")] = filepath.Join(codeDir, "generated_telemetry_test.go")
toGenerate[filepath.Join(tmplDir, "telemetrytest.go.tmpl")] = filepath.Join(testDir, "generated_telemetrytest.go")
toGenerate[filepath.Join(tmplDir, "telemetrytest_test.go.tmpl")] = filepath.Join(testDir, "generated_telemetrytest_test.go")
}

if len(md.Metrics) != 0 || len(md.Telemetry.Metrics) != 0 || len(md.ResourceAttributes) != 0 { // if there's metrics or internal metrics, generate documentation for them
Expand Down
2 changes: 2 additions & 0 deletions cmd/mdatagen/internal/embedded_templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func TestEnsureTemplatesLoaded(t *testing.T) {
path.Join(rootDir, "telemetry.go.tmpl"): {},
path.Join(rootDir, "telemetry_test.go.tmpl"): {},
path.Join(rootDir, "testdata", "config.yaml.tmpl"): {},
path.Join(rootDir, "telemetrytest.go.tmpl"): {},
path.Join(rootDir, "telemetrytest_test.go.tmpl"): {},
}
count = 0
)
Expand Down

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.

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

12 changes: 7 additions & 5 deletions cmd/mdatagen/internal/samplereceiver/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (

"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"

"go.opentelemetry.io/collector/cmd/mdatagen/internal/samplereceiver/internal/metadata"
"go.opentelemetry.io/collector/cmd/mdatagen/internal/samplereceiver/internal/metadatatest"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/receiver/receivertest"
Expand All @@ -24,11 +26,11 @@ func TestGeneratedMetrics(t *testing.T) {
}

func TestComponentTelemetry(t *testing.T) {
tt := setupTestTelemetry()
tt := metadatatest.SetupTelemetry()
factory := NewFactory()
receiver, err := factory.CreateMetrics(context.Background(), tt.NewSettings(), componenttest.NewNopHost(), new(consumertest.MetricsSink))
require.NoError(t, err)
tt.assertMetrics(t, []metricdata.Metrics{
tt.AssertMetrics(t, []metricdata.Metrics{
{
Name: "otelcol_batch_size_trigger_send",
Description: "Number of times the batch was sent due to a size trigger [deprecated since v0.110.0]",
Expand Down Expand Up @@ -57,11 +59,11 @@ func TestComponentTelemetry(t *testing.T) {
},
},
},
})
}, metricdatatest.IgnoreTimestamp())
rcv, ok := receiver.(nopReceiver)
require.True(t, ok)
rcv.initOptionalMetric()
tt.assertMetrics(t, []metricdata.Metrics{
tt.AssertMetrics(t, []metricdata.Metrics{
{
Name: "otelcol_batch_size_trigger_send",
Description: "Number of times the batch was sent due to a size trigger [deprecated since v0.110.0]",
Expand Down Expand Up @@ -102,6 +104,6 @@ func TestComponentTelemetry(t *testing.T) {
},
},
},
})
}, metricdatatest.IgnoreTimestamp())
require.NoError(t, tt.Shutdown(context.Background()))
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
{{- end }}
)

// Deprecated: [v0.117.0] use metadatatest.Telemetry
type componentTestTelemetry struct {
reader *sdkmetric.ManualReader
meterProvider *sdkmetric.MeterProvider
Expand All @@ -44,6 +45,7 @@ func (tt *componentTestTelemetry) newTelemetrySettings() component.TelemetrySett
return set
}

// Deprecated: [v0.116.0] use metadatatest.SetupTelemetry
func setupTestTelemetry() componentTestTelemetry {
reader := sdkmetric.NewManualReader()
return componentTestTelemetry{
Expand Down
Loading

0 comments on commit efa5900

Please sign in to comment.