Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
IoTSharp.AspNetCore.HealthChecks
提交
200d86fd
I
IoTSharp.AspNetCore.HealthChecks
项目概览
jobily
/
IoTSharp.AspNetCore.HealthChecks
8 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
IoTSharp.AspNetCore.HealthChecks
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
200d86fd
编写于
7月 22, 2022
作者:
麦壳饼
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修正健康检查的引用。
上级
ab73a08d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
38 addition
and
47 deletion
+38
-47
docker-compose.yml
docker-compose.yml
+1
-11
src/HealthChecks.Cassandra/HealthChecks.Cassandra.csproj
src/HealthChecks.Cassandra/HealthChecks.Cassandra.csproj
+2
-2
src/HealthChecks.InfluxDB/HealthChecks.InfluxDB.csproj
src/HealthChecks.InfluxDB/HealthChecks.InfluxDB.csproj
+2
-2
src/HealthChecks.InfluxDB/InfluxDBHealthCheck.cs
src/HealthChecks.InfluxDB/InfluxDBHealthCheck.cs
+1
-0
src/HealthChecks.IoTDB/HealthChecks.IoTDB.csproj
src/HealthChecks.IoTDB/HealthChecks.IoTDB.csproj
+3
-3
src/HealthChecks.IoTDB/IoTDBHealthCheck.cs
src/HealthChecks.IoTDB/IoTDBHealthCheck.cs
+7
-20
src/example/appsettings.json
src/example/appsettings.json
+2
-2
src/example/example.csproj
src/example/example.csproj
+20
-7
未找到文件。
docker-compose.yml
浏览文件 @
200d86fd
...
...
@@ -27,17 +27,7 @@ services:
networks
:
-
iotsharp-network
influxdb_cli
:
links
:
-
influx
image
:
quay.io/influxdb/influxdb:v2.0.4
entrypoint
:
influx setup --bucket iotsharp-bucket -t iotsharp-tokeniotsharp-tokeniotsharp-tokeniotsharp-tokeniotsharp-token -o iotsharp --username=root --password=1-q2-w3-e4-r5-t --host=http://influx:8086 -f
restart
:
on-failure:20
depends_on
:
-
influx
networks
:
-
iotsharp-network
cassandra
:
image
:
cassandra:latest
container_name
:
cassandra
...
...
src/HealthChecks.Cassandra/HealthChecks.Cassandra.csproj
浏览文件 @
200d86fd
...
...
@@ -11,8 +11,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CassandraCSharpDriver" Version="3.1
7.1
" />
<PackageReference Include="CassandraCSharpDriver" Version="3.1
8.0
" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.
5
" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.
7
" />
</ItemGroup>
</Project>
src/HealthChecks.InfluxDB/HealthChecks.InfluxDB.csproj
浏览文件 @
200d86fd
...
...
@@ -11,8 +11,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="InfluxDB.Client" Version="4.
2
.0" />
<PackageReference Include="InfluxDB.Client" Version="4.
3
.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.
5
" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.
7
" />
</ItemGroup>
</Project>
src/HealthChecks.InfluxDB/InfluxDBHealthCheck.cs
浏览文件 @
200d86fd
...
...
@@ -30,6 +30,7 @@ namespace HealthChecks.InfluxDB
{
try
{
var
hea
=
await
_influxdb_client
.
HealthAsync
();
var
ready
=
await
_influxdb_client
.
ReadyAsync
();
var
ping
=
await
_influxdb_client
.
PingAsync
();
var
hs
=
ping
&&
ready
.
Status
==
Ready
.
StatusEnum
.
Ready
?
HealthStatus
.
Healthy
:
context
.
Registration
.
FailureStatus
;
...
...
src/HealthChecks.IoTDB/HealthChecks.IoTDB.csproj
浏览文件 @
200d86fd
...
...
@@ -12,9 +12,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Apache.IoTDB
" Version="0.13.0.6
" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.
5
" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="6.0.
5
" />
<PackageReference Include="Apache.IoTDB
.Data" Version="0.13.0.7-alpha" PrivateAssets="all
" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.
7
" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="6.0.
7
" />
</ItemGroup>
</Project>
src/HealthChecks.IoTDB/IoTDBHealthCheck.cs
浏览文件 @
200d86fd
...
...
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Apache.IoTDB.Data
;
namespace
HealthChecks.IoTDB
{
public
class
IoTDBHealthCheck
...
...
@@ -17,22 +17,9 @@ namespace HealthChecks.IoTDB
public
IoTDBHealthCheck
(
string
connectionString
)
{
Dictionary
<
string
,
string
>
pairs
=
new
Dictionary
<
string
,
string
>();
connectionString
.
Split
(
';'
,
StringSplitOptions
.
RemoveEmptyEntries
).
ToList
().
ForEach
(
f
=>
{
var
kv
=
f
.
Split
(
'='
);
pairs
.
TryAdd
(
key
:
kv
[
0
],
value
:
kv
[
1
]);
});
string
host
=
pairs
.
GetValueOrDefault
(
"Server"
)
??
"127.0.0.1"
;
int
port
=
int
.
Parse
(
pairs
.
GetValueOrDefault
(
"Port"
)
??
"6667"
);
string
username
=
pairs
.
GetValueOrDefault
(
"User"
)
??
"root"
;
string
password
=
pairs
.
GetValueOrDefault
(
"Password"
)
??
"root"
;
int
fetchSize
=
int
.
Parse
(
pairs
.
GetValueOrDefault
(
"fetchSize"
)
??
"1800"
);
bool
enableRpcCompression
=
bool
.
Parse
(
pairs
.
GetValueOrDefault
(
"enableRpcCompression"
)
??
"false"
);
int
poolSize
=
int
.
Parse
(
pairs
.
GetValueOrDefault
(
"poolSize"
)??
"8"
)
;
string
zoneId
=
pairs
.
GetValueOrDefault
(
"zoneId"
)
??
"UTC+08:00"
;
session_pool
=
new
SessionPool
(
host
,
port
,
username
,
password
,
fetchSize
,
zoneId
,
poolSize
);
_enableRpcCompression
=
enableRpcCompression
;
var
builder
=
new
IoTDBConnectionStringBuilder
(
connectionString
);
session_pool
=
builder
.
CreateSession
();
_enableRpcCompression
=
builder
.
Compression
;
}
public
IoTDBHealthCheck
(
SessionPool
session
)
...
...
@@ -46,10 +33,10 @@ namespace HealthChecks.IoTDB
{
await
session_pool
.
Open
(
_enableRpcCompression
);
var
state
=
session_pool
.
IsOpen
();
await
session_pool
.
SetTimeZone
(
"GMT+8:00"
);
var
tz
=
await
session_pool
.
GetTimeZone
()
==
"GMT+8:00"
;
var
tz
=
await
session_pool
.
GetTimeZone
(
);
await
session_pool
.
SetTimeZone
(
tz
)
;
await
session_pool
.
Close
();
return
new
HealthCheckResult
(
state
&&
tz
?
HealthStatus
.
Healthy
:
(
state
||
tz
?
HealthStatus
.
Degraded
:
context
.
Registration
.
FailureStatus
));
return
new
HealthCheckResult
(
state
?
HealthStatus
.
Healthy
:
(
state
?
HealthStatus
.
Degraded
:
context
.
Registration
.
FailureStatus
));
}
catch
(
Exception
ex
)
{
...
...
src/example/appsettings.json
浏览文件 @
200d86fd
{
"ConnectionStrings"
:
{
"influx"
:
"http://influx:8086/?org=iotsharp&bucket=iotsharp-bucket&token=
iotsharp-tokeniotsharp-tokeniotsharp-tokeniotsharp-tokeniotsharp-token&
&latest=-72h"
,
"influx"
:
"http://influx:8086/?org=iotsharp&bucket=iotsharp-bucket&token=
xi_XzrKeWN_RW4v5DfIK6MWwdrQG1FdGYUBTl25V7cRSSKmxTPhqwH9OZWBneFsW0-Xrt-jeLefqcc1zkiQK-A==
&latest=-72h"
,
"cassandra1"
:
"Contact Points=cassandra;Username=user1;Password=P@ssword!"
,
"cassandra"
:
"Contact Points=cassandra"
,
"iotdb"
:
"
Server
=iotdb"
"iotdb"
:
"
DataSource
=iotdb"
},
"Logging"
:
{
...
...
src/example/example.csproj
浏览文件 @
200d86fd
...
...
@@ -12,16 +12,29 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.4" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="Apache.IoTDB" Version="0.13.0.7-alpha" />
<PackageReference Include="Apache.IoTDB.Data" Version="0.13.0.7-alpha" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.5" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.16.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HealthChecks.Cassandra\HealthChecks.Cassandra.csproj" />
<ProjectReference Include="..\HealthChecks.InfluxDB\HealthChecks.InfluxDB.csproj" />
<ProjectReference Include="..\HealthChecks.IoTDB\HealthChecks.IoTDB.csproj" />
<ProjectReference Include="..\HealthChecks.Cassandra\HealthChecks.Cassandra.csproj">
<Private>True</Private>
<CopyLocalSatelliteAssemblies>True</CopyLocalSatelliteAssemblies>
</ProjectReference>
<ProjectReference Include="..\HealthChecks.InfluxDB\HealthChecks.InfluxDB.csproj">
<CopyLocalSatelliteAssemblies>True</CopyLocalSatelliteAssemblies>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\HealthChecks.IoTDB\HealthChecks.IoTDB.csproj">
<Private>True</Private>
<CopyLocalSatelliteAssemblies>True</CopyLocalSatelliteAssemblies>
</ProjectReference>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录