Skip to content

Commit

Permalink
Merge pull request #229 from go-faster/feat/metrics-chstorage
Browse files Browse the repository at this point in the history
feat(chstorage): implement metrics storage
  • Loading branch information
ernado authored Dec 1, 2023
2 parents eca0933 + 9948616 commit 19497e3
Show file tree
Hide file tree
Showing 111 changed files with 50,314 additions and 1,959 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true

- name: Install Go
uses: actions/setup-go@v4
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ jobs:
uses: go-faster/x/.github/workflows/test.yml@main
with:
enable-386: false
submodules: true
cover:
uses: go-faster/x/.github/workflows/cover.yml@main
with:
submodules: true
lint:
uses: go-faster/x/.github/workflows/lint.yml@main
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ secret.yaml
/oteldb
/otelproxy
/otelfaker
/chotel

# goreleaser
dist
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "internal/otelschema/_testdata/semantic-conventions"]
path = internal/otelschema/_testdata/semantic-conventions
url = https://github.com/open-telemetry/semantic-conventions.git
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ issues:
text: "dupSubExpr"

# False positive.
- path: internal/metricsharding/prometheus\.go
linters: [govet]
- linters: [govet]
source: func.+Seek\(.+int64\).+chunkenc\.ValueType
text: "method Seek"

# Not gonna use const, does not make any sense.
Expand Down
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,25 @@ The OpenTelemetry-compatible telemetry aggregation, storage and processing.

Work in progress.

> [!WARNING]
> Work in progress.
## Storage

The oteldb is stateless and uses external storage systems for data persistence, processing and aggregation.

### YTsaurus

The [YTsaurus](https://ytsaurus.tech/) is a primary storage for telemetry data.
An open source big data platform for distributed storage and processing.

- Hierarchical multi-tenancy with secure resource isolation
- OLAP and OLTP
- MapReduce, ACID
- ClickHouse protocol compatible
- Exabyte scale, up to 1M CPU, 10K+ nodes

### ClickHouse
We focus on the following storage systems:
- [ClickHouse](https://clickhouse.com/)
- [YTsaurus](https://ytsaurus.tech/)

The oteldb also supports [ClickHouse](https://clickhouse.com/) storage.
Currently, ClickHouse looks more promising.

## Query

Supported query languages:
- LogQL (loki) for logs
- TraceQL (Tempo) for traces
- PromQL (Prometheus) for metrics

## Local development

Expand All @@ -46,5 +41,5 @@ docker compose -f dev/local/ytsaurus/docker-compose.yml up -d
#### Clickhouse storage

```shell
docker compose -f dev/local/clickhouse/docker-compose.yml up -d
docker compose -f dev/local/ch/docker-compose.yml up -d
```
57 changes: 44 additions & 13 deletions _oas/loki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ paths:
operationId: query
description: Query
parameters:
- $ref: "#/components/parameters/GrafanaUser"
- name: query
description: The LogQL query to perform.
in: query
Expand Down Expand Up @@ -59,7 +58,6 @@ paths:
operationId: queryRange
description: Query range
parameters:
- $ref: "#/components/parameters/GrafanaUser"
- name: start
in: query
schema:
Expand Down Expand Up @@ -126,7 +124,6 @@ paths:
Get labels.
Used by Grafana to test connection to Loki.
parameters:
- $ref: "#/components/parameters/GrafanaUser"
- name: start
description: |
The start time for the query as a nanosecond Unix epoch.
Expand Down Expand Up @@ -163,7 +160,6 @@ paths:
operationId: labelValues
description: Get values of label
parameters:
- $ref: "#/components/parameters/GrafanaUser"
- name: start
description: |
The start time for the query as a nanosecond Unix epoch.
Expand Down Expand Up @@ -262,16 +258,35 @@ paths:
description: Successful push
default:
$ref: "#/components/responses/Error"
/loki/api/v1/index/stats:
get:
operationId: indexStats
description: Get index stats
parameters:
- name: start
in: query
schema:
$ref: "#/components/schemas/LokiTime"
- name: end
in: query
schema:
$ref: "#/components/schemas/LokiTime"
- name: query
description: The LogQL matchers to check.
in: query
required: true
schema:
type: string
responses:
"200":
description: Index stats
content:
application/json:
schema:
$ref: "#/components/schemas/IndexStats"
default:
$ref: "#/components/responses/Error"
components:
parameters:
# TODO(ernado): extract to separate file? Same for all datasources
GrafanaUser:
name: X-Grafana-User
in: header
required: false
description: "Grafana username that is passed to datasource when making requests from Grafana. Used for authentication and authorization."
schema:
type: string
responses:
Error:
description: Error while processing request
Expand Down Expand Up @@ -402,6 +417,22 @@ components:
- type: string
description: value
x-ogen-name: V
IndexStats:
type: object
required:
- streams
- chunks
- entries
- bytes
properties:
streams:
type: integer
chunks:
type: integer
entries:
type: integer
bytes:
type: integer
Stats:
type: object
Direction:
Expand Down
17 changes: 17 additions & 0 deletions chotel.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:latest as builder

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/chotel ./cmd/chotel

FROM alpine:latest
RUN apk --no-cache add ca-certificates

WORKDIR /app
COPY --from=builder /app/chotel /chotel

ENTRYPOINT ["/chotel"]
Loading

0 comments on commit 19497e3

Please sign in to comment.