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

Initial Setup #1

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
44 changes: 44 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
labels:
- dependencies
- actions
- Skip Changelog
schedule:
interval: weekly
day: sunday
- package-ecosystem: docker
directory: /build/docker
labels:
- dependencies
- docker
schedule:
interval: weekly
day: sunday
- package-ecosystem: gomod
directories:
- /cmd
- /exporter
labels:
- dependencies
- go
schedule:
interval: "daily"
allow:
# Allow both direct and indirect updates for all packages
- dependency-type: "all"
ignore:
- dependency-name: "github.com/open-telemetry/opentelemetry-collector-contrib*"
- dependency-name: "go.opentelemetry.io/collector*"
# Disable version updates
open-pull-requests-limit: 0
groups:
minor-and-patch:
applies-to: security-updates
patterns:
- "*"
update-types:
- "patch"
- "minor"
14 changes: 14 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
docker:
- changed-files:
- any-glob-to-any-file:
- build/*
- cmd/solarwinds-otel-collector/*
- exporter/*
documentation:
- changed-files:
- any-glob-to-any-file: "docs/*"
- any-glob-to-any-file: "*.md"
ci/cd:
- changed-files:
- any-glob-to-any-file:
- .github/*
40 changes: 40 additions & 0 deletions .github/workflows/buildAndDeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Deploy Images

on:
push:
paths-ignore:
- "docs/**"
- "*.md"
tags:
- '*.*.*'

pull_request:
branches:
- master
- release/**

workflow_dispatch:

jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check licenses
run: make ci-check-licenses

build_and_test:
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.generate-tag.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate docker image tag
id: generate-tag
run: echo "::set-output name=value::v${{ github.run_number }}-$(git rev-parse --short HEAD)"

- name: Build and Test
run: docker build . --file build/docker/Dockerfile --tag ${{ steps.generate-tag.outputs.value }}
11 changes: 11 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Pull Request Labeler
on:
- pull_request_target
jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin
artifacts
/tmp
.devcontainer

# Test binary, built with `go test -c`
*.test

# Tools binaries
.tools

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Go workspace file
go.work
go.work.sum

# env file
.env

# macOS files
**/.DS_STORE
**/.DS_Store

# IDEs folders
.idea/
.vscode/

# GoVersionInfo generated files
resource.syso
versioninfo.json
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

