Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reference to defaultcomponents in core and deprecate include_core flag #4087

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a5f22cb
remove defaultComponents from core and make it internal for tests
JamesJHPark Sep 17, 2021
8bd970a
remove package-lock.json file
JamesJHPark Sep 17, 2021
50f6733
remove checkdoc from GitHub actions workflow
JamesJHPark Sep 17, 2021
72af5bd
fix merge conflict
JamesJHPark Sep 22, 2021
3dd7e8f
Merge remote-tracking branch 'origin/remove-default-components-from-c…
JamesJHPark Sep 22, 2021
b610db0
add CHANGELOG entry
JamesJHPark Sep 23, 2021
02a2cd7
add checkdoc to github workflow
JamesJHPark Sep 26, 2021
0468ebd
testing lint check
JamesJHPark Sep 26, 2021
7916f74
resolve merge conflicts
JamesJHPark Sep 28, 2021
a2a9f4c
update additional files
JamesJHPark Sep 28, 2021
eeecba5
resolve merge conflicts
JamesJHPark Sep 29, 2021
83f30f7
Merge branch 'main' into remove-default-components-from-core
JamesJHPark Sep 29, 2021
50cb63e
remove-default-components-from-core
JamesJHPark Sep 29, 2021
9c07faa
add import statement
JamesJHPark Sep 29, 2021
e7d6e0e
fix Makefile
JamesJHPark Sep 29, 2021
fb8f888
add changelog entry
JamesJHPark Sep 29, 2021
c27fdd1
resolve merge conflit add to changelog
JamesJHPark Oct 13, 2021
33ed6ac
lint check
JamesJHPark Oct 13, 2021
2bffc9b
Merge branch 'main' into remove-default-components-from-core
JamesJHPark Oct 14, 2021
7a1ed63
fix lint test
JamesJHPark Oct 14, 2021
a589022
resolve merge conflict
JamesJHPark Nov 3, 2021
29b6670
run integration tests
JamesJHPark Nov 3, 2021
ba8bc42
partially removed dependency on real components for tests, removed re…
JamesJHPark Nov 16, 2021
f3803e6
fix lint
JamesJHPark Nov 16, 2021
c40cda1
Modify changelog entry
JamesJHPark Nov 18, 2021
cb298f9
remove include_core flag in builder
JamesJHPark Nov 30, 2021
9d27051
deprecate include_core flag
JamesJHPark Nov 30, 2021
61132c3
modify include_core flag comment
JamesJHPark Dec 1, 2021
02d0782
resolve merge conflict
JamesJHPark Dec 2, 2021
4433904
deprecate include_core flag revised
JamesJHPark Dec 2, 2021
ea97c11
deprecate include_core flag revised with log messages
JamesJHPark Dec 3, 2021
f09eeef
commit initial test for codecov
JamesJHPark Dec 4, 2021
c58836f
fixed test
JamesJHPark Dec 4, 2021
5f9b4e0
add changelog entry
JamesJHPark Dec 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
path: /home/runner/go/bin
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }}
- name: Lint
run: make -j5 checklicense misspell checkdoc goimpi golint
JamesJHPark marked this conversation as resolved.
Show resolved Hide resolved
run: make -j5 checklicense misspell goimpi golint
- name: Gen Metadata
run: |
make genmdata
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## 🛑 Breaking changes 🛑

