-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
87 changed files
with
12,345 additions
and
0 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,24 @@ | ||
name: test-pipeline | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
- main | ||
- release/v* | ||
|
||
jobs: | ||
lint-and-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Install tools | ||
run: make install-ci | ||
|
||
- name: Run unit tests and lint | ||
run: make test-and-lint |
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 |
---|---|---|
|
@@ -13,3 +13,7 @@ | |
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
.vscode | ||
.DS_Store | ||
.idea |
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,35 @@ | ||
run: | ||
timeout: 10m | ||
linters-settings: | ||
depguard: | ||
list-type: blacklist | ||
include-go-root: true | ||
gofmt: | ||
simplify: true | ||
gosimple: | ||
go: '1.17' | ||
linters: | ||
enable: | ||
- gofmt | ||
- goimports | ||
disable: | ||
- staticcheck | ||
- typecheck | ||
- gosec | ||
- govet | ||
- errcheck | ||
- gocritic | ||
- revive | ||
- deadcode | ||
- gosimple | ||
- ineffassign | ||
- depguard | ||
- errorlint | ||
- structcheck | ||
- varcheck | ||
- unused | ||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- 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,60 @@ | ||
COMMIT_SHA ?= $(shell git rev-parse HEAD) | ||
REPONAME ?= signoz | ||
IMAGE_NAME ?= "otel-collector" | ||
CONFIG_FILE ?= ./config/default-config.yaml | ||
DOCKER_TAG ?= latest | ||
|
||
GOOS ?= $(shell go env GOOS) | ||
GOARCH ?= $(shell go env GOARCH) | ||
GOPATH ?= $(shell go env GOPATH) | ||
GOTEST=go test -v $(RACE) | ||
GOFMT=gofmt | ||
FMT_LOG=.fmt.log | ||
IMPORT_LOG=.import.log | ||
|
||
|
||
.PHONY: install-tools | ||
install-tools: | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
.DEFAULT_GOAL := test-and-lint | ||
|
||
.PHONY: test-and-lint | ||
test-and-lint: test fmt lint | ||
|
||
.PHONY: test | ||
test: | ||
go test -count=1 -v -race -cover ./... | ||
|
||
.PHONY: build | ||
build: | ||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o signoz-collector ./cmd/signozcollector | ||
|
||
.PHONY: run | ||
run: | ||
go run cmd/signozcollector/* --config ${CONFIG_FILE} | ||
|
||
.PHONY: fmt | ||
fmt: | ||
@echo Running go fmt on query service ... | ||
@$(GOFMT) -e -s -l -w . | ||
|
||
.PHONY: build-signoz-collector | ||
build-signoz-collector: | ||
@echo "------------------" | ||
@echo "--> Building signoz collector docker image" | ||
@echo "------------------" | ||
docker buildx build --progress plane \ | ||
--no-cache -f cmd/signozcollector/Dockerfile \ | ||
--tag $(REPONAME)/$(IMAGE_NAME):$(DOCKER_TAG) . | ||
|
||
.PHONY: lint | ||
lint: | ||
@echo "Running linters..." | ||
@$(GOPATH)/bin/golangci-lint -v --config .golangci.yml run && echo "Done." | ||
|
||
.PHONY: install-ci | ||
install-ci: install-tools | ||
|
||
.PHONY: test-ci | ||
test-ci: lint |
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,30 @@ | ||
# Builder stage | ||
FROM --platform=$BUILDPLATFORM golang:1.17-alpine as build | ||
RUN apk --update add ca-certificates | ||
|
||
WORKDIR /src | ||
COPY . . | ||
|
||
ARG TARGETOS TARGETARCH | ||
|
||
ENV OS111MODULE=on | ||
ENV CGO_ENABLED=0 | ||
ENV GOOS=$TARGETOS | ||
ENV GOARCH=$TARGETARCH | ||
|
||
RUN cd cmd/signozcollector && go build -o /out/signoz-collector | ||
|
||
# Final stage | ||
FROM scratch | ||
|
||
ARG USER_UID=10001 | ||
|
||
USER ${USER_UID} | ||
|
||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=build /out/signoz-collector / | ||
COPY --from=build /src/exporter/clickhousetracesexporter/migrations /migrations | ||
|
||
EXPOSE 4317 4318 | ||
ENTRYPOINT ["/signoz-collector"] | ||
CMD ["--config", "/etc/otel/config.yaml"] |
Oops, something went wrong.