-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Introducing contrib builds #33
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM alpine:latest as certs | ||
RUN apk --update add ca-certificates | ||
|
||
FROM scratch | ||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY otelcontribcol / | ||
ENTRYPOINT ["/otelcontribcol"] | ||
EXPOSE 55678 55679 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// 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 main | ||
|
||
import ( | ||
"github.com/open-telemetry/opentelemetry-collector/config" | ||
"github.com/open-telemetry/opentelemetry-collector/defaults" | ||
"github.com/open-telemetry/opentelemetry-collector/exporter" | ||
"github.com/open-telemetry/opentelemetry-collector/oterr" | ||
"github.com/open-telemetry/opentelemetry-collector/receiver" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/stackdriverexporter" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinscribereceiver" | ||
) | ||
|
||
func components() (config.Factories, error) { | ||
errs := []error{} | ||
factories, err := defaults.Components() | ||
if err != nil { | ||
return config.Factories{}, err | ||
tigrannajaryan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
receivers := []receiver.Factory{&zipkinscribereceiver.Factory{}} | ||
for _, rcv := range factories.Receivers { | ||
receivers = append(receivers, rcv) | ||
} | ||
factories.Receivers, err = receiver.Build(receivers...) | ||
if err != nil { | ||
errs = append(errs, err) | ||
} | ||
|
||
exporters := []exporter.Factory{&stackdriverexporter.Factory{}} | ||
for _, exp := range factories.Exporters { | ||
exporters = append(exporters, exp) | ||
} | ||
factories.Exporters, err = exporter.Build(exporters...) | ||
if err != nil { | ||
errs = append(errs, err) | ||
} | ||
|
||
return factories, oterr.CombineErrors(errs) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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 otelcontribcol is the Omnition Telemetry Service built on top of | ||
// OpenTelemetry Service. | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector/service" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/version" | ||
) | ||
|
||
func main() { | ||
handleErr := func(err error) { | ||
if err != nil { | ||
log.Fatalf("Failed to run the service: %v", err) | ||
} | ||
} | ||
|
||
factories, err := components() | ||
handleErr(err) | ||
|
||
info := service.ApplicationStartInfo{ | ||
ExeName: "otelcontribcol", | ||
LongName: "OpenTelemetry Contrib Collector", | ||
Version: version.Version, | ||
GitHash: version.GitHash, | ||
} | ||
|
||
svc, err := service.New(factories, info) | ||
handleErr(err) | ||
|
||
err = svc.Start() | ||
handleErr(err) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ go 1.12 | |
require ( | ||
github.com/client9/misspell v0.3.4 | ||
github.com/google/addlicense v0.0.0-20190907113143-be125746c2c4 | ||
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191016224815-dfabfb0c1d1e | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have this module together with main.go? This will follow the same pattern that we have for individual components. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I was planning on doing it if/when we introduce multiple builds from this repo (protobuf vs gogoproto) but will look into doing it right away. We'll have to keep this go.mod around anyway so this repo can be consumed as a lib easily (stuff other than explicit modules like receivers, exporters). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thought, I think we should punt it for now. If we make it a module, it'll not be able to access any There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. |
||
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/stackdriverexporter v0.0.0-20191021165924-bb954188ac10 | ||
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinscribereceiver v0.0.0-20191021165924-bb954188ac10 | ||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac | ||
golang.org/x/tools v0.0.0-20190917162342-3b4f30a44f3b | ||
honnef.co/go/tools v0.0.1-2019.2.3 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Both of these components have tests for default config and for factory. This should be our minimum bar for accepting components into the build. We can think about having stricter requirements but I believe that's bare minimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #34 to make such requirements explicit.