Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c41883e
add collection of .NET runtime metrics
def Jan 15, 2024
c7c2189
goimports: imports reformatting
def Jan 15, 2024
84b43ee
enhance application type detection
def Jan 15, 2024
7ac7ff1
Merge pull request #57 from coroot/improve_app_type_detection
def Jan 15, 2024
45e7e6a
Support l7 dubbo protocol.
wenhuwang Jan 16, 2024
cffd56a
Merge pull request #58 from wenhuwang/dubbo_protocol
def Jan 16, 2024
f41bbc7
profiling: upload profiles to `coroot-cluster-agent`
apetruhin Jan 18, 2024
4a80e36
Merge pull request #59 from coroot/profiles_to_cluster_agent
apetruhin Jan 18, 2024
b20a705
build: upgrade go and github actions
apetruhin Feb 6, 2024
f076e73
Merge pull request #62 from coroot/build_upgrade_go
apetruhin Feb 6, 2024
e1e91ce
Bump github.com/opencontainers/runc from 1.0.2 to 1.1.12
dependabot[bot] Feb 6, 2024
d7737b5
Merge pull request #63 from coroot/dependabot/go_modules/github.com/o…
apetruhin Feb 6, 2024
ca3af77
Bump github.com/docker/docker
dependabot[bot] Feb 6, 2024
0d77c7a
Merge pull request #64 from coroot/dependabot/go_modules/github.com/d…
apetruhin Feb 6, 2024
d8bb8a5
Bump github.com/containerd/containerd from 1.5.17 to 1.6.26
dependabot[bot] Feb 6, 2024
6f4aa0e
Merge pull request #65 from coroot/dependabot/go_modules/github.com/c…
apetruhin Feb 6, 2024
f9ea1bb
Bump github.com/cilium/cilium from 1.13.2 to 1.13.7
dependabot[bot] Feb 6, 2024
3e408fa
Merge pull request #66 from coroot/dependabot/go_modules/github.com/c…
apetruhin Feb 6, 2024
48e3d5f
continuous integration
apetruhin Feb 6, 2024
c5aa3fc
Merge pull request #67 from coroot/continuous_integration
apetruhin Feb 6, 2024
1099fdd
contributing guide
apetruhin Feb 6, 2024
54b2a3d
Merge pull request #68 from coroot/contributing_guide
apetruhin Feb 6, 2024
03e575d
logparser v1.1.0
apetruhin Feb 16, 2024
09a9659
logparser v1.1.1
def Feb 20, 2024
adb3b7d
ebpf tracer: invalidate connection timestamp on `accept()`
def Feb 20, 2024
ff1e357
Merge pull request #69 from coroot/invalidate_conn_timestamp
def Feb 20, 2024
f2b9d57
metrics push mode using the Prometheus Remote Write API
def Feb 27, 2024
3eff0c6
Merge pull request #70 from coroot/prometheus_push_mode
def Feb 27, 2024
341cef0
tracing: retrieve `ServiceName` from `ContainerId`
apetruhin Feb 28, 2024
ec3a19a
Merge pull request #71 from coroot/tracing_service_name_from_containe…
def Feb 28, 2024
f5b57ed
logparser v1.1.2
def Feb 29, 2024
6ecc3b0
feat: added http request path and method
mayankpande88 Jan 29, 2024
283f7d2
Bump github.com/opencontainers/runc from 1.0.2 to 1.1.12
dependabot[bot] Feb 5, 2024
cdc123e
Bump github.com/containerd/containerd from 1.5.17 to 1.6.26
dependabot[bot] Feb 10, 2024
c6815f0
Bump github.com/cilium/cilium from 1.13.7 to 1.14.7
dependabot[bot] Feb 20, 2024
446d16b
chore: coroot rebase
blue4209211 Mar 2, 2024
ab96d77
ci: using debian slim
blue4209211 Mar 2, 2024
80ce276
Merge branch 'main' into coroot_rebase
blue4209211 Mar 5, 2024
a87350e
fix: updated build
blue4209211 Mar 6, 2024
99db0ff
fix: added new file Docker ALpine
blue4209211 Mar 6, 2024
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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Continuous Integration

on:
pull_request:
push:
branches:
- main

jobs:
GO:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- run: sudo apt install -y libsystemd-dev
- name: gofmt -l .
run: files=$(gofmt -l .); if [[ -n "$files" ]]; then echo "$files"; exit 1; fi
- name: goimports -l .
run: |
go install golang.org/x/tools/cmd/goimports@latest
files=$(goimports -l .); if [[ -n "$files" ]]; then echo "$files"; exit 1; fi
- run: go vet ./...
- run: go test ./...
- run: go build -mod=readonly .
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Image
name: Release

on:
release:
Expand All @@ -16,35 +16,27 @@ jobs:
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v1
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
- uses: docker/metadata-action@v5
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}

- name: Build and push Docker image
uses: docker/build-push-action@v2
- uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Contributing

Thank you for your interest in contributing to Coroot!
Below are some basic guidelines.


## Requirements
* Linux ≥v4.16 (amd64, arm64)
* Go v1.21


## Running
```shell
sudo go run main.go
```

```shell
curl http://127.0.0.1:80/metrics
```

## Pull Request Checklist

* Branch from the main branch and, if needed, rebase to the current main branch before submitting your pull request. If it doesn't merge cleanly with main you may be asked to rebase your changes.
* Commits should be as small as possible, while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests).
* Add tests relevant to the fixed bug or new feature.
* Use `make lint` to run linters and ensure formatting is correct.
* Run the unit tests suite `make test`.


## eBPF

If you are changing eBPF code, you need to generate the `ebpftracer/ebpf.go` file:
```shell
cd ebpftracer
make build
```
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
FROM golang:1.19-bullseye AS builder
FROM golang:1.21-bullseye AS builder
RUN apt update && apt install -y libsystemd-dev
COPY go.mod /tmp/src/
COPY go.sum /tmp/src/
WORKDIR /tmp/src/
WORKDIR /tmp/src
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . /tmp/src/
RUN CGO_ENABLED=1 go test ./...
COPY . .
ARG VERSION=unknown
RUN CGO_ENABLED=1 go install -mod=readonly -ldflags "-X main.version=$VERSION" /tmp/src
RUN CGO_ENABLED=1 go build -mod=readonly -ldflags "-X main.version=$VERSION" -o coroot-node-agent .

FROM debian:bullseye
FROM debian:bullseye-slim
RUN apt update && apt install -y ca-certificates && apt clean
COPY --from=builder /go/bin/coroot-node-agent /usr/bin/coroot-node-agent
COPY --from=builder /tmp/src/coroot-node-agent /usr/bin/coroot-node-agent
ENTRYPOINT ["coroot-node-agent"]
32 changes: 32 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM --platform=linux/amd64 golang:1.22-alpine as build-stage

# Set destination for COPY
WORKDIR /app
RUN apk add --no-cache --update go gcc g++ bash git
RUN echo "unicode=\"YES\"" >> /etc/rc.conf && \
apk add --no-cache --virtual .build_deps \
autoconf file libc-dev make pkgconf python3 py3-pip ninja \
util-linux pciutils usbutils coreutils binutils findutils grep \
build-base abuild binutils binutils-doc gcc-doc gperf libcap libcap-dev \
valgrind-dev libmount && pip3 install meson --break-system-packages

RUN cd /tmp && git clone https://github.com/systemd/systemd

# RUN cd /tmp/systemd && \
# meson build && \
# ninja build

RUN apk add elogind-dev

# Download Go modules
COPY go.mod go.sum ./
RUN go mod download
COPY ./ ./
ARG VERSION=unknown
RUN CGO_ENABLED=1 go build -mod=readonly -ldflags "-X main.version=$VERSION" -o coroot-node-agent .

FROM --platform=linux/amd64 alpine:3.19 AS release-stage
WORKDIR /app
COPY --from=build-stage /app/coroot-node-agent /app/coroot-node-agent
RUN chmod +x /app/coroot-node-agent
CMD ["/app/coroot-node-agent"]
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.PHONY: all
all: lint test

.PHONY: test
test: go-test

.PHONY: lint
lint: go-mod go-vet go-fmt go-imports

.PHONY: go-mod
go-mod:
go mod tidy

.PHONY: go-vet
go-vet:
go vet ./...

.PHONY: go-fmt
go-fmt:
gofmt -w .

.PHONY: go-imports
go-imports:
go install golang.org/x/tools/cmd/goimports@latest
goimports -w .

.PHONY: go-test
go-test:
go test ./...
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ The best way to turn metrics to answers about app issues is to use [Coroot](http

A live demo of Coroot is available at [community-demo.coroot.com](https://community-demo.coroot.com)

## Contributing
To start contributing, check out our [Contributing Guide](https://github.com/coroot/coroot-node-agent/blob/main/CONTRIBUTING.md).

## License

Coroot-node-agent is licensed under the [Apache License, Version 2.0](https://github.com/coroot/coroot-node-agent/blob/main/LICENSE).
Expand Down
7 changes: 4 additions & 3 deletions cgroup/cgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package cgroup

import (
"fmt"
"github.com/coroot/coroot-node-agent/common"
"github.com/coroot/coroot-node-agent/flags"
"k8s.io/klog/v2"
"os"
"path"
"regexp"
"strings"
"time"

"github.com/coroot/coroot-node-agent/common"
"github.com/coroot/coroot-node-agent/flags"
"k8s.io/klog/v2"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion cgroup/cgroup_linux.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cgroup

import (
"runtime"

"github.com/vishvananda/netns"
"golang.org/x/sys/unix"
"runtime"
)

func Init() error {
Expand Down
3 changes: 2 additions & 1 deletion cgroup/cgroup_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cgroup

import (
"github.com/stretchr/testify/assert"
"path"
"testing"

"github.com/stretchr/testify/assert"
)

func TestNewFromProcessCgroupFile(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cgroup/cpu_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cgroup

import (
"github.com/stretchr/testify/assert"
"path"
"testing"

"github.com/stretchr/testify/assert"
)

func TestCgroup_CpuStat(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cgroup/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package cgroup

import (
"io/ioutil"
"k8s.io/klog/v2"
"path"
"strconv"
"strings"

"k8s.io/klog/v2"
)

type IOStat struct {
Expand Down
3 changes: 2 additions & 1 deletion cgroup/io_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cgroup

import (
"github.com/stretchr/testify/assert"
"path"
"testing"

"github.com/stretchr/testify/assert"
)

func TestCgroup_IOStat(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cgroup/memory_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cgroup

import (
"github.com/stretchr/testify/assert"
"path"
"testing"

"github.com/stretchr/testify/assert"
)

func TestCgroup_MemoryStat(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cgroup/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package cgroup

import (
"io/ioutil"
"k8s.io/klog/v2"
"strconv"
"strings"

"k8s.io/klog/v2"
)

func readVariablesFromFile(filePath string) (map[string]uint64, error) {
Expand Down
13 changes: 13 additions & 0 deletions common/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package common

import (
"github.com/coroot/coroot-node-agent/flags"
)

func AuthHeaders() map[string]string {
res := map[string]string{}
if apiKey := *flags.ApiKey; apiKey != "" {
res["X-Api-Key"] = apiKey
}
return res
}
5 changes: 3 additions & 2 deletions common/net.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package common

import (
"strconv"
"strings"

"github.com/coroot/coroot-node-agent/flags"
"inet.af/netaddr"
"k8s.io/klog/v2"
"strconv"
"strings"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion common/net_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package common

import (
"testing"

"github.com/stretchr/testify/assert"
"inet.af/netaddr"
"testing"
)

func TestConnectionFilter(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion common/otel_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package common

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestContainerIdToServiceName(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion common/volumes_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package common

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestParseKubernetesVolumeSource(t *testing.T) {
Expand Down
Loading