-
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.
Replace registration system with an explicit dependency one (#159)
Implements proposal: #138
- Loading branch information
Showing
60 changed files
with
712 additions
and
466 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
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,74 @@ | ||
// Copyright 2019, OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package defaults composes the default set of components used by the otel service | ||
package defaults | ||
|
||
import ( | ||
"github.com/open-telemetry/opentelemetry-service/exporter" | ||
"github.com/open-telemetry/opentelemetry-service/exporter/loggingexporter" | ||
"github.com/open-telemetry/opentelemetry-service/exporter/opencensusexporter" | ||
"github.com/open-telemetry/opentelemetry-service/exporter/prometheusexporter" | ||
"github.com/open-telemetry/opentelemetry-service/internal" | ||
"github.com/open-telemetry/opentelemetry-service/internal/collector/processor/nodebatcher" | ||
"github.com/open-telemetry/opentelemetry-service/internal/collector/processor/queued" | ||
"github.com/open-telemetry/opentelemetry-service/processor" | ||
"github.com/open-telemetry/opentelemetry-service/processor/addattributesprocessor" | ||
"github.com/open-telemetry/opentelemetry-service/receiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/jaegerreceiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/opencensusreceiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/prometheusreceiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/vmmetricsreceiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/zipkinreceiver" | ||
) | ||
|
||
// Components returns the default set of components used by the | ||
// opentelemetry service | ||
func Components() ( | ||
map[string]receiver.Factory, | ||
map[string]processor.Factory, | ||
map[string]exporter.Factory, | ||
error, | ||
) { | ||
errs := []error{} | ||
receivers, err := receiver.Build( | ||
&jaegerreceiver.Factory{}, | ||
&zipkinreceiver.Factory{}, | ||
&prometheusreceiver.Factory{}, | ||
&opencensusreceiver.Factory{}, | ||
&vmmetricsreceiver.Factory{}, | ||
) | ||
if err != nil { | ||
errs = append(errs, err) | ||
} | ||
|
||
exporters, err := exporter.Build( | ||
&opencensusexporter.Factory{}, | ||
&prometheusexporter.Factory{}, | ||
&loggingexporter.Factory{}, | ||
) | ||
if err != nil { | ||
errs = append(errs, err) | ||
} | ||
|
||
processors, err := processor.Build( | ||
&addattributesprocessor.Factory{}, | ||
&queued.Factory{}, | ||
&nodebatcher.Factory{}, | ||
) | ||
if err != nil { | ||
errs = append(errs, err) | ||
} | ||
return receivers, processors, exporters, internal.CombineErrors(errs) | ||
} |
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,66 @@ | ||
// Copyright 2019, OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Program otelsvc is the Open Telemetry Service that collects stats | ||
// and traces and exports to a configured backend. | ||
package defaults | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/open-telemetry/opentelemetry-service/exporter" | ||
"github.com/open-telemetry/opentelemetry-service/exporter/loggingexporter" | ||
"github.com/open-telemetry/opentelemetry-service/exporter/opencensusexporter" | ||
"github.com/open-telemetry/opentelemetry-service/exporter/prometheusexporter" | ||
"github.com/open-telemetry/opentelemetry-service/internal/collector/processor/nodebatcher" | ||
"github.com/open-telemetry/opentelemetry-service/internal/collector/processor/queued" | ||
"github.com/open-telemetry/opentelemetry-service/processor" | ||
"github.com/open-telemetry/opentelemetry-service/processor/addattributesprocessor" | ||
"github.com/open-telemetry/opentelemetry-service/receiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/jaegerreceiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/opencensusreceiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/prometheusreceiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/vmmetricsreceiver" | ||
"github.com/open-telemetry/opentelemetry-service/receiver/zipkinreceiver" | ||
) | ||
|
||
func TestDefaultComponents(t *testing.T) { | ||
expectedReceivers := map[string]receiver.Factory{ | ||
"jaeger": &jaegerreceiver.Factory{}, | ||
"zipkin": &zipkinreceiver.Factory{}, | ||
"prometheus": &prometheusreceiver.Factory{}, | ||
"opencensus": &opencensusreceiver.Factory{}, | ||
"vmmetrics": &vmmetricsreceiver.Factory{}, | ||
} | ||
expectedProcessors := map[string]processor.Factory{ | ||
"attributes": &addattributesprocessor.Factory{}, | ||
"queued-retry": &queued.Factory{}, | ||
"batch": &nodebatcher.Factory{}, | ||
} | ||
expectedExporters := map[string]exporter.Factory{ | ||
"opencensus": &opencensusexporter.Factory{}, | ||
"prometheus": &prometheusexporter.Factory{}, | ||
"logging": &loggingexporter.Factory{}, | ||
} | ||
|
||
receivers, processors, exporters, err := Components() | ||
fmt.Println(err) | ||
assert.Nil(t, err) | ||
assert.Equal(t, expectedReceivers, receivers) | ||
assert.Equal(t, expectedProcessors, processors) | ||
assert.Equal(t, expectedExporters, exporters) | ||
} |
Oops, something went wrong.