- Remove `defaultcomponents` from core (#4087).
- Move configcheck.ValidateConfigFromFactories as internal function in service package (#3876).

## v0.36.0 Beta
Expand Down
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ BUILD_INFO=-ldflags "-X $(BUILD_INFO_IMPORT_PATH).Version=$(VERSION)"

RUN_CONFIG?=examples/local/otel-config.yaml
CONTRIB_PATH=$(CURDIR)/../opentelemetry-collector-contrib
COMP_REL_PATH=service/defaultcomponents/defaults.go
MOD_NAME=go.opentelemetry.io/collector

GO_ACC=go-acc
Expand Down Expand Up @@ -399,11 +398,6 @@ certs:
certs-dryrun:
@internal/buildscripts/gen-certs.sh -d

# Verify existence of READMEs for components specified as default components in the collector.
.PHONY: checkdoc
checkdoc:
checkdoc --project-path $(CURDIR) --component-rel-path $(COMP_REL_PATH) --module-name $(MOD_NAME)

# Construct new API state snapshots
.PHONY: apidiff-build
apidiff-build:
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcol/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"log"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/internal/testcomponents"
"go.opentelemetry.io/collector/internal/version"
"go.opentelemetry.io/collector/service"
"go.opentelemetry.io/collector/service/defaultcomponents"
)

func main() {
factories, err := defaultcomponents.Components()
factories, err := testcomponents.DefaultComponents()
JamesJHPark marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
log.Fatalf("failed to build default components: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
// interface and component.Exporter interface.
//
// To make the custom exporter part of the Collector build the factory must be added
// to defaultcomponents.Components() function.
// to testcomponents.DefaultComponents() function.
package exporter
58 changes: 58 additions & 0 deletions internal/testcomponents/example_factories.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ package testcomponents

import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer/consumererror"
"go.opentelemetry.io/collector/exporter/loggingexporter"
"go.opentelemetry.io/collector/exporter/otlpexporter"
"go.opentelemetry.io/collector/exporter/otlphttpexporter"
"go.opentelemetry.io/collector/extension/ballastextension"
"go.opentelemetry.io/collector/extension/zpagesextension"
"go.opentelemetry.io/collector/processor/batchprocessor"
"go.opentelemetry.io/collector/processor/memorylimiterprocessor"
"go.opentelemetry.io/collector/receiver/otlpreceiver"
)

// ExampleComponents registers example factories. This is only used by tests.
Expand All @@ -39,3 +48,52 @@ func ExampleComponents() (

return
}

// DefaultComponents returns the default set of components used by the OpenTelemetry collector.
func DefaultComponents() (
JamesJHPark marked this conversation as resolved.
Show resolved Hide resolved
component.Factories,
error,
) {
var errs []error

extensions, err := component.MakeExtensionFactoryMap(
zpagesextension.NewFactory(),
ballastextension.NewFactory(),
)
if err != nil {
errs = append(errs, err)
}

receivers, err := component.MakeReceiverFactoryMap(
otlpreceiver.NewFactory(),
)
if err != nil {
errs = append(errs, err)
}

exporters, err := component.MakeExporterFactoryMap(
loggingexporter.NewFactory(),
otlpexporter.NewFactory(),
otlphttpexporter.NewFactory(),
)
if err != nil {
errs = append(errs, err)
}

processors, err := component.MakeProcessorFactoryMap(
batchprocessor.NewFactory(),
memorylimiterprocessor.NewFactory(),
)
if err != nil {
errs = append(errs, err)
}

factories := component.Factories{
Extensions: extensions,
Receivers: receivers,
Processors: processors,
Exporters: exporters,
}

return factories, consumererror.Combine(errs)
}
10 changes: 5 additions & 5 deletions service/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configparser"
"go.opentelemetry.io/collector/config/configunmarshaler"
"go.opentelemetry.io/collector/internal/testcomponents"
"go.opentelemetry.io/collector/internal/testutil"
"go.opentelemetry.io/collector/service/defaultcomponents"
"go.opentelemetry.io/collector/service/internal/builder"
"go.opentelemetry.io/collector/service/parserprovider"
)

func TestCollector_Start(t *testing.T) {
factories, err := defaultcomponents.Components()
factories, err := testcomponents.DefaultComponents()
require.NoError(t, err)

loggingHookCalled := false
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestCollector_ReportError(t *testing.T) {
collectorTelemetry = &mockColTelemetry{}
defer func() { collectorTelemetry = preservedAppTelemetry }()

factories, err := defaultcomponents.Components()
factories, err := testcomponents.DefaultComponents()
require.NoError(t, err)

col, err := New(CollectorSettings{BuildInfo: component.DefaultBuildInfo(), Factories: factories})
Expand All @@ -141,7 +141,7 @@ func TestCollector_ReportError(t *testing.T) {
}

func TestCollector_StartAsGoRoutine(t *testing.T) {
factories, err := defaultcomponents.Components()
factories, err := testcomponents.DefaultComponents()
require.NoError(t, err)

set := CollectorSettings{
Expand Down Expand Up @@ -279,7 +279,7 @@ func (epl *errParserLoader) Close(context.Context) error {
}

func TestCollector_reloadService(t *testing.T) {
factories, err := defaultcomponents.Components()
factories, err := testcomponents.DefaultComponents()
require.NoError(t, err)
ctx := context.Background()
sentinelError := errors.New("sentinel error")
Expand Down
4 changes: 2 additions & 2 deletions service/collector_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import (
"golang.org/x/sys/windows/svc"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/service/defaultcomponents"
"go.opentelemetry.io/collector/internal/testcomponents"
)

func TestWindowsService_Execute(t *testing.T) {
os.Args = []string{"otelcol", "--config", "testdata/otelcol-config-minimal.yaml"}

factories, err := defaultcomponents.Components()
factories, err := testcomponents.DefaultComponents()
require.NoError(t, err)

s := NewWindowsService(CollectorSettings{BuildInfo: component.DefaultBuildInfo(), Factories: factories})
Expand Down
6 changes: 3 additions & 3 deletions service/configcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/service/defaultcomponents"
"go.opentelemetry.io/collector/internal/testcomponents"
)

func TestValidateConfigFromFactories_Success(t *testing.T) {
factories, err := defaultcomponents.Components()
factories, err := testcomponents.DefaultComponents()
require.NoError(t, err)

err = validateConfigFromFactories(factories)
require.NoError(t, err)
}

func TestValidateConfigFromFactories_Failure(t *testing.T) {
factories, err := defaultcomponents.Components()
factories, err := testcomponents.DefaultComponents()
require.NoError(t, err)

// Add a factory returning config not following pattern to force error.
Expand Down
153 changes: 0 additions & 153 deletions service/defaultcomponents/default_exporters_test.go

This file was deleted.

Loading