## v0.113.1
Initial version of SolarWinds OpenTelemetry Collector.
The collector provides all available components (receivers, processors, exporters, connectors, providers)
from [opentelemetry-collector](https://github.com/open-telemetry/opentelemetry-collector/tree/v0.113.0) (version `v0.113.0`) and [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector/tree/v0.113.0) (version `v0.113.0`).

### Additional details:
- `kineticaexporter` is excluded due to insufficient default configuration.
- `solarwindsexporter` has been added to easily integrate with **SolarWinds Observability SaaS**. Please read its [documentation](exporter/solarwindsexporter/README.md) to learn more.
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributing

Thank you for your interest in contributing to SolarWinds OpenTelemetry Collector!

Currently, this project is being developed by the SolarWinds team.
We are actively working on stabilizing its foundations and defining contribution guidelines.
Once ready, we will update the `CONTRIBUTING.md` file with clear instructions.
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
include Makefile.Common

ALL_SRC := $(shell find . \( -name "*.go" -o -name "*.sh" \) \
-type f | sort)

.PHONY: ci-check-licenses
ci-check-licenses: add-licenses check-licenses

.PHONY: add-licenses
add-licenses: $(ADDLICENSE)
@addLicensesOutput=`$(ADDLICENSE) -y "2024" -c "SolarWinds Worldwide, LLC. All rights reserved." -l "apache" -v $(ALL_SRC) 2>&1`; \
if [ "$$addLicensesOutput" ]; then \
echo "Files modified:"; \
echo "$$addLicensesOutput"; \
exit 1; \
else \
echo "No files modified."; \
fi

.PHONY: check-licenses
check-licenses:
@checkResult=$$(for f in $(ALL_SRC) ; do \
if ! diff -q <(head -n 13 $$f) $(EXPECTED_LICENSE_HEADER) > /dev/null; then \
echo "Diff for $$f:"; \
diff --label $$f -u <(head -n 13 $$f) $(EXPECTED_LICENSE_HEADER); \
fi; \
done); \
if [ -n "$${checkResult}" ]; then \
echo "License header check failed:"; \
echo "$${checkResult}"; \
exit 1; \
fi
25 changes: 25 additions & 0 deletions Makefile.Common
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SHELL = /bin/bash

GOCMD?= go

# SRC_ROOT is the top of the source tree
SRC_ROOT := $(shell git rev-parse --show-toplevel)

EXPECTED_LICENSE_HEADER := $(SRC_ROOT)/expected-file-header.txt

TOOLS_MOD_DIR := $(SRC_ROOT)/internal/tools
TOOLS_BIN_DIR := $(SRC_ROOT)/.tools
TOOLS_MOD_REGEX := "\s+_\s+\".*\""
TOOLS_PKG_NAMES := $(shell grep -E $(TOOLS_MOD_REGEX) < $(TOOLS_MOD_DIR)/tools.go | tr -d " _\"" | grep -vE '/v[0-9]+$$')
TOOLS_BIN_NAMES := $(addprefix $(TOOLS_BIN_DIR)/, $(notdir $(shell echo $(TOOLS_PKG_NAMES))))

ADDLICENSE := $(TOOLS_BIN_DIR)/addlicense

.PHONY: install-tools
install-tools: $(TOOLS_BIN_NAMES)

$(TOOLS_BIN_DIR):
mkdir -p $@

$(TOOLS_BIN_NAMES): $(TOOLS_BIN_DIR) $(TOOLS_MOD_DIR)/go.mod
cd $(TOOLS_MOD_DIR) && $(GOCMD) build -o $@ -trimpath $(filter %/$(notdir $@),$(TOOLS_PKG_NAMES))
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
# SolarWinds OpenTelemetry Collector
Distribution of OpenTelemetry Collector with all available components
bundled within from [opentelemetry-collector](https://github.com/open-telemetry/opentelemetry-collector/tree/main)
and [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib).

## Components
The SolarWinds OpenTelemetry collector contains following components:
- receivers
- full set of [opentelemetry-collector receivers](https://github.com/open-telemetry/opentelemetry-collector/tree/v0.113.0/receiver)
- full set of [opentelemetry-collector-contrib receivers](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/release/v0.113.x/receiver)
- processors
- full set of [opentelemetry-collector processors](https://github.com/open-telemetry/opentelemetry-collector/tree/v0.113.0/processor)
- full set of [opentelemetry-collector-contrib processors](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/release/v0.113.x/processor)
- exporters
- full set of [opentelemetry-collector exporters](https://github.com/open-telemetry/opentelemetry-collector/tree/v0.113.0/exporter)
- full set of [opentelemetry-collector-contrib exporters](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/release/v0.113.x/exporter) **except:**
- `kineticaexporter`
- [`solarwindsexporter`](./exporter/solarwindsexporter)
- extensions
- full set of [opentelemetry-collector extensions](https://github.com/open-telemetry/opentelemetry-collector/tree/v0.113.0/extension)
- full set of [opentelemetry-collector-contrib extensions](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/release/v0.113.x/extension)
- connectors
- full set of [opentelemetry-collector connectors](https://github.com/open-telemetry/opentelemetry-collector/tree/v0.113.0/connector)
- full set of [opentelemetry-collector-contrib connectors](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/release/v0.113.x/connector)

## Installation
### Binary
- build in `cmd/solarwinds-otel-collector` with `go build .`
- after successful build, `solarwinds-otel-collector` should be present in `cmd/solarwinds-otel-collector`
- run `solarwinds-otel-collector --config=example_config.yaml`

### Docker
See full [docker documentation](./build/docker/README.md).

### CI/CD
The _SolarWinds OpenTelemetry Collector_ utilizes [GitHub Actions pipeline](./.github).
The standard build pipeline is triggered with each PR opened to main or release branch and consists of:
- build of _SolarWinds OpenTelemetry Collector_ docker image

The release pipeline is triggered with designated tag publishing and consists of:
- build of _SolarWinds OpenTelemetry Collector_ docker image and its publishing to DockerHub
- creation of GitHub release

## Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md).
9 changes: 9 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Security
SolarWinds is committed to taking our customers security and privacy concerns seriously and makes it a priority.
We strive to implement and maintain security processes, procedures, standards, and take all reasonable care to
prevent unauthorized access to our customer data.

For more information see https://www.solarwinds.com/information-security.

## Want to report a security concern?
To report a vulnerability in one of our products or solutions or a vulnerability in one of our corporate websites, please contact our Product Security Incident Response Team (PSIRT) at psirt@solarwinds.com.
24 changes: 24 additions & 0 deletions build/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM docker.io/library/golang:1.22.7-bookworm AS base

COPY /LICENSE /LICENSE
COPY ./ /src

FROM base AS builder

RUN cd /src/cmd/solarwinds-otel-collector && CGO_ENABLED=0 GOEXPERIMENT=boringcrypto go build -trimpath -o /src/bin/solarwinds-otel-collector "-ldflags=-s -w"

FROM builder AS tests
WORKDIR src
# run tests for go modules of all maintained components
# image build is stopped if test failure is detected
RUN find . -name go.mod -not -path "./cmd/solarwinds-otel-collector/*" -execdir go test ./... \; | ( ! grep FAIL )

FROM gcr.io/distroless/static-debian12@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=tests /src/bin/solarwinds-otel-collector /solarwinds-otel-collector

ENTRYPOINT ["/solarwinds-otel-collector"]
CMD ["--config=/opt/default-config.yaml"]
26 changes: 26 additions & 0 deletions build/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SolarWinds OTel Collector Docker Image
Docker image for _SolarWinds OpenTelemetry Collector_:
- contains full build of the Collector with full set of components registered
- runs set of tests validating correct functionality of components used
- starts the Collector at entrypoint, expecting input config located by default as `/opt/default-config.yaml`

## How to Build
To build the image, simply run docker build command, i.e.

`docker build . -f build/docker/Dockerfile -t solarwinds-otel-collector:local`

## How to Run
To run the image utilize following command:

`docker run -v ./your_config_file.yaml:/opt/default-config.yaml solarwinds-otel-collector:local`

> [!WARNING]
> Note that the volume mounting **is required**. The image expects config at designated location at `/opt/default-config.yaml` by default to start properly.

## Layers
The image contains following layers:
- **base** - handles preparation of source code
- **builder** - builds the source code
- **tests** - runs the unit tests of the components defined in this repository used in the Collector

Final layer runs the binary built in **builder** layer, starting with `--config` parameter pointed at `/opt/default-config.yaml` location.
Loading
Loading