Skip to content

Commit

Permalink
Merge pull request #10 from dotnetcore/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
brucehu123 committed Nov 11, 2019
2 parents 7412a58 + be43a8d commit 6ab1da0
Show file tree
Hide file tree
Showing 33 changed files with 308 additions and 113 deletions.
1 change: 0 additions & 1 deletion src/Surging.ApiGateway/Configs/gatewaySettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"TokenEndpointPath": "api/oauth2/token",
"CacheMode": "MemoryCache", //MemoryCache or gateway.Redis save token
"AccessPolicy": {
"Origins": [ "http://127.0.0.1:1927", "http://localhost:927" ],
"AllowAnyHeader": true,
"AllowAnyMethod": true
},
Expand Down
9 changes: 7 additions & 2 deletions src/Surging.ApiGateway/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
using Surging.Core.Caching;
using Surging.Core.CPlatform.Cache;
using System.Linq;
using Surging.Apm.Skywalking;
using Surging.Apm.Skywalking.Abstractions;

namespace Surging.ApiGateway
{
Expand Down Expand Up @@ -74,7 +76,9 @@ private IServiceProvider RegisterAutofac(IServiceCollection services)
else if(registerConfig.Provider == RegisterProvider.Zookeeper)
option.UseZooKeeperManager(new ZookeeperConfigInfo(registerConfig.Address, enableChildrenMonitor: true));
option.UseDotNettyTransport();
option.AddApiGateWay();
option.AddApiGateWay();
option.AddRpcTransportDiagnostic();
option.UseSkywalking();
option.AddFilter(new ServiceExceptionFilter());
//option.UseProtoBufferCodec();
option.UseMessagePackCodec();
Expand All @@ -93,7 +97,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
ServiceLocator.Current.Resolve<IServiceProxyFactory>();
ServiceLocator.Current.Resolve<IServiceCacheManager>().SetCachesAsync(addressDescriptors);
ServiceLocator.Current.Resolve<IConfigurationWatchProvider>();

ServiceLocator.Current.Resolve<IInstrumentStartup>().StartAsync();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
Expand All @@ -105,6 +109,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
app.UseCors(builder =>
{
var policy = Core.ApiGateWay.AppConfig.Policy;
if(policy.Origins !=null)
builder.WithOrigins(policy.Origins);
if (policy.AllowAnyHeader)
builder.AllowAnyHeader();
Expand Down
5 changes: 5 additions & 0 deletions src/Surging.ApiGateway/Surging.ApiGateway.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Surging.Apm\SkyApm.Transport.Grpc.Protocol\SkyApm.Transport.Grpc.Protocol.csproj" />
<ProjectReference Include="..\Surging.Apm\Surging.Apm.Skywalking\Surging.Apm.Skywalking.csproj" />
<ProjectReference Include="..\Surging.Core\Surging.Core.ApiGateWay\Surging.Core.ApiGateWay.csproj" />
<ProjectReference Include="..\Surging.Core\Surging.Core.Caching\Surging.Core.Caching.csproj" />
<ProjectReference Include="..\Surging.Core\Surging.Core.Codec.MessagePack\Surging.Core.Codec.MessagePack.csproj" />
Expand All @@ -64,6 +66,9 @@
<Content Update="Configs\gatewaySettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="skyapm.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
29 changes: 29 additions & 0 deletions src/Surging.ApiGateway/skyapm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"SkyWalking": {
"ServiceName": "Surging.ApiGateway",
"Namespace": "",
"HeaderVersions": [
"sw6"
],
"Sampling": {
"SamplePer3Secs": -1,
"Percentage": -1.0
},
"Logging": {
"Level": "Information",
"FilePath": "logs/skyapm-{Date}.log"
},
"Transport": {
"Interval": 3000,
"ProtocolVersion": "v6",
"QueueSize": 30000,
"BatchSize": 3000,
"gRPC": {
"Servers": "localhost:11800",
"Timeout": 100000,
"ConnectTimeout": 100000,
"ReportTimeout": 600000
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<Description>$(Product) gRPC data transmitter.</Description>
<AssemblyTitle>$(PackagePrefix).Transport.Grpc.Protocol</AssemblyTitle>
<AssemblyName>$(PackagePrefix).Transport.Grpc.Protocol</AssemblyName>
<AssemblyName>SkyApm.Transport.Grpc.Protocol</AssemblyName>
<PackageId>$(PackagePrefix).Transport.Grpc.Protocol</PackageId>
<PackageTags>SkyWalking;Grpc</PackageTags>
<PackageReleaseNotes>
Expand All @@ -14,9 +14,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
<PackageReference Include="Grpc" Version="1.17.0" />
<PackageReference Include="Grpc.Tools" Version="1.17.0" PrivateAssets="All" />
<PackageReference Include="Google.Protobuf" Version="3.10.1" />
<PackageReference Include="Grpc" Version="2.24.0" />
<PackageReference Include="Grpc.Tools" Version="2.24.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public sealed partial class ApplicationMapping : pb::IMessage<ApplicationMapping
}
if (other.application_ != null) {
if (application_ == null) {
application_ = new global::SkyWalking.NetworkProtocol.KeyWithIntegerValue();
Application = new global::SkyWalking.NetworkProtocol.KeyWithIntegerValue();
}
Application.MergeFrom(other.Application);
}
Expand All @@ -297,9 +297,9 @@ public sealed partial class ApplicationMapping : pb::IMessage<ApplicationMapping
break;
case 10: {
if (application_ == null) {
application_ = new global::SkyWalking.NetworkProtocol.KeyWithIntegerValue();
Application = new global::SkyWalking.NetworkProtocol.KeyWithIntegerValue();
}
input.ReadMessage(application_);
input.ReadMessage(Application);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static partial class ApplicationRegisterService
}

/// <summary>Base class for server-side implementations of ApplicationRegisterService</summary>
[grpc::BindServiceMethod(typeof(ApplicationRegisterService), "BindService")]
public abstract partial class ApplicationRegisterServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::SkyWalking.NetworkProtocol.ApplicationMapping> applicationCodeRegister(global::SkyWalking.NetworkProtocol.Application request, grpc::ServerCallContext context)
Expand All @@ -64,7 +65,7 @@ public partial class ApplicationRegisterServiceClient : grpc::ClientBase<Applica
{
/// <summary>Creates a new client for ApplicationRegisterService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public ApplicationRegisterServiceClient(grpc::Channel channel) : base(channel)
public ApplicationRegisterServiceClient(grpc::ChannelBase channel) : base(channel)
{
}
/// <summary>Creates a new client for ApplicationRegisterService that uses a custom <c>CallInvoker</c>.</summary>
Expand Down Expand Up @@ -113,13 +114,13 @@ protected override ApplicationRegisterServiceClient NewInstance(ClientBaseConfig
.AddMethod(__Method_applicationCodeRegister, serviceImpl.applicationCodeRegister).Build();
}

/// <summary>Register service method implementations with a service binder. Useful when customizing the service binding logic.
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
/// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
/// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static void BindService(grpc::ServiceBinderBase serviceBinder, ApplicationRegisterServiceBase serviceImpl)
{
serviceBinder.AddMethod(__Method_applicationCodeRegister, serviceImpl.applicationCodeRegister);
serviceBinder.AddMethod(__Method_applicationCodeRegister, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::SkyWalking.NetworkProtocol.Application, global::SkyWalking.NetworkProtocol.ApplicationMapping>(serviceImpl.applicationCodeRegister));
}

}
Expand Down
18 changes: 9 additions & 9 deletions src/Surging.Apm/SkyApm.Transport.Grpc.Protocol/generated/CLR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,19 @@ public sealed partial class CLRMetric : pb::IMessage<CLRMetric> {
}
if (other.cpu_ != null) {
if (cpu_ == null) {
cpu_ = new global::SkyWalking.NetworkProtocol.CPU();
Cpu = new global::SkyWalking.NetworkProtocol.CPU();
}
Cpu.MergeFrom(other.Cpu);
}
if (other.gc_ != null) {
if (gc_ == null) {
gc_ = new global::SkyWalking.NetworkProtocol.ClrGC();
Gc = new global::SkyWalking.NetworkProtocol.ClrGC();
}
Gc.MergeFrom(other.Gc);
}
if (other.thread_ != null) {
if (thread_ == null) {
thread_ = new global::SkyWalking.NetworkProtocol.ClrThread();
Thread = new global::SkyWalking.NetworkProtocol.ClrThread();
}
Thread.MergeFrom(other.Thread);
}
Expand All @@ -253,23 +253,23 @@ public sealed partial class CLRMetric : pb::IMessage<CLRMetric> {
}
case 18: {
if (cpu_ == null) {
cpu_ = new global::SkyWalking.NetworkProtocol.CPU();
Cpu = new global::SkyWalking.NetworkProtocol.CPU();
}
input.ReadMessage(cpu_);
input.ReadMessage(Cpu);
break;
}
case 26: {
if (gc_ == null) {
gc_ = new global::SkyWalking.NetworkProtocol.ClrGC();
Gc = new global::SkyWalking.NetworkProtocol.ClrGC();
}
input.ReadMessage(gc_);
input.ReadMessage(Gc);
break;
}
case 34: {
if (thread_ == null) {
thread_ = new global::SkyWalking.NetworkProtocol.ClrThread();
Thread = new global::SkyWalking.NetworkProtocol.ClrThread();
}
input.ReadMessage(thread_);
input.ReadMessage(Thread);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static partial class CLRMetricReportService
}

/// <summary>Base class for server-side implementations of CLRMetricReportService</summary>
[grpc::BindServiceMethod(typeof(CLRMetricReportService), "BindService")]
public abstract partial class CLRMetricReportServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::SkyWalking.NetworkProtocol.Commands> collect(global::SkyWalking.NetworkProtocol.CLRMetricCollection request, grpc::ServerCallContext context)
Expand All @@ -61,7 +62,7 @@ public partial class CLRMetricReportServiceClient : grpc::ClientBase<CLRMetricRe
{
/// <summary>Creates a new client for CLRMetricReportService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public CLRMetricReportServiceClient(grpc::Channel channel) : base(channel)
public CLRMetricReportServiceClient(grpc::ChannelBase channel) : base(channel)
{
}
/// <summary>Creates a new client for CLRMetricReportService that uses a custom <c>CallInvoker</c>.</summary>
Expand Down Expand Up @@ -110,13 +111,13 @@ protected override CLRMetricReportServiceClient NewInstance(ClientBaseConfigurat
.AddMethod(__Method_collect, serviceImpl.collect).Build();
}

/// <summary>Register service method implementations with a service binder. Useful when customizing the service binding logic.
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
/// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
/// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static void BindService(grpc::ServiceBinderBase serviceBinder, CLRMetricReportServiceBase serviceImpl)
{
serviceBinder.AddMethod(__Method_collect, serviceImpl.collect);
serviceBinder.AddMethod(__Method_collect, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::SkyWalking.NetworkProtocol.CLRMetricCollection, global::SkyWalking.NetworkProtocol.Commands>(serviceImpl.collect));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public sealed partial class ApplicationInstance : pb::IMessage<ApplicationInstan
}
if (other.osinfo_ != null) {
if (osinfo_ == null) {
osinfo_ = new global::SkyWalking.NetworkProtocol.OSInfo();
Osinfo = new global::SkyWalking.NetworkProtocol.OSInfo();
}
Osinfo.MergeFrom(other.Osinfo);
}
Expand Down Expand Up @@ -279,9 +279,9 @@ public sealed partial class ApplicationInstance : pb::IMessage<ApplicationInstan
}
case 34: {
if (osinfo_ == null) {
osinfo_ = new global::SkyWalking.NetworkProtocol.OSInfo();
Osinfo = new global::SkyWalking.NetworkProtocol.OSInfo();
}
input.ReadMessage(osinfo_);
input.ReadMessage(Osinfo);
break;
}
}
Expand Down Expand Up @@ -626,7 +626,7 @@ public sealed partial class ApplicationInstanceRecover : pb::IMessage<Applicatio
}
if (other.osinfo_ != null) {
if (osinfo_ == null) {
osinfo_ = new global::SkyWalking.NetworkProtocol.OSInfo();
Osinfo = new global::SkyWalking.NetworkProtocol.OSInfo();
}
Osinfo.MergeFrom(other.Osinfo);
}
Expand Down Expand Up @@ -655,9 +655,9 @@ public sealed partial class ApplicationInstanceRecover : pb::IMessage<Applicatio
}
case 34: {
if (osinfo_ == null) {
osinfo_ = new global::SkyWalking.NetworkProtocol.OSInfo();
Osinfo = new global::SkyWalking.NetworkProtocol.OSInfo();
}
input.ReadMessage(osinfo_);
input.ReadMessage(Osinfo);
break;
}
}
Expand Down Expand Up @@ -1401,7 +1401,7 @@ public sealed partial class ServiceNameMappingElement : pb::IMessage<ServiceName
}
if (other.element_ != null) {
if (element_ == null) {
element_ = new global::SkyWalking.NetworkProtocol.ServiceNameElement();
Element = new global::SkyWalking.NetworkProtocol.ServiceNameElement();
}
Element.MergeFrom(other.Element);
}
Expand All @@ -1422,9 +1422,9 @@ public sealed partial class ServiceNameMappingElement : pb::IMessage<ServiceName
}
case 18: {
if (element_ == null) {
element_ = new global::SkyWalking.NetworkProtocol.ServiceNameElement();
Element = new global::SkyWalking.NetworkProtocol.ServiceNameElement();
}
input.ReadMessage(element_);
input.ReadMessage(Element);
break;
}
}
Expand Down Expand Up @@ -1609,7 +1609,7 @@ public sealed partial class ServiceNameElement : pb::IMessage<ServiceNameElement
break;
}
case 24: {
srcSpanType_ = (global::SkyWalking.NetworkProtocol.SpanType) input.ReadEnum();
SrcSpanType = (global::SkyWalking.NetworkProtocol.SpanType) input.ReadEnum();
break;
}
}
Expand Down

0 comments on commit 6ab1da0

Please sign in to comment.