-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47cf411
commit d95a66c
Showing
107 changed files
with
4,827 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...tructure/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Extensions/DictionaryExtenistions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace System.Collections.Generic; | ||
|
||
public static class DictionaryExtenistions | ||
{ | ||
private static readonly JsonSerializerOptions _serializerOptions = new() | ||
{ | ||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, | ||
NumberHandling = JsonNumberHandling.AllowReadingFromString | ||
}; | ||
|
||
public static Dictionary<string, T> GroupByKeyPrefix<T>(this Dictionary<string, object> source, string prefix, Func<object, T>? convertFunc = null) | ||
{ | ||
var result = new Dictionary<string, T>(); | ||
foreach (var key in source.Keys) | ||
{ | ||
if (!key.StartsWith(prefix)) | ||
continue; | ||
var value = source[key]; | ||
var newKey = key[prefix.Length..]; | ||
if (convertFunc != null) | ||
value = convertFunc(source[key]); | ||
result.Add(newKey, (T)value!); | ||
} | ||
return result; | ||
} | ||
|
||
internal static T ConvertTo<T>(this Dictionary<string, object> dic) | ||
{ | ||
var text = JsonSerializer.Serialize(dic, _serializerOptions); | ||
return JsonSerializer.Deserialize<T>(text, _serializerOptions)!; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...BuildingBlocks.StackSdks.Tsc.Contracts/Masa.BuildingBlocks.StackSdks.Tsc.Contracts.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Masa.BuildingBlocks.Data.Contracts" Version="$(MasaFrameworkPackageVersion)" /> | ||
</ItemGroup> | ||
|
||
</Project> |
14 changes: 14 additions & 0 deletions
14
...rastructure/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/Aggregate/AggregateTypes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Model.Aggregate; | ||
|
||
public enum AggregateTypes | ||
{ | ||
Count=1, | ||
Sum, | ||
Avg, | ||
DistinctCount, | ||
DateHistogram, | ||
GroupBy | ||
} |
25 changes: 25 additions & 0 deletions
25
.../Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/Aggregate/SimpleAggregateRequestDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Model.Aggregate; | ||
|
||
public class SimpleAggregateRequestDto : BaseRequestDto | ||
{ | ||
public string Name { get; set; } | ||
|
||
public string Alias { get; set; } | ||
|
||
public AggregateTypes Type { get; set; } | ||
|
||
public int MaxCount { get; set; } | ||
|
||
/// <summary> | ||
/// currently support elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/search-aggregations-bucket-datehistogram-aggregation.html | ||
/// </summary> | ||
public string Interval { get; set; } | ||
|
||
/// <summary> | ||
/// only fro type Group by, true return type is IEnumerable<KeyValuePair<string, int>>,false is IEnumerable<string> | ||
/// </summary> | ||
public bool AllValue { get; set; } | ||
} |
29 changes: 29 additions & 0 deletions
29
src/Infrastructure/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/BaseRequestDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Model; | ||
|
||
public class BaseRequestDto : RequestPageBase | ||
{ | ||
public string TraceId { get; set; } | ||
|
||
public string Service { get; set; } | ||
|
||
public string Instance { get; set; } | ||
|
||
public string Endpoint { get; set; } | ||
|
||
public string Keyword { get; set; } | ||
|
||
public DateTime Start { get; set; } | ||
|
||
public DateTime End { get; set; } | ||
|
||
public string RawQuery { get; set; } | ||
|
||
public IEnumerable<FieldConditionDto> Conditions { get; set; } | ||
|
||
public FieldOrderDto? Sort { get; set; } | ||
|
||
public virtual void AppendConditions() { } | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Infrastructure/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/ConditionTypes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Model; | ||
|
||
public enum ConditionTypes | ||
{ | ||
Equal=1, | ||
NotEqual, | ||
Great, | ||
Less, | ||
GreatEqual, | ||
LessEqual, | ||
In, | ||
NotIn, | ||
Regex, | ||
NotRegex, | ||
Exists, | ||
NotExists | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Infrastructure/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/FieldConditionDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Model; | ||
|
||
public class FieldConditionDto | ||
{ | ||
public string Name { get; set; } | ||
|
||
public ConditionTypes Type { get; set; } | ||
|
||
public object Value { get; set; } | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Infrastructure/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/FieldOrderDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Model; | ||
|
||
public class FieldOrderDto | ||
{ | ||
public string Name { get; set; } | ||
|
||
public bool IsDesc { get; set; } = true; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Infrastructure/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/MappingResponseDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Model; | ||
|
||
public class MappingResponseDto | ||
{ | ||
public string Name { get; set; } | ||
|
||
public string Type { get; set; } | ||
} |
80 changes: 80 additions & 0 deletions
80
...cture/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/Trace/TraceDatabaseResponseDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Trace; | ||
|
||
public class TraceDatabaseResponseDto | ||
{ | ||
[JsonPropertyName("db.system")] | ||
public virtual string System { get; set; } | ||
|
||
[JsonPropertyName("db.connection_string")] | ||
public virtual string ConnectionString { get; set; } | ||
|
||
[JsonPropertyName("db.user")] | ||
public virtual string User { get; set; } | ||
|
||
[JsonPropertyName("net.peer.ip")] | ||
public virtual string PeerIp { get; set; } | ||
|
||
[JsonPropertyName("net.peer.name")] | ||
public virtual string PeerName { get; set; } | ||
|
||
[JsonPropertyName("net.peer.port")] | ||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] | ||
public virtual int PeerPort { get; set; } | ||
|
||
[JsonPropertyName("net.transport")] | ||
public virtual string Transport { get; set; } | ||
|
||
[JsonPropertyName("db.jdbc.driver_classname")] | ||
public virtual string JdbcDriverClassName { get; set; } | ||
|
||
[JsonPropertyName("db.mssql.instance_name")] | ||
public virtual string MssqlInstanceName { get; set; } | ||
|
||
[JsonPropertyName("db.name")] | ||
public virtual string Name { get; set; } | ||
|
||
[JsonPropertyName("db.statement")] | ||
public virtual string Statement { get; set; } | ||
|
||
[JsonPropertyName("db.operation")] | ||
public virtual string Operation { get; set; } | ||
|
||
[JsonPropertyName("db.redis.database_index")] | ||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] | ||
public virtual int RedisDatabaseIndex { get; set; } | ||
|
||
[JsonPropertyName("db.mongodb.collection")] | ||
public virtual string MongodbCollection { get; set; } | ||
|
||
[JsonPropertyName("db.sql.table")] | ||
public virtual string SqlTable { get; set; } | ||
|
||
#region Cassandra | ||
|
||
[JsonPropertyName("db.cassandra.page_size")] | ||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] | ||
public virtual int CassandraPageSize { get; set; } | ||
|
||
[JsonPropertyName("db.cassandra.consistency_level")] | ||
public virtual string CassandraConsistencyLevel { get; set; } | ||
|
||
[JsonPropertyName("db.cassandra.table")] | ||
public virtual string CassandraTable { get; set; } | ||
|
||
[JsonPropertyName("db.cassandra.idempotence")] | ||
public virtual bool CassandraIdempotence { get; set; } | ||
|
||
[JsonPropertyName("db.cassandra.speculative_execution_count")] | ||
public virtual bool CassandraSpeculativeExecutionCount { get; set; } | ||
|
||
[JsonPropertyName("db.cassandra.coordinator.id")] | ||
public virtual string CassandraCoordinatorId { get; set; } | ||
|
||
[JsonPropertyName("db.cassandra.coordinator.dc")] | ||
public virtual string CassandraCoordinatorDc { get; set; } | ||
|
||
#endregion | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Infrastructure/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/Trace/TraceDtoKind.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Model.Trace; | ||
|
||
public sealed class TraceDtoKind | ||
{ | ||
private TraceDtoKind() { } | ||
|
||
public const string SPAN_KIND_SERVER = nameof(SPAN_KIND_SERVER); | ||
|
||
public const string SPAN_KIND_CLIENT = nameof(SPAN_KIND_CLIENT); | ||
} |
19 changes: 19 additions & 0 deletions
19
...ture/Masa.BuildingBlocks.StackSdks.Tsc.Contracts/Model/Trace/TraceExceptionResponseDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.BuildingBlocks.StackSdks.Tsc.Contracts.Trace; | ||
|
||
public class TraceExceptionResponseDto | ||
{ | ||
[JsonPropertyName("exception.type")] | ||
public virtual string Type { get; set; } | ||
|
||
[JsonPropertyName("exception.message")] | ||
public virtual string Message { get; set; } | ||
|
||
[JsonPropertyName("exception.stacktrace")] | ||
public virtual string StackTrace { get; set; } | ||
|
||
[JsonPropertyName("exception.escaped")] | ||
public virtual bool Escaped { get; set; } | ||
} |
Oops, something went wrong.