Skip to content

Commit 1da9211

Browse files
Fix project and dockerfile build (dotnetcore#44)
1 parent 7a78a18 commit 1da9211

15 files changed

Lines changed: 158 additions & 93 deletions

File tree

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
**/obj
2222
**/secrets.dev.yaml
2323
**/values.dev.yaml
24+
**/*.db
25+
**/*.md
2426
LICENSE
25-
README.md

Mocha.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2424
README.md = README.md
2525
.github\workflows\dotnet-build.yml = .github\workflows\dotnet-build.yml
2626
README.zh-CN.md = README.zh-CN.md
27+
codecov.yml = codecov.yml
2728
EndProjectSection
2829
EndProject
2930
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mocha.Storage", "src\Mocha.Storage\Mocha.Storage.csproj", "{8EEB6697-B975-430D-9CC3-3048E76C5ECA}"
@@ -64,6 +65,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mocha.Antlr4.Generated", "s
6465
EndProject
6566
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mocha.Storage.Benchmarks", "tests\Mocha.Storage.Benchmarks\Mocha.Storage.Benchmarks.csproj", "{4B63E7B0-C8C8-4206-A113-A3D4EFB7533E}"
6667
EndProject
68+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "grafana", "grafana", "{5B280BB9-A7AE-46E6-B735-CF484965A736}"
69+
EndProject
70+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "provisioning", "provisioning", "{C6E71F9B-BB5B-4946-9732-96CBA0B366B3}"
71+
EndProject
72+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "datasources", "datasources", "{8FAF9AF6-7399-41FC-96C9-43756AAD16CB}"
73+
ProjectSection(SolutionItems) = preProject
74+
docker\grafana\provisioning\datasources\mocha-datasources.yaml = docker\grafana\provisioning\datasources\mocha-datasources.yaml
75+
EndProjectSection
76+
EndProject
6777
Global
6878
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6979
Debug|Any CPU = Debug|Any CPU
@@ -85,6 +95,9 @@ Global
8595
{D56CA47A-A948-4FB5-9E16-C61E12535521} = {24F9E34A-D92A-4C0A-851F-1E864181BF97}
8696
{904CC523-A2D4-4982-8A7B-A6A0F5A5EB19} = {6983D239-07DA-4DFA-9AAA-F6876029FF8D}
8797
{4B63E7B0-C8C8-4206-A113-A3D4EFB7533E} = {24F9E34A-D92A-4C0A-851F-1E864181BF97}
98+
{5B280BB9-A7AE-46E6-B735-CF484965A736} = {D598862A-999C-40FD-A190-EBD00376D077}
99+
{C6E71F9B-BB5B-4946-9732-96CBA0B366B3} = {5B280BB9-A7AE-46E6-B735-CF484965A736}
100+
{8FAF9AF6-7399-41FC-96C9-43756AAD16CB} = {C6E71F9B-BB5B-4946-9732-96CBA0B366B3}
88101
EndGlobalSection
89102
GlobalSection(ProjectConfigurationPlatforms) = postSolution
90103
{DCA600F0-4D6C-44DA-A493-F63097CCE74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage:
2+
status:
3+
project: off

docker/distributor/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ WORKDIR /app
44
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
55
ARG BUILD_CONFIGURATION=Release
66
WORKDIR /src
7-
COPY ["src/Mocha.Distributor/Mocha.Distributor.csproj", "src/Mocha.Distributor/"]
8-
COPY ["src/Mocha.Core/Mocha.Core.csproj", "src/Mocha.Core/"]
9-
COPY ["src/Mocha.Protocol.Generated/Mocha.Protocol.Generated.csproj", "src/Mocha.Protocol.Generated/"]
10-
COPY ["src/Mocha.Storage/Mocha.Storage.csproj", "src/Mocha.Storage/"]
11-
RUN dotnet restore "src/Mocha.Distributor/Mocha.Distributor.csproj"
12-
COPY . .
13-
WORKDIR "/src/src/Mocha.Distributor"
7+
COPY ["src/Mocha.Distributor/Mocha.Distributor.csproj", "Mocha.Distributor/"]
8+
COPY ["src/Mocha.Core/Mocha.Core.csproj", "Mocha.Core/"]
9+
COPY ["src/Mocha.Protocol.Generated/Mocha.Protocol.Generated.csproj", "Mocha.Protocol.Generated/"]
10+
COPY ["src/Mocha.Storage/Mocha.Storage.csproj", "Mocha.Storage/"]
11+
RUN dotnet restore "Mocha.Distributor/Mocha.Distributor.csproj"
12+
COPY src/ .
13+
WORKDIR "/src/Mocha.Protocol.Generated"
14+
RUN dotnet build "Mocha.Protocol.Generated.csproj" -c $BUILD_CONFIGURATION
15+
WORKDIR "/src/Mocha.Distributor"
1416
RUN dotnet build "Mocha.Distributor.csproj" -c $BUILD_CONFIGURATION -o /app/build
1517

1618
FROM build AS publish

docker/docker-compose-mysql-influxdb.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ services:
4949
container_name: mocha-grafana
5050
ports:
5151
- "3000:3000"
52-
# volumes:
52+
volumes:
53+
- ./grafana/provisioning:/etc/grafana/provisioning
54+
# If you want to persist Grafana data, uncomment the following lines
5355
# - ./grafana:/var/lib/grafana
5456
restart: always
5557
networks:

docker/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ services:
1212
container_name: mocha-grafana
1313
ports:
1414
- "3000:3000"
15+
volumes:
16+
- ./grafana/provisioning:/etc/grafana/provisioning
1517
# If you want to persist Grafana data, uncomment the following lines
16-
# volumes:
1718
# - ./grafana:/var/lib/grafana
1819
restart: always
1920
networks:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
# Tracing (Jaeger)
5+
- name: mocha-tracing
6+
type: jaeger
7+
uid: mocha-tracing
8+
access: proxy
9+
url: http://query:5775/jaeger
10+
isDefault: false
11+
editable: false
12+
13+
# Metrics (Prometheus API)
14+
- name: mocha-metrics
15+
type: prometheus
16+
uid: mocha-metrics
17+
access: proxy
18+
url: http://query:5775/prometheus
19+
isDefault: true
20+
editable: false
21+
22+
jsonData:
23+
httpMethod: POST

docker/query/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ RUN apt-get update && \
1111
rm -rf /var/lib/apt/lists/*
1212

1313
WORKDIR /src
14-
COPY ["src/Mocha.Query/Mocha.Query.csproj", "src/Mocha.Query/"]
15-
COPY ["src/Mocha.Antlr4.Generated/Mocha.Antlr4.Generated.csproj", "src/Mocha.Antlr4.Generated/"]
16-
COPY ["src/Mocha.Core/Mocha.Core.csproj", "src/Mocha.Core/"]
17-
COPY ["src/Mocha.Protocol.Generated/Mocha.Protocol.Generated.csproj", "src/Mocha.Protocol.Generated/"]
18-
COPY ["src/Mocha.Storage/Mocha.Storage.csproj", "src/Mocha.Storage/"]
19-
RUN dotnet restore "src/Mocha.Query/Mocha.Query.csproj"
20-
COPY . .
21-
WORKDIR "/src/src/Mocha.Query"
14+
COPY ["src/Mocha.Query/Mocha.Query.csproj", "Mocha.Query/"]
15+
COPY ["src/Mocha.Antlr4.Generated/Mocha.Antlr4.Generated.csproj", "Mocha.Antlr4.Generated/"]
16+
COPY ["src/Mocha.Core/Mocha.Core.csproj", "Mocha.Core/"]
17+
COPY ["src/Mocha.Protocol.Generated/Mocha.Protocol.Generated.csproj", "Mocha.Protocol.Generated/"]
18+
COPY ["src/Mocha.Storage/Mocha.Storage.csproj", "Mocha.Storage/"]
19+
RUN dotnet restore "Mocha.Query/Mocha.Query.csproj"
20+
COPY src/ .
21+
WORKDIR "/src/Mocha.Query"
2222
RUN dotnet build "Mocha.Query.csproj" -c $BUILD_CONFIGURATION -o /app/build
2323

2424
FROM build AS publish

docs/quick-start/docker-compose/quick-start.en-US.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,25 @@ Configure the OTLP exporter of the SDK as `http://localhost:4317` to send data t
2929

3030
## Query Data
3131

32+
Visit http://localhost:3000/ to see the grafana login page. Both the username and password are admin.
33+
3234
### Trace
3335

34-
#### Configure Jaeger Data Source
36+
#### Query Trace Data
3537

36-
We have implemented an API that supports the Jaeger query protocol, so you can configure the Jaeger data source directly in Grafana.
38+
We have implemented an API that supports the Jaeger query protocol, so you can configure mocha as a Jaeger data source in Grafana to query Trace data.
3739

38-
Visit http://localhost:3000/ to see the grafana login page. Both the username and password are admin.
40+
The Jaeger data source has been pre-configured in `docker/grafana/provisioning/datasources/mocha-datasources.yaml`.
41+
42+
Click the menu on the left, select Explore, and then select the mocha-tracing data source to see the Trace data.
43+
44+
![](./assets/query-trace.png)
45+
46+
![](./assets/query-trace-2.png)
47+
48+
#### Configure Jaeger Data Source
49+
50+
If you need to manually configure the Trace data source, you can refer to the following steps.
3951

4052
After logging in, click the menu on the left, select Data Sources, and then click Add data source.
4153

@@ -61,21 +73,35 @@ If no data has been sent to the distributor yet, the following warning message w
6173

6274
![](./assets/add-jaeger-data-source-warning.png)
6375

64-
#### Query Trace Data
76+
### Metrics
6577

66-
Click the menu on the left, select Explore, and then select the mocha-tracing data source to see the Trace data.
78+
#### Query Metrics Data
6779

68-
![](./assets/query-trace.png)
80+
We have implemented an API that supports the PromQL query protocol, so you can configure mocha as a Prometheus data source in Grafana to query Metrics data.
6981

70-
![](./assets/query-trace-2.png)
82+
The Prometheus data source has been pre-configured in `docker/grafana/provisioning/datasources/mocha-datasources.yaml`.
7183

72-
### Metrics
84+
Click the menu on the left, select Explore, and then select the Prometheus data source to see the Metrics data.
7385

74-
#### Configure Prometheus Data Source
86+
![](./assets/query-metrics.png)
7587

76-
We have implemented an API that supports the PromQL query protocol, so you can configure the Prometheus data source directly in Grafana.
88+
Click the menu on the left, select Dashboards, and then create a new dashboard.
7789

78-
Visit http://localhost:3000/ to see the grafana login page. Both the username and password are admin.
90+
![](./assets/create-metrics-dashboard.png)
91+
92+
![](./assets/create-metrics-dashboard-2.png)
93+
94+
Select the mocha-metrics data source that we just created.
95+
96+
![](./assets/create-metrics-dashboard-3.png)
97+
98+
After that, you can add panels as needed to display Metrics data.
99+
100+
![](./assets/create-metrics-dashboard-4.png)
101+
102+
#### Configure Prometheus Data Source
103+
104+
If you need to manually configure the Metrics data source, you can refer to the following steps.
79105

80106
After logging in, click the menu on the left, select Data Sources, and then click Add data source.
81107

@@ -96,23 +122,3 @@ Configure the HTTP Method as POST.
96122
Click Save & Test. If the following information is displayed, the configuration is successful.
97123

98124
![](./assets/add-prometheus-data-source-4.png)
99-
100-
#### Query Metrics Data
101-
102-
Click the menu on the left, select Explore, and then select the Prometheus data source to see the Metrics data.
103-
104-
![](./assets/query-metrics.png)
105-
106-
Click the menu on the left, select Dashboards, and then create a new dashboard.
107-
108-
![](./assets/create-metrics-dashboard.png)
109-
110-
![](./assets/create-metrics-dashboard-2.png)
111-
112-
Select the mocha-metrics data source that we just created.
113-
114-
![](./assets/create-metrics-dashboard-3.png)
115-
116-
After that, you can add panels as needed to display Metrics data.
117-
118-
![](./assets/create-metrics-dashboard-4.png)

docs/quick-start/docker-compose/quick-start.zh-CN.md

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,27 @@ docker-compose up --build -d
2828

2929
## 数据的查询
3030

31+
访问 http://localhost:3000/ 即可看到grafana的登录页面。用户名和密码都是admin。
32+
3133
### Trace
3234

33-
#### 配置 Jaeger 数据源
35+
#### Trace 数据的查询
3436

35-
我们实现了支持 Jaeger 查询协议的 API,因此可以直接在 Grafana 中配置 Jaeger 数据源
37+
我们实现了支持 Jaeger 查询协议的 API,因此可以在 Grafana 中配置 mocha 作为 Jaeger 数据源就可以查询 Trace 数据
3638

37-
访问 http://localhost:3000/ 即可看到grafana的登录页面。用户名和密码都是admin
39+
`docker/grafana/provisioning/datasources/mocha-datasources.yaml` 中已经预配置好了 Jaeger 数据源
3840

39-
登录后,点击左侧的菜单,选择 Data Sources,然后点击 Add data source。
41+
点击左侧的菜单,选择 Explore,然后选择 mocha-tracing 数据源,即可看到 Trace 数据。
42+
43+
![](./assets/query-trace.png)
44+
45+
![](./assets/query-trace-2.png)
46+
47+
#### 配置 Trace 数据源
48+
49+
如果需要手动配置 Trace 数据源,可以参考下面的步骤。
50+
51+
登录 grafana 后,点击左侧的菜单,选择 Data Sources,然后点击 Add data source。
4052

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

@@ -60,23 +72,38 @@ docker-compose up --build -d
6072

6173
![](./assets/add-jaeger-data-source-warning.png)
6274

63-
#### Trace 数据的查询
75+
### Metrics
6476

65-
点击左侧的菜单,选择 Explore,然后选择 mocha-tracing 数据源,即可看到 Trace 数据。
77+
#### Metrics 数据的查询
6678

67-
![](./assets/query-trace.png)
79+
我们实现了支持 PromQL 查询协议的 API,因此可以在 Grafana 中配置 mocha 作为 Prometheus 数据源就可以查询 Metrics 数据。
6880

69-
![](./assets/query-trace-2.png)
81+
`docker/grafana/provisioning/datasources/mocha-datasources.yaml` 中已经预配置好了 Prometheus 数据源。
7082

71-
### Metrics
83+
点击左侧的菜单,选择 Explore,然后选择 mocha-metrics 数据源,即可看到 Metrics 数据。
7284

73-
#### 配置 Prometheus 数据源
85+
![](./assets/query-metrics.png)
7486

75-
我们实现了支持 PromQL 查询协议的 API,因此可以直接在 Grafana 中配置 Prometheus 数据源
87+
点击左侧的菜单,选择 Dashboards,即可创建一个 Dashboard
7688

77-
访问 http://localhost:3000/ 即可看到grafana的登录页面。用户名和密码都是admin。
89+
![](./assets/create-metrics-dashboard.png)
90+
91+
![](./assets/create-metrics-dashboard-2.png)
7892

79-
登录后,点击左侧的菜单,选择 Data Sources,然后点击 Add data source。
93+
选择我们刚刚创建的 Prometheus 数据源。
94+
95+
![](./assets/create-metrics-dashboard-3.png)
96+
97+
接下来就可以根据需要添加 Panel,展示 Metrics 数据了。
98+
99+
![](./assets/create-metrics-dashboard-4.png)
100+
101+
102+
#### 配置 Prometheus 数据源
103+
104+
如果需要手动配置 Prometheus 数据源,可以参考下面的步骤。
105+
106+
登录 grafana 后,点击左侧的菜单,选择 Data Sources,然后点击 Add data source。
80107

81108
选择 Prometheus。
82109

@@ -95,23 +122,3 @@ docker-compose up --build -d
95122
点击 Save & Test,如果显示如下信息,则说明配置成功。
96123

97124
![](./assets/add-prometheus-data-source-4.png)
98-
99-
#### Metrics 数据的查询
100-
101-
点击左侧的菜单,选择 Explore,然后选择 mocha-metrics 数据源,即可看到 Metrics 数据。
102-
103-
![](./assets/query-metrics.png)
104-
105-
点击左侧的菜单,选择 Dashboards,即可创建一个 Dashboard。
106-
107-
![](./assets/create-metrics-dashboard.png)
108-
109-
![](./assets/create-metrics-dashboard-2.png)
110-
111-
选择我们刚刚创建的 Prometheus 数据源。
112-
113-
![](./assets/create-metrics-dashboard-3.png)
114-
115-
接下来就可以根据需要添加 Panel,展示 Metrics 数据了。
116-
117-
![](./assets/create-metrics-dashboard-4.png)

0 commit comments

Comments
 (0)