Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,6 @@ FodyWeavers.xsd
generated/

src/Mocha.Antlr4.Generated/**/gen/

# LiteDB database files
*.db
8 changes: 8 additions & 0 deletions Mocha.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{D598862A-999C-40FD-A190-EBD00376D077}"
ProjectSection(SolutionItems) = preProject
docker\docker-compose.yml = docker\docker-compose.yml
docker\docker-compose-mysql-influxdb.yml = docker\docker-compose-mysql-influxdb.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "distributor", "distributor", "{959DCB4E-A070-4C66-A27F-D83CB933F0D8}"
Expand All @@ -61,6 +62,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mocha.Query.Tests", "tests\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mocha.Antlr4.Generated", "src\Mocha.Antlr4.Generated\Mocha.Antlr4.Generated.csproj", "{904CC523-A2D4-4982-8A7B-A6A0F5A5EB19}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mocha.Storage.Benchmarks", "tests\Mocha.Storage.Benchmarks\Mocha.Storage.Benchmarks.csproj", "{4B63E7B0-C8C8-4206-A113-A3D4EFB7533E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -81,6 +84,7 @@ Global
{C7222A9C-C50C-4FF0-A02D-778A9BB4DD2C} = {D598862A-999C-40FD-A190-EBD00376D077}
{D56CA47A-A948-4FB5-9E16-C61E12535521} = {24F9E34A-D92A-4C0A-851F-1E864181BF97}
{904CC523-A2D4-4982-8A7B-A6A0F5A5EB19} = {6983D239-07DA-4DFA-9AAA-F6876029FF8D}
{4B63E7B0-C8C8-4206-A113-A3D4EFB7533E} = {24F9E34A-D92A-4C0A-851F-1E864181BF97}
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DCA600F0-4D6C-44DA-A493-F63097CCE74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -127,5 +131,9 @@ Global
{904CC523-A2D4-4982-8A7B-A6A0F5A5EB19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{904CC523-A2D4-4982-8A7B-A6A0F5A5EB19}.Release|Any CPU.ActiveCfg = Release|Any CPU
{904CC523-A2D4-4982-8A7B-A6A0F5A5EB19}.Release|Any CPU.Build.0 = Release|Any CPU
{4B63E7B0-C8C8-4206-A113-A3D4EFB7533E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B63E7B0-C8C8-4206-A113-A3D4EFB7533E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B63E7B0-C8C8-4206-A113-A3D4EFB7533E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B63E7B0-C8C8-4206-A113-A3D4EFB7533E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
2 changes: 0 additions & 2 deletions docker/distributor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 4319

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
Expand Down
116 changes: 116 additions & 0 deletions docker/docker-compose-mysql-influxdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Licensed to the .NET Core Community under one or more agreements.
# The .NET Core Community licenses this file to you under the MIT license.

version: "3.8"

name: mocha-mysql-influxdb

services:
mysql:
image: mysql:8.2.0
container_name: mocha-mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mocha
MYSQL_USER: mocha
MYSQL_PASSWORD: mocha
ports:
- "3306:3306"
expose:
- "3306"
volumes:
- ../scripts/mysql/init:/docker-entrypoint-initdb.d/
# - ./mysql:/var/lib/mysql
restart: always
networks:
- mocha

influxdb:
image: influxdb:2.7.7
container_name: mocha-influxdb
ports:
- "8086:8086"
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=mocha
- DOCKER_INFLUXDB_INIT_PASSWORD=mocha_password
- DOCKER_INFLUXDB_INIT_ORG=mocha_org
- DOCKER_INFLUXDB_INIT_BUCKET=mocha_metrics
- DOCKER_INFLUXDB_INIT_RETENTION=1w
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=mocha_influxdb_token
# volumes:
# - ./influxdb:/var/lib/influxdb2
restart: always
networks:
- mocha

grafana:
image: grafana/grafana:11.0.1
container_name: mocha-grafana
ports:
- "3000:3000"
# volumes:
# - ./grafana:/var/lib/grafana
restart: always
networks:
- mocha

distributor:
build:
context: ..
dockerfile: ./docker/distributor/Dockerfile
container_name: mocha-distributor
ports:
- "4317:4317"
expose:
- "4317"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- Metadata__Storage__Provider=EFCore
- Tracing__Storage__Provider=EFCore
- Metrics__Storage__Provider=InfluxDB
- Metadata__Storage__EFCore=server=mysql;port=3306;database=mocha;userid=mocha;password=mocha
- Tracing__Storage__EFCore=server=mysql;port=3306;database=mocha;userid=mocha;password=mocha
- Metrics__Storage__InfluxDB__Url=http://influxdb:8086
- Metrics__Storage__InfluxDB__Token=mocha_influxdb_token
- Metrics__Storage__InfluxDB__Org=mocha_org
- Metrics__Storage__InfluxDB__Bucket=mocha_metrics
- Logging__LogLevel__Microsoft.EntityFrameworkCore=Warning
depends_on:
- mysql
- influxdb
restart: always
networks:
- mocha

query:
build:
context: ..
dockerfile: ./docker/query/Dockerfile
container_name: mocha-query
ports:
- "5775:5775"
expose:
- "5775"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- Metadata__Storage__Provider=EFCore
- Tracing__Storage__Provider=EFCore
- Metrics__Storage__Provider=InfluxDB
- Metadata__Storage__EFCore=server=mysql;port=3306;database=mocha;userid=mocha;password=mocha
- Tracing__Storage__EFCore=server=mysql;port=3306;database=mocha;userid=mocha;password=mocha
- Metrics__Storage__InfluxDB__Url=http://influxdb:8086
- Metrics__Storage__InfluxDB__Token=mocha_influxdb_token
- Metrics__Storage__InfluxDB__Org=mocha_org
- Metrics__Storage__InfluxDB__Bucket=mocha_metrics
- Logging__LogLevel__Microsoft.EntityFrameworkCore=Warning
depends_on:
- mysql
- influxdb
restart: always
networks:
- mocha

networks:
mocha:
driver: bridge
76 changes: 17 additions & 59 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,13 @@ version: "3.8"
name: mocha

services:
mysql:
image: mysql:8.2.0
container_name: mocha-mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mocha
MYSQL_USER: mocha
MYSQL_PASSWORD: mocha
ports:
- "3306:3306"
expose:
- "3306"
volumes:
- ../scripts/mysql/init:/docker-entrypoint-initdb.d/
# - ./mysql:/var/lib/mysql
restart: always
networks:
- mocha

influxdb:
image: influxdb:2.7.7
container_name: mocha-influxdb
ports:
- "8086:8086"
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=mocha
- DOCKER_INFLUXDB_INIT_PASSWORD=mocha_password
- DOCKER_INFLUXDB_INIT_ORG=mocha_org
- DOCKER_INFLUXDB_INIT_BUCKET=mocha_metrics
- DOCKER_INFLUXDB_INIT_RETENTION=1w
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=mocha_influxdb_token
# volumes:
# - ./influxdb:/var/lib/influxdb2
restart: always
networks:
- mocha

grafana:
image: grafana/grafana:11.0.1
container_name: mocha-grafana
ports:
- "3000:3000"
# If you want to persist Grafana data, uncomment the following lines
# volumes:
# - ./grafana:/var/lib/grafana
restart: always
Expand All @@ -66,19 +30,17 @@ services:
- "4317"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- Metadata__Storage__EF=server=mysql;port=3306;database=mocha;userid=mocha;password=mocha
- Trace__Storage__EF=server=mysql;port=3306;database=mocha;userid=mocha;password=mocha
- Metrics__Storage__InfluxDB__Url=http://influxdb:8086
- Metrics__Storage__InfluxDB__Token=mocha_influxdb_token
- Metrics__Storage__InfluxDB__Org=mocha_org
- Metrics__Storage__InfluxDB__Bucket=mocha_metrics
- Logging__LogLevel__Microsoft.EntityFrameworkCore=Warning
depends_on:
- mysql
- influxdb
- Metadata__Storage__Provider=LiteDB
- Tracing__Storage__Provider=LiteDB
- Metrics__Storage__Provider=LiteDB
- Metadata__Storage__LiteDB__DatabasePath=/data/litedb
- Tracing__Storage__LiteDB__DatabasePath=/data/litedb
- Metrics__Storage__LiteDB__DatabasePath=/data/litedb
restart: always
networks:
- mocha
volumes:
- ./litedb_data:/data/litedb

query:
build:
Expand All @@ -91,22 +53,18 @@ services:
- "5775"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- Metadata__Storage__EF=server=mysql;port=3306;database=mocha;userid=mocha;password=mocha
- Trace__Storage__EF=server=mysql;port=3306;database=mocha;userid=mocha;password=mocha
- Metrics__Storage__InfluxDB__Url=http://influxdb:8086
- Metrics__Storage__InfluxDB__Token=mocha_influxdb_token
- Metrics__Storage__InfluxDB__Org=mocha_org
- Metrics__Storage__InfluxDB__Bucket=mocha_metrics
- Logging__LogLevel__Microsoft.EntityFrameworkCore=Warning
depends_on:
- mysql
- influxdb
- Metadata__Storage__Provider=LiteDB
- Tracing__Storage__Provider=LiteDB
- Metrics__Storage__Provider=LiteDB
- Metadata__Storage__LiteDB__DatabasePath=/data/litedb
- Tracing__Storage__LiteDB__DatabasePath=/data/litedb
- Metrics__Storage__LiteDB__DatabasePath=/data/litedb
restart: always
networks:
- mocha
volumes:
- ./litedb_data:/data/litedb

networks:
mocha:
driver: bridge


1 change: 0 additions & 1 deletion docker/query/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/quick-start/docker-compose/assets/query-metrics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/quick-start/docker-compose/assets/query-trace-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 16 additions & 5 deletions docs/quick-start/docker-compose/quick-start.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ Execute the following command in the docker directory under the project root dir
docker-compose up --build -d
```

This version of storage is LiteDB, which is an embedded database, so there is no need to start additional database containers.

After the startup is successful, you can see the following containers:

+ mocha-distributor: Provides gRPC API for receiving OTLP data
+ mocha-query: Provides HTTP API for receiving query protocol
+ mocha-grafana: Used to display data

We have also implemented versions that store Tracing to MySQL and Metrics to InfluxDB.

You can execute `docker-compose -f docker-compose-mysql-influxdb.yml up --build -d` to start the version that uses MySQL and InfluxDB.

After the startup is successful, in addition to the above containers, you can also see the following containers:

+ mocha-mysql: Used to store data
+ mocha-influxdb: Used to store data
+ mocha-grafana: Used to display data

## Send Data

Expand Down Expand Up @@ -40,6 +49,8 @@ Select Jaeger.

Configure the URL of the Jaeger data source as `http://query:5775/jaeger`.

The name of the data source can be customized. In this example, we use mocha-tracing.

![](./assets/add-jaeger-data-source-4.png)

Click Save & Test. If the following information is displayed, the configuration is successful.
Expand All @@ -52,7 +63,7 @@ If no data has been sent to the distributor yet, the following warning message w

#### Query Trace Data

Click the menu on the left, select Explore, and then select the Jaeger data source to see the Trace data.
Click the menu on the left, select Explore, and then select the mocha-tracing data source to see the Trace data.

![](./assets/query-trace.png)

Expand All @@ -74,6 +85,8 @@ Select Prometheus.

Configure the URL of the Prometheus data source as `http://query:5775/prometheus`.

The name of the data source can be customized. In this example, we use mocha-metrics.

![](./assets/add-prometheus-data-source-2.png)

Configure the HTTP Method as POST.
Expand All @@ -96,12 +109,10 @@ Click the menu on the left, select Dashboards, and then create a new dashboard.

![](./assets/create-metrics-dashboard-2.png)

Select the Prometheus data source that we just created.
Select the mocha-metrics data source that we just created.

![](./assets/create-metrics-dashboard-3.png)

After that, you can add panels as needed to display Metrics data.

![](./assets/create-metrics-dashboard-4.png)


Loading