forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved from github.com/observatorium/opentelemetry-collector-builder (o…
…pen-telemetry#3) Signed-off-by: Juraci Paixão Kröhling <[email protected]>
- Loading branch information
1 parent
3c1dd9e
commit fb510a9
Showing
27 changed files
with
1,609 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pull_request_rules: | ||
- name: remove outdated reviews | ||
conditions: | ||
- base=master | ||
actions: | ||
dismiss_reviews: {} | ||
|
||
- name: Automatic merge when all checks pass and the PR is approved | ||
conditions: | ||
- "#approved-reviews-by>=1" | ||
- "-draft" | ||
- "status-success=Unit tests" | ||
- "status-success=Code standards (linting)" | ||
- "status-success=Security" | ||
- "status-success=Integration test" | ||
actions: | ||
merge: | ||
method: squash | ||
commit_message: title+body |
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,56 @@ | ||
name: "Continuous Integration" | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
unit-tests: | ||
name: Unit tests | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14 | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
|
||
lint: | ||
name: Code standards (linting) | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.29 | ||
args: --enable=gosec,maligned,misspell | ||
only-new-issues: true | ||
|
||
security: | ||
name: Security | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: go | ||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
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,24 @@ | ||
name: Integration tests | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
integration-test: | ||
name: Integration test | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14 | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Test | ||
run: ./test/test.sh |
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,29 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14 | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,37 @@ | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/go,vscode | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=go,vscode | ||
|
||
### Go ### | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
### Go Patch ### | ||
/vendor/ | ||
/Godeps/ | ||
|
||
### vscode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
*.code-workspace | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/go,vscode | ||
|
||
/dist/ | ||
opentelemetry-collector-builder |
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,18 @@ | ||
# all available settings of specific linters | ||
linters-settings: | ||
goheader: | ||
template-path: header.txt | ||
goimports: | ||
local-prefixes: github.com/open-telemetry/opentelemetry-collector-builder | ||
maligned: | ||
suggest-new: true | ||
misspell: | ||
locale: US | ||
|
||
linters: | ||
enable: | ||
- goheader | ||
- goimports | ||
- maligned | ||
- misspell | ||
- gosec |
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,33 @@ | ||
before: | ||
hooks: | ||
- go mod download | ||
builds: | ||
- flags: | ||
- -trimpath | ||
ldflags: | ||
- -s -w -X github.com/open-telemetry/opentelemetry-collector-builder/cmd.version={{.Version}} -X github.com/open-telemetry/opentelemetry-collector-builder/cmd.date={{.Date}} | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
goarm: | ||
- 6 | ||
- 7 | ||
archives: | ||
- format: binary | ||
checksum: | ||
name_template: "checksums.txt" | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
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 |
---|---|---|
@@ -1,2 +1,87 @@ | ||
# opentelemetry-collector-builder | ||
OpenTelemetry Collector Builder | ||
# OpenTelemetry Collector builder | ||
|
||
This program generates a custom OpenTelemetry Collector binary based on a given configuration. | ||
|
||
## TL;DR | ||
```console | ||
$ go get github.com/open-telemetry/opentelemetry-collector-builder | ||
$ cat > ~/.otelcol-builder.yaml <<EOF | ||
exporters: | ||
- gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter v0.19.0" | ||
EOF | ||
$ opentelemetry-collector-builder --output-path=/tmp/dist | ||
$ cat > /tmp/otelcol.yaml <<EOF | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
endpoint: localhost:4317 | ||
|
||
processors: | ||
batch: | ||
|
||
exporters: | ||
logging: | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: | ||
- otlp | ||
processors: | ||
- batch | ||
exporters: | ||
- logging | ||
EOF | ||
$ /tmp/dist/otelcol-custom --config=/tmp/otelcol.yaml | ||
``` | ||
|
||
## Installation | ||
|
||
Download the binary for your respective platform under the ["Releases"](https://github.com/open-telemetry/opentelemetry-collector-builder/releases/latest) page. | ||
|
||
## Running | ||
|
||
A configuration file isn't strictly required, but the final artifact won't be different than a regular OpenTelemetry Collector. You probably want to specify at least one module (extension, exporter, receiver, processor) to add to your distribution. You can specify them via a configuration file. When no `--config` flag is provided with the location for the configuration file, `${HOME}/.otelcol-builder.yaml` will be used, if available. | ||
|
||
```console | ||
$ opentelemetry-collector-builder --config config.yaml | ||
``` | ||
|
||
Use `opentelemetry-collector-builder --help` to learn about which flags are available. | ||
|
||
## Configuration | ||
|
||
The configuration file is composed of two main parts: `dist` and module types. All `dist` options can be specified via command line flags: | ||
|
||
```console | ||
$ opentelemetry-collector-builder --name="my-otelcol" | ||
``` | ||
|
||
The module types are specified at the top-level, and might be: `extensions`, `exporters`, `receivers` and `processors`. They all accept a list of components, and each component is required to have at least the `gomod` entry. When not specified, the `import` value is inferred from the `gomod`. When not specified, the `name` is inferred from the `import`. | ||
|
||
The `import` might specify a more specific path than what is specified in the `gomod`. For instance, your Go module might be `gitlab.com/myorg/myrepo` and the `import` might be `gitlab.com/myorg/myrepo/myexporter`. | ||
|
||
The `name` will typically be omitted, except when multiple components have the same name. In such case, set a unique name for each module. | ||
|
||
Optionally, a list of `go mod` replace entries can be provided, in case custom overrides are needed. This is typically necessary when a processor or some of its transitive dependencies have dependency problems. | ||
|
||
```yaml | ||
dist: | ||
module: github.com/open-telemetry/opentelemetry-collector-builder # the module name for the new distribution, following Go mod conventions. Optional, but recommended. | ||
name: otelcol-custom # the binary name. Optional. | ||
description: "Custom OpenTelemetry Collector distribution" # a long name for the application. Optional. | ||
include_core: true # whether the core components should be included in the distribution. Optional. | ||
otelcol_version: "0.19.0" # the OpenTelemetry Collector version to use as base for the distribution. Optional. | ||
output_path: /tmp/otelcol-distributionNNN # the path to write the output (sources and binary). Optional. | ||
version: "1.0.0" # the version for your custom OpenTelemetry Collector. Optional. | ||
go: "/usr/bin/go" # which Go binary to use to compile the generated sources. Optional. | ||
exporters: | ||
- gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter v0.19.0" # the Go module for the component. Required. | ||
import: "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter" # the import path for the component. Optional. | ||
name: "alibabacloudlogserviceexporter" # package name to use in the generated sources. Optional. | ||
path: "./alibabacloudlogserviceexporter" # in case a local version should be used for the module, the path relative to the current dir, or a full path can be specified. Optional. | ||
replaces: | ||
# a list of "replaces" directives that will be part of the resulting go.mod | ||
- github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.19.0 | ||
``` |
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,12 @@ | ||
# Releasing the OpenTelemetry Collector Builder | ||
|
||
This project uses [`goreleaser`](https://github.com/goreleaser/goreleaser) to manage the release of new versions. | ||
|
||
To release a new version, simply add a tag named `vX.Y.Z`, like: | ||
|
||
``` | ||
git tag -a v0.1.1 -m "Release v0.1.1" | ||
git push upstream v0.1.1 | ||
``` | ||
|
||
A new GitHub workflow should be started, and at the end, a GitHub release should have been created, similar with the ["Release v0.1.0"](https://github.com/open-telemetry/opentelemetry-collector-builder/releases/tag/v0.1.0). |
Oops, something went wrong.