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

feat(chstorage): implement metrics storage #229

Merged
merged 112 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
7ba1898
feat(chstorage): implement metrics storage
tdakkota Nov 16, 2023
2f0383f
feat(dev): privision prometheus and node-exporter
ernado Nov 19, 2023
e212949
feat(dev): setup otelcol
ernado Nov 20, 2023
9d7e26e
fix(dev): fix clickhouse-data dashboard query
ernado Nov 20, 2023
00ac0e0
refactor(chstorage): use JSON to store attributes
tdakkota Nov 20, 2023
b4f7d55
chore(chstorage): trace Prometheus querier
tdakkota Nov 20, 2023
2a5ba39
feat(dev): add jaeger
ernado Nov 20, 2023
0ccc11a
feat(dev): add otelcol dashboard
ernado Nov 20, 2023
f13df45
feat(dev): add clickhouse trace exporter
ernado Nov 20, 2023
b9949c6
feat(chstorage): implement basic inserter
tdakkota Nov 20, 2023
94f7516
feat(oteldb): properly setup Clickhouse storage
tdakkota Nov 20, 2023
229559d
fix(chstorage.querier): use tracer provider
ernado Nov 20, 2023
f2317ea
feat(chstorage): insert labels too
tdakkota Nov 20, 2023
f24cd3e
chore: fix lint issues
ernado Nov 20, 2023
cc13371
feat(chstorage): label querier
tdakkota Nov 21, 2023
c446b01
fix(tempoe2e): set Clickhouse table names
tdakkota Nov 21, 2023
fe3ed21
fix(chstorage): validate table name before creation
tdakkota Nov 21, 2023
c78289e
fix(chstorage): use right column name
tdakkota Nov 21, 2023
a487d36
ci(lint): fix issues
tdakkota Nov 21, 2023
03def16
fix(chstorage): handle empty value type
tdakkota Nov 21, 2023
1248c19
fix(chstorage): use right column type
tdakkota Nov 21, 2023
b993558
test(prome2e): add basic Prometheus API test
tdakkota Nov 21, 2023
b7db676
chore(prome2e): add metrics testdata
tdakkota Nov 21, 2023
36c4463
fix(metricsharding): handle empty value type
tdakkota Nov 21, 2023
a71d93f
fix(chstorage): series query building
tdakkota Nov 22, 2023
e8a35eb
fix(chstorage): add name as label to series result
tdakkota Nov 22, 2023
aa45357
chore(chstorage): make field name match column name
tdakkota Nov 22, 2023
9e1b2e7
test(prome2e): add series query test
tdakkota Nov 22, 2023
92739a7
fix(chstorage): use constructor for series set
tdakkota Nov 22, 2023
640a634
test(prome2e): add more series endpoint tests
tdakkota Nov 22, 2023
779d168
fix(otedlb): set timeout for engine
tdakkota Nov 22, 2023
5864f40
fix(otedlb): set samples limit for engine
tdakkota Nov 22, 2023
f3ad6e1
test(prome2e): set engine limits properly
tdakkota Nov 22, 2023
9a95bfa
fix(chstorage): handle seek to the first point properly
tdakkota Nov 22, 2023
c5ed887
test(prome2e): make a simple PromQL query
tdakkota Nov 23, 2023
a44da37
feat(dev.local.ch): more compatibility testing
ernado Nov 24, 2023
69a6279
feat(chstorage): insert all received metrics data
tdakkota Nov 24, 2023
e992694
chore(integration): update tests due to `chstorage` changes
tdakkota Nov 24, 2023
323ed1c
fix(prome2e): collect labels from all metrics
tdakkota Nov 24, 2023
0978883
feat(chstorage): draft log inserter
ernado Nov 24, 2023
b9c1517
fix: setup all table names
ernado Nov 24, 2023
7b8981c
chore(lint): wrap err
ernado Nov 24, 2023
9630391
fix: use DefaultTables
ernado Nov 24, 2023
5103260
feat(dev): add otelfaker
ernado Nov 24, 2023
f15f2ed
fix(chstorage): fix log schema
ernado Nov 24, 2023
02a15fe
chore(dev): rename faker service
ernado Nov 24, 2023
403d19c
feat: improve clickhouse client logging
ernado Nov 25, 2023
4ce2ff1
feat(otelschema): add semconv schema parser
ernado Nov 25, 2023
1c0b2f1
feat(otelschema): add golden test
ernado Nov 25, 2023
205f583
fix(otelschema): make examples array
ernado Nov 26, 2023
16a430d
fix(otelschema): make examples raw back
ernado Nov 26, 2023
2b12269
feat(otelschema): improve examples schema
ernado Nov 26, 2023
d22ddd7
test(otelschema): improve all attributes golden file
ernado Nov 26, 2023
f31a1a4
feat(otelschema): add clickhouse column types
ernado Nov 26, 2023
83602c2
feat(otelschema): handle deprecation
ernado Nov 26, 2023
2698828
feat(otelschema): handle ISO 8601
ernado Nov 26, 2023
0280abc
ci: submodules
ernado Nov 26, 2023
b4c0d6c
feat(otelschema): use underscores
ernado Nov 26, 2023
524536e
feat(otelschema): generate DDL
ernado Nov 26, 2023
3c6f24f
feat(otelschema): add table generator
ernado Nov 26, 2023
fcacd80
fix(otelschema): proper json encoding
ernado Nov 26, 2023
7409588
feat(chstorage): optimize schema
ernado Nov 27, 2023
1c690f7
feat(chstorage): draft logs impl
ernado Nov 27, 2023
eb31b35
test(lokie2e): change json to jsonl
ernado Nov 27, 2023
d2d4b7d
test(lokie2e): always send time range
ernado Nov 27, 2023
a407f86
fix(chstorage.querier.logs): fix iterator
ernado Nov 27, 2023
bb7931c
feat(chstorage.querier.logs): support REGEXP
ernado Nov 27, 2023
085a8bf
feat(chstorage): save metric flags too
tdakkota Nov 27, 2023
1ef66da
feat(chstorage): query exponential histograms too
tdakkota Nov 28, 2023
ebd81c4
feat(chstorage): query histograms too
tdakkota Nov 28, 2023
cf069b0
feat(chstorage.logs): undot
ernado Nov 28, 2023
00d2114
chore: rm print
ernado Nov 28, 2023
a644670
test(lokie2e): undot
ernado Nov 28, 2023
5749ea5
feat(oteldb.dev.local): add loki push
ernado Nov 28, 2023
69f4dbb
fix(oteldb.dev.local): httpMethod: GET
ernado Nov 28, 2023
aec8d9f
feat(lokiapi): add indexStats endpoint
ernado Nov 28, 2023
9895cee
feat(chstorage): query summaries too
tdakkota Nov 28, 2023
240bfde
fix(chstorage): call the right function
tdakkota Nov 29, 2023
07718ef
feat(otelfaker): improve
ernado Nov 29, 2023
8295bb5
docs(logs): init
ernado Nov 29, 2023
5a3d9c2
feat(dev.local.ch): add tempo
ernado Nov 29, 2023
6a2c4c7
feat(chotel): set span kind
ernado Nov 29, 2023
557e712
feat(otelfaker): add multiple levels
ernado Nov 29, 2023
d2e1a42
docs(logs): upd
ernado Nov 29, 2023
1f49550
docs: upd
ernado Nov 29, 2023
87886ea
docs(logs): don't search in all attrs
ernado Nov 29, 2023
0f1c1e9
docs(logs): describe extracted labels
ernado Nov 29, 2023
626c308
docs(logs): typo
ernado Nov 29, 2023
5f0e418
fix(chstorage): dedup labels before inserting
tdakkota Nov 30, 2023
33c5c46
refactor(chstorage): map histograms and summaries into points
tdakkota Nov 30, 2023
1aa9b95
test(prome2e): query histograms and summaries
tdakkota Nov 30, 2023
9aeed1d
test(lokie2e): rework
ernado Nov 30, 2023
c2118ec
chore: rm
ernado Nov 30, 2023
73b1e67
chore(git): upd submodule
ernado Nov 30, 2023
c8f58df
test(lokie2e): also test with dots
ernado Nov 30, 2023
e584ca5
fix(chstorage.querier.logs): correctly return label values
ernado Nov 30, 2023
8cb79fe
feat(logqlengine): add msg to labels
ernado Nov 30, 2023
a6d31e4
docs(readme): upd
ernado Nov 30, 2023
0ade99e
feat(logql): improve loki schema mapping
ernado Nov 30, 2023
ff6ebe9
feat(logqlengine): move trace_id, span_id to the tail of json
ernado Nov 30, 2023
51f2035
fix(logqlengine): fix NPE
ernado Nov 30, 2023
7bd4459
feat(zapotel): init zap to otel
ernado Nov 30, 2023
4842007
feat: enable zapotel
ernado Nov 30, 2023
9d0a43a
chore: pass ch.Query.Logger
ernado Nov 30, 2023
4eb1179
chore: pass ch.Query.Logger
ernado Nov 30, 2023
a5eb3eb
chore: rm printf
ernado Nov 30, 2023
77b135d
fix(chstorage): order by timestamp
ernado Nov 30, 2023
3286a7d
chore: use lg from zctx
ernado Nov 30, 2023
9f36768
feat(chstorage.querier.logs): optimize external table select
ernado Nov 30, 2023
5312701
fix(chstorage.logs): use exact match for materialized `service.` labels
tdakkota Dec 1, 2023
e1f81a2
fix(chstorage.q.logs): fix body tag matcher
ernado Dec 1, 2023
9948616
fix(logqlengine): adapt to OTEL
ernado Dec 1, 2023
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
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
Loading