diff --git a/.github/workflows/ci-goreleaser-otlp.yaml b/.github/workflows/ci-goreleaser-otlp.yaml new file mode 100644 index 00000000..cab3a788 --- /dev/null +++ b/.github/workflows/ci-goreleaser-otlp.yaml @@ -0,0 +1,33 @@ +name: Continuous Integration - OTLP - GoReleaser + +on: + push: + branches: [main] + paths: + - "distributions/otelcol-otlp/**" + - "cmd/**" + - ".github/**" + - "scripts/**" + - "Makefile" + - "go.mod" + - "go.sum" + pull_request: + branches: [main] + paths: + - "distributions/otelcol-otlp/**" + - "cmd/**" + - ".github/**" + - "scripts/**" + - "Makefile" + - "go.mod" + - "go.sum" + +jobs: + check-goreleaser: + name: Continuous Integration - OTLP - GoReleaser + uses: ./.github/workflows/base-ci-goreleaser.yaml + with: + distribution: otelcol-otlp + goos: '[ "linux", "windows", "darwin" ]' + goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]' + secrets: inherit diff --git a/.github/workflows/release-otlp.yaml b/.github/workflows/release-otlp.yaml new file mode 100644 index 00000000..aa96c368 --- /dev/null +++ b/.github/workflows/release-otlp.yaml @@ -0,0 +1,16 @@ +name: Release OTLP + +on: + push: + tags: ["v*"] + +jobs: + release: + name: Release OTLP + uses: ./.github/workflows/base-release.yaml + with: + distribution: otelcol-otlp + goos: '[ "linux", "windows", "darwin" ]' + goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]' + secrets: inherit + permissions: write-all diff --git a/Makefile b/Makefile index f057cbf6..fbabc0d4 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ OTELCOL_BUILDER_VERSION ?= 0.110.0 OTELCOL_BUILDER_DIR ?= ${HOME}/bin OTELCOL_BUILDER ?= ${OTELCOL_BUILDER_DIR}/ocb -DISTRIBUTIONS ?= "otelcol,otelcol-contrib,otelcol-k8s" +DISTRIBUTIONS ?= "otelcol,otelcol-contrib,otelcol-k8s,otelcol-otlp" GEN_CONFIG_DISTRIBUTIONS ?= "otelcol,otelcol-contrib" ci: check build diff --git a/README.md b/README.md index bd60f11d..a56f90f5 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,4 @@ Current list of distributions: - [OpenTelemetry Collector (also known as "otelcol")](./distributions/otelcol) - [OpenTelemetry Collector Contrib (also known as "otelcol-contrib")](./distributions/otelcol-contrib) - [OpenTelemetry Collector for Kubernetes (also known as "otelcol-k8s")](./distributions/otelcol-k8s) +- [OpenTelemetry Collector OTLP (also known as "otelcol-otlp")](./distributions/otelcol-otlp) diff --git a/distributions/otelcol-otlp/.goreleaser.yaml b/distributions/otelcol-otlp/.goreleaser.yaml new file mode 100644 index 00000000..a1e9681c --- /dev/null +++ b/distributions/otelcol-otlp/.goreleaser.yaml @@ -0,0 +1,248 @@ +partial: + by: target +version: 2 +project_name: opentelemetry-collector-releases +env: + - COSIGN_YES=true +msi: + - id: otelcol-otlp + name: otelcol-otlp_{{ .Version }}_{{ .Os }}_{{ .MsiArch }} + wxs: windows-installer.wxs + extra_files: + - opentelemetry.ico +builds: + - id: otelcol-otlp + goos: + - darwin + - linux + - windows + goarch: + - "386" + - amd64 + - arm + - arm64 + - ppc64le + - s390x + goarm: + - "7" + ignore: + - goos: darwin + goarch: "386" + - goos: darwin + goarch: arm + - goos: darwin + goarch: s390x + - goos: windows + goarch: arm + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + dir: _build + binary: otelcol-otlp + ldflags: + - -s + - -w + flags: + - -trimpath + env: + - CGO_ENABLED=0 +archives: + - id: otelcol-otlp + builds: + - otelcol-otlp + name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' +nfpms: + - package_name: otelcol-otlp + contents: + - src: otelcol-otlp.service + dst: /lib/systemd/system/otelcol-otlp.service + - src: otelcol-otlp.conf + dst: /etc/otelcol-otlp/otelcol-otlp.conf + type: config|noreplace + scripts: + preinstall: preinstall.sh + postinstall: postinstall.sh + preremove: preremove.sh + overrides: + rpm: + dependencies: + - /bin/sh + id: otelcol-otlp + builds: + - otelcol-otlp + formats: + - deb + - rpm + maintainer: The OpenTelemetry Collector maintainers + description: OpenTelemetry Collector - otelcol-otlp + license: Apache 2.0 +checksum: + name_template: '{{ .ProjectName }}_otelcol-otlp_checksums.txt' +dockers: + - goos: linux + goarch: "386" + dockerfile: Dockerfile + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-386 + - otel/opentelemetry-collector-otlp:latest-386 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-386 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-386 + build_flag_templates: + - --pull + - --platform=linux/386 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx + - goos: linux + goarch: amd64 + dockerfile: Dockerfile + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-amd64 + - otel/opentelemetry-collector-otlp:latest-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-amd64 + build_flag_templates: + - --pull + - --platform=linux/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx + - goos: linux + goarch: arm + goarm: "7" + dockerfile: Dockerfile + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-armv7 + - otel/opentelemetry-collector-otlp:latest-armv7 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-armv7 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-armv7 + build_flag_templates: + - --pull + - --platform=linux/arm/v7 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx + - goos: linux + goarch: arm64 + dockerfile: Dockerfile + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-arm64 + - otel/opentelemetry-collector-otlp:latest-arm64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-arm64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-arm64 + build_flag_templates: + - --pull + - --platform=linux/arm64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx + - goos: linux + goarch: ppc64le + dockerfile: Dockerfile + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-ppc64le + - otel/opentelemetry-collector-otlp:latest-ppc64le + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-ppc64le + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-ppc64le + build_flag_templates: + - --pull + - --platform=linux/ppc64le + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx + - goos: linux + goarch: s390x + dockerfile: Dockerfile + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-s390x + - otel/opentelemetry-collector-otlp:latest-s390x + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-s390x + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-s390x + build_flag_templates: + - --pull + - --platform=linux/s390x + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx +docker_manifests: + - name_template: otel/opentelemetry-collector-otlp:{{ .Version }} + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-386 + - otel/opentelemetry-collector-otlp:{{ .Version }}-amd64 + - otel/opentelemetry-collector-otlp:{{ .Version }}-armv7 + - otel/opentelemetry-collector-otlp:{{ .Version }}-arm64 + - otel/opentelemetry-collector-otlp:{{ .Version }}-ppc64le + - otel/opentelemetry-collector-otlp:{{ .Version }}-s390x + - name_template: otel/opentelemetry-collector-otlp:latest + image_templates: + - otel/opentelemetry-collector-otlp:latest-386 + - otel/opentelemetry-collector-otlp:latest-amd64 + - otel/opentelemetry-collector-otlp:latest-armv7 + - otel/opentelemetry-collector-otlp:latest-arm64 + - otel/opentelemetry-collector-otlp:latest-ppc64le + - otel/opentelemetry-collector-otlp:latest-s390x + - name_template: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }} + image_templates: + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-386 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-armv7 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-arm64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-ppc64le + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-s390x + - name_template: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest + image_templates: + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-386 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-armv7 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-arm64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-ppc64le + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-s390x +signs: + - cmd: cosign + args: + - sign-blob + - --output-signature + - ${artifact}.sig + - --output-certificate + - ${artifact}.pem + - ${artifact} + signature: ${artifact}.sig + artifacts: all + certificate: ${artifact}.pem +docker_signs: + - args: + - sign + - ${artifact} + artifacts: all +sboms: + - id: archive + artifacts: archive + - id: package + artifacts: package +monorepo: + tag_prefix: v diff --git a/distributions/otelcol-otlp/Dockerfile b/distributions/otelcol-otlp/Dockerfile new file mode 100644 index 00000000..2e7521c4 --- /dev/null +++ b/distributions/otelcol-otlp/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:3.19 as certs +RUN apk --update add ca-certificates + +FROM scratch + +ARG USER_UID=10001 +USER ${USER_UID} + +COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --chmod=755 otelcol-otlp /otelcol-otlp +ENTRYPOINT ["/otelcol-otlp"] +EXPOSE 4317 4318 diff --git a/distributions/otelcol-otlp/README.md b/distributions/otelcol-otlp/README.md new file mode 100644 index 00000000..03ce769c --- /dev/null +++ b/distributions/otelcol-otlp/README.md @@ -0,0 +1,23 @@ +# OpenTelemetry Collector OTLP Distro + +This distribution only contains the receiver and exporters for the OpenTelemetry Protocol (OTLP), including both gRPC and HTTP transport. + +## Configuration + +Unlike the Core and Contrib distributions, this distribution does not provide a default configuration file, and one will need to be created. The location of the config file is specified with the `--config` command line option. + +- For the .deb/.rpm systemd service packages, the command line options are set in `/etc/otelcol-otlp/otelcol-otlp.conf`, and the default config path is `/etc/otelcol-otlp/config.yaml`. + +- For the Windows installer, the command line options are set during the install process, and the default config path is `%ProgramW6432%\OpenTelemetry Collector\config.yaml`. + +- For the Docker images, the command line options are blank by default, and must be specified with a `CMD` directive. + + Example: `CMD ["--config", "/etc/otelcol-otlp/config.yaml"]` + +## Components + +The full list of components is available in the [manifest](manifest.yaml) + +### Rules for Component Inclusion + +- Only `otlpreceiver`, `otlpexporter`, and `otlphttpexporter` are allowed. diff --git a/distributions/otelcol-otlp/manifest.yaml b/distributions/otelcol-otlp/manifest.yaml new file mode 100644 index 00000000..a62e557f --- /dev/null +++ b/distributions/otelcol-otlp/manifest.yaml @@ -0,0 +1,18 @@ +dist: + module: github.com/open-telemetry/opentelemetry-collector-releases/otlp + name: otelcol-otlp + description: OpenTelemetry Collector OTLP + version: 0.110.0 + output_path: ./_build + otelcol_version: 0.110.0 + +exporters: + - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.110.0 + +receivers: + - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.110.0 + +providers: + - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.16.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.16.0 diff --git a/distributions/otelcol-otlp/opentelemetry.ico b/distributions/otelcol-otlp/opentelemetry.ico new file mode 100644 index 00000000..9bdd4cf5 Binary files /dev/null and b/distributions/otelcol-otlp/opentelemetry.ico differ diff --git a/distributions/otelcol-otlp/otelcol-otlp.conf b/distributions/otelcol-otlp/otelcol-otlp.conf new file mode 100644 index 00000000..261bcdce --- /dev/null +++ b/distributions/otelcol-otlp/otelcol-otlp.conf @@ -0,0 +1,6 @@ +# Systemd environment file for the otelcol-otlp service + +# Command-line options for the otelcol-otlp service. +# Run `/usr/bin/otelcol-otlp --help` to see all available options. +# Note: No default config file is provided at the path below, one must be created. +OTELCOL_OPTIONS="--config=/etc/otelcol-otlp/config.yaml" diff --git a/distributions/otelcol-otlp/otelcol-otlp.service b/distributions/otelcol-otlp/otelcol-otlp.service new file mode 100644 index 00000000..bb7ea348 --- /dev/null +++ b/distributions/otelcol-otlp/otelcol-otlp.service @@ -0,0 +1,15 @@ +[Unit] +Description=OpenTelemetry Collector OTLP +After=network.target + +[Service] +EnvironmentFile=/etc/otelcol-otlp/otelcol-otlp.conf +ExecStart=/usr/bin/otelcol-otlp $OTELCOL_OPTIONS +KillMode=mixed +Restart=on-failure +Type=simple +User=otelcol-otlp +Group=otelcol-otlp + +[Install] +WantedBy=multi-user.target diff --git a/distributions/otelcol-otlp/postinstall.sh b/distributions/otelcol-otlp/postinstall.sh new file mode 100755 index 00000000..27402a41 --- /dev/null +++ b/distributions/otelcol-otlp/postinstall.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# Copyright The 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. + +if command -v systemctl >/dev/null 2>&1; then + systemctl enable otelcol-otlp.service + if [ -f /etc/otelcol-otlp/config.yaml ]; then + systemctl start otelcol-otlp.service + else + echo "Make sure to configure otelcol-otlp by creating /etc/otelcol-otlp/config.yaml" + fi +fi diff --git a/distributions/otelcol-otlp/preinstall.sh b/distributions/otelcol-otlp/preinstall.sh new file mode 100755 index 00000000..6920c380 --- /dev/null +++ b/distributions/otelcol-otlp/preinstall.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Copyright The 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. + +getent passwd otelcol-otlp >/dev/null || useradd --system --user-group --no-create-home --shell /sbin/nologin otelcol-otlp diff --git a/distributions/otelcol-otlp/preremove.sh b/distributions/otelcol-otlp/preremove.sh new file mode 100755 index 00000000..1323e27f --- /dev/null +++ b/distributions/otelcol-otlp/preremove.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Copyright The 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. + +if command -v systemctl >/dev/null 2>&1; then + systemctl stop otelcol-otlp.service + systemctl disable otelcol-otlp.service +fi diff --git a/distributions/otelcol-otlp/windows-installer.wxs b/distributions/otelcol-otlp/windows-installer.wxs new file mode 100644 index 00000000..81be711e --- /dev/null +++ b/distributions/otelcol-otlp/windows-installer.wxs @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + NOT COLLECTOR_SVC_ARGS + + + + + + + + + + + + + + + + + + + + +