skyapm / skyapm-dotnet Goto Github PK
View Code? Open in Web Editor NEWThe .NET/.NET Core instrument agent for Apache SkyWalking
License: Apache License 2.0
The .NET/.NET Core instrument agent for Apache SkyWalking
License: Apache License 2.0
Please answer these questions before submitting your issue.
many people use Dapper , we should adopt that.
Please answer these questions before submitting your issue.
Support corefx built-in SqlClient. System.Data.SqlClient provides the data provider for SQL Server.
Please answer these questions before submitting your issue.
我们应用中使用skywalking中遇上一个异常,这个异常不定时出现。出现时的场景大概是这样的,asp.net core应用,在一个mvc的action中使用HttpClient/HttpWebRequest去发起一个http请求,发起的http请求就会报错,具体异常信息如下。
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added. Key: status_code
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(Object key)
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at SkyWalking.Context.Trace.AbstractTracingSpan.Tag(String key, String value) at SkyWalking.Context.Trace.ExitSpan.Tag(String key, String value) at SkyWalking.Context.Tag.StringTag.Set(ISpan span, String tagValue) at SkyWalking.Diagnostics.HttpClient.HttpClientDiagnosticProcessor.HttpResponse(HttpResponseMessage response) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at SkyWalking.Diagnostics.TracingDiagnosticMethod.Invoke(String diagnosticName, Object value) at SkyWalking.Diagnostics.TracingDiagnosticObserver.OnNext(KeyValuePair
2 value)
at System.Diagnostics.DiagnosticListener.Write(String name, Object value)
at System.Net.Http.DiagnosticsHandler.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Net.Http.HttpClient.d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at publish_helper.HttpUtils.d__0.MoveNext()
Hi all.
SkyWalking has a place to share with community with articles, speeches and videos related to SkyWalking and its ecosystem.
https://github.com/OpenSkywalking/Community
I think your people have some things to share.
Please answer these questions before submitting your issue.
netcore2.0中,api请求中head里面带有Authorization 时候追踪不到请求记录,不带Authorization 的时候就可以追踪到
Ocelot网关集成sk后端的服务不能发现
NetCore集成SK使用httpClientFactory调用api出现异常
HttpRequestException: Request headers must contain only ASCII characters.
System.Net.Http.HttpConnection.WriteStringAsync(string s)
如果把Startup中的SK代码注了就能正常运行
public async Task<string> A()
{
var client = _httpClientFactory.CreateClient();
client.BaseAddress = new Uri("http://127.0.0.1:9000");
client.DefaultRequestHeaders.Add("charset", "utf-8");
string result = await client.GetStringAsync("/api/service2/values");
return result;
}
I'm using skywalking in docker,and exposed the ports:10800、11800、12800.
When I start the sample project of skywalking-netcore,it fails at the first connection,and the follows connections are ok,as below:
But it can not work to send trace data to Skywalking.
I debugged the code ,and find that the state of the Channel is alwayes Idle,and Application can not registerd.
It may be something wrong with my environment,but I really can't solve the problem.
So,could you master give a help?
Thanks a lot!
Please answer these questions before submitting your issue.
In the CLR, the profiling API is used to write a code profiler, which is a program that monitors the execution of a managed application. We can use the JIT recompilation methods in the ICorProfilerCallback4 interface, to insert SkyWalking's tracing logic in the target method. For SkyWalking .NET Core Agent, this will be a very important change, realizing automatic proxy means that SkyWalking-NetCore will be comparable to some commercial APM products.
.netframework 4.6.1 ,要想使这个要怎么配置,demo我这边跑不起来。
Please answer these questions before submitting your issue.
Based on this review: #1 (review)
services.AddSkyWalking(option =>
{
option.DirectServers = "My IP:11800";
option.ApplicationCode = "Com.Ejsino.WebApi.ServiceGateway";
});
2018-09-18 11:07:49,137 [13] INFO Com.Ejsino.WebApi.ServiceGateway.Startup - Grpc channel connect timeout. Reached deadline.
warn: SkyWalking.Remote.GrpcConnection[0]
Grpc channel connect timeout. Reached deadline.
2018-09-18 11:08:09,205 [14] INFO Com.Ejsino.WebApi.ServiceGateway.Startup - Grpc channel connect timeout. Reached deadline.
Please answer these questions before submitting your issue.
Please answer these questions before submitting your issue.
Currently our sampling mechanism only supports match the first N trace segments in the certain time window. But in some cases, we want to get more balanced sampling, such as percentage-based sampling, so we need to restructure SamplingService
to provide multiple sampling implementations for the user to choose.
Hello there,thanks for your great job.
We have a case that all our requests point to only one controller and action,something like "http://ip:port/Common/Service",and we use reflection to invoke special method depending on parameters provided by HttpRequest body.
So it causes a thing that in SW UI,all request uri are like the same,except the ip and port.
And it is hard to find out the invoke trace easily.
It can be solved by seperate the controller and action for each api,but we have lots of old codes and it's too hard to do this.
So is it possible that we have a chance to modify the request uri before setting the Tags.Url?
Maybe something like a Func?
Please think about the case ,thanks!
On Windows/Mac/Linux,we can use it by
dotnet tool install -g SkyWalking.DotNet.CLI
but docker dotnet-runtime not contains dotnet SDK.
that will get this error.
Step 11/12 : RUN dotnet tool install -g SkyWalking.DotNet.CLI
---> Running in b5e22d93ce49
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
The command '/bin/sh -c dotnet tool install -g SkyWalking.DotNet.CLI' returned a non-zero code: 145
What should I do?
EnrtySpan
to specify to ignore this request.When I reimplement HostingDiagnosticProcessor
, I can use some rules to determine if it is necessary to record the request.
Get the Custom Attribute
on the Action through the ActionDescriptor
in Microsoft.AspNetCore.Mvc.BeforeAction
. It is logged when there is a Custom Attribute
, and the Min Duration
can be defined in a Custom Attribute
. If it is lower than this threshold, it will be ignored.
So I may also need to have a property to access Span's EndTime
or Duration
.
NetCore 2.1.1 + 阿里云 CentOS 容器 + SqlServer
经过测试发现(高并发下):
1、直接Http访问无问题。
2、直接Http访问+业务处理无问题
3、Http访问+业务处理+Sqlserver操作。出现如下错误:
Microsoft.AspNetCore.Server.Kestrel[0] Connection processing ended abnormally. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: No active span. at SkyWalking.Context.TracingContext.InternalActiveSpan() at SkyWalking.AspNetCore.Diagnostics.HostingDiagnosticProcessor.EndRequest(HttpContext httpContext) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at SkyWalking.Diagnostics.TracingDiagnosticMethod.Invoke(String diagnosticName, Object value) at SkyWalking.Diagnostics.TracingDiagnosticObserver.OnNext(KeyValuePair
2 value)
at System.Diagnostics.DiagnosticListener.Write(String name, Object value)
at Microsoft.AspNetCore.Hosting.Internal.HostingApplicationDiagnostics.RecordEndRequestDiagnostics(HttpContext httpContext, Int64 currentTimestamp)
at Microsoft.AspNetCore.Hosting.Internal.HostingApplication.DisposeContext(Context context, Exception exception)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication
1 application)`
Support Microsoft EntityFrameworkCore
Please answer these questions before submitting your issue.
There is a situation that we have many nodes would submit the data to central service, there were be slowly or fast, we did't found the slowly request where does it from? Why does it be slowly?
If we can collect the original datas from request, the client ip, that it will be a easy way to improve our system.
Otherwise, we are also like to collect the stacktrace when a exception thrown.
Sincerely hope that features will be provided.
Best wish to Skywalking Team!
Thanks!
Please answer these questions before submitting your issue.
Please answer these questions before submitting your issue.
Stopwatch.GetTimestamp() - 62135596800000L
来代替 DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
来记录时间戳?这样时间精度高,耗时记录的也更准确些。在windows下非C盘使用dotnet skywalking install会报错,应该是Windows下cd不能切盘符导致的。
log:
*
Welcome to Apache SkyWalking *
*
Installing SkyWalking .NET Core Agent ...
Create tmp directory 'C:\Users\chen.ganshen\AppData\Local\Temp\skywalking.agent.aspnetcore'
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
D:\Projects\skywalking-netcore-master\skywalking-netcore-master\cli\SkyWalking.DotNet.CLI\bin\Debug\netcoreapp2.1>git clone https://github.com/OpenSkywalking/skywalking-netcore-hosting-startup.git C:\Users\chen.ganshen\AppData\Local\Temp\skywalking.agent.aspnetcore\repo
Cloning into 'C:\Users\chen.ganshen\AppData\Local\Temp\skywalking.agent.aspnetcore\repo'...
D:\Projects\skywalking-netcore-master\skywalking-netcore-master\cli\SkyWalking.DotNet.CLI\bin\Debug\netcoreapp2.1>cd C:\Users\chen.ganshen\AppData\Local\Temp\skywalking.agent.aspnetcore\repo\manifest
D:\Projects\skywalking-netcore-master\skywalking-netcore-master\cli\SkyWalking.DotNet.CLI\bin\Debug\netcoreapp2.1>dotnet build --configuration Release --verbosity q -nowarn:NU1701
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
D:\Projects\skywalking-netcore-master\skywalking-netcore-master\cli\SkyWalking.DotNet.CLI\bin\Debug\netcoreapp2.1>dotnet store --manifest SkyWalking.Runtime.Store.csproj --framework netcoreapp2.1 --output C:\Progra~1\dotnet\store --runtime win-x64 --skip-symbols --verbosity q -nowarn:NU1701
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: SkyWalking.Runtime.Store.csproj
D:\Projects\skywalking-netcore-master\skywalking-netcore-master\cli\SkyWalking.DotNet.CLI\bin\Debug\netcoreapp2.1>exit
Update README.md to guide interested prople to join our gitter? and License, related project, etc.
Based on review: #1 (comment)
在使用 await Task.WhenAll 发起http请求时,偶尔抛出 No active span 异常。
具体异常信息如下:
InvalidOperationException: No active span.
SkyWalking.Context.TracingContext.InternalActiveSpan()
SkyWalking.Diagnostics.HttpClient.HttpClientTracingDiagnosticProcessor.HttpResponse(HttpResponseMessage response)
Show raw exception details
System.InvalidOperationException: No active span.
at SkyWalking.Context.TracingContext.InternalActiveSpan()
at SkyWalking.Diagnostics.HttpClient.HttpClientTracingDiagnosticProcessor.HttpResponse(HttpResponseMessage response)
TargetInvocationException: Exception has been thrown by the target of an invocation.
System.RuntimeMethodHandle.InvokeMethod(object target, object[] arguments, Signature sig, bool constructor, bool wrapExceptions)
System.Reflection.RuntimeMethodInfo.Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
SkyWalking.Diagnostics.TracingDiagnosticMethod.Invoke(string diagnosticName, object value)
SkyWalking.Diagnostics.TracingDiagnosticObserver.OnNext(KeyValuePair<string, object> value)
System.Diagnostics.DiagnosticListener.Write(string name, object value)
System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task sendTask, HttpRequestMessage request, CancellationTokenSource cts, bool disposeCts)
SyncSoft.App.Http.HttpClientBase.SendAsync(HttpRequestMessage requestMessage) in HttpClientBase.cs
SyncSoft.App.Http.HttpClientBase.SendAsync(HttpAuthorization authorization, HttpMethod httpMethod, Uri uri, object data) in HttpClientBase.cs
SyncSoft.App.Http.HttpClientBase.PostAsync(HttpAuthorization authorization, Uri uri, object data) in HttpClientBase.cs
SyncSoft.App.WebApi.DefaultApiClient.PostAsync(BearerAuthModeEnum authMode, Uri uri, object data) in DefaultApiClient.cs
SyncSoft.App.WebApi.Proxies.ApiProxyBase.PostAsync(BearerAuthModeEnum authMode, string relativeUri, object data) in ApiProxyBase.cs
SyncSoft.LIVNCo.Web.Areas.Product.Models.Family.FamilyDetailModel.SearchFamilyDetailAsync() in FamilyDetailModel.cs
+
await Task.WhenAll(getProductFamily, getSimpleFamily, getBreadcrumbs).ConfigureAwait(false);
SyncSoft.LIVNCo.Web.Areas.Product.Controllers.FamilyController.Detail(FamilyDetailModel model) in FamilyController.cs
+
await model.SearchFamilyDetailAsync();
Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor+TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)
System.Threading.Tasks.ValueTask.get_Result()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
SyncSoft.ECP.AspNetCore.Middlewares.RouteDataMiddleware.Invoke(HttpContext httpContext) in RouteDataMiddleware.cs
SyncSoft.ECP.AspNetCore.Middlewares.ObjectContainerScopeMiddleware.Invoke(HttpContext context) in ObjectContainerScopeMiddleware.cs
SyncSoft.ECP.AspNetCore.Middlewares.RouteDataMiddleware.Invoke(HttpContext httpContext) in RouteDataMiddleware.cs
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
SyncSoft.ECP.AspNetCore.Middlewares.UnauthorizedAjaxHandleMiddleware.Invoke(HttpContext httpContext) in UnauthorizedAjaxHandleMiddleware.cs
SyncSoft.ECP.AspNetCore.Middlewares.AuthEndpointsMiddleware.Invoke(HttpContext httpContext) in AuthEndpointsMiddleware.cs
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Please answer these questions before submitting your issue.
I suggest to register your internal components with scoped lifestyle to the DI,
then create scope for every context and use them.
请问配置文件能控制关闭和开启么?
Please answer these questions before submitting your issue.
Do you have any plan to support collect some basic info in the future? Like cpu, memory, io, GC eg..
If it's public, we can install SkyWalking. Agent. AspNetCore via the nuget package, use services.AddSkyWalkingCore () in ConfigureServices.
public void ConfigureServices(IServiceCollection services)
{
services.AddSkyWalkingCore();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
skywaliking 可以设置哪些请求不需要追踪吗?比如以下的
向注册中心拉取服务列表
向配置中心拉取配置
向各基础组件发送心跳等
hi friends , it's a great soft,
now ,i have a problem :'no space left on device'
when the history is to much ,how to remove ?
Add logging module to record internal events of agent.
TLS is very helpful when you want to uplink data through Internet. TLS has support in Java agent, doc: https://github.com/apache/incubator-skywalking/blob/master/docs/en/TLS.md
A large number of offline services in our current project are using rabbitMQ. Now C#/.NET instrument agent does not support common queues. I hope skywalking's netcore agent can support this.
Sync Java agent feature, ref doc: https://github.com/apache/incubator-skywalking/blob/master/docs/en/Token-auth.md
Please answer these questions before submitting your issue.
Platform: Windows 10 x64 17134.376
dotnet --version
2.1.500
skywalking store: C:\Program Files\dotnet\store
skywalking deps: C:\Program Files\dotnet\x64\additionalDeps\skywalking.agent.aspnetcore
code is here: https://github.com/MaiReo/skysample
I was followed the "Getting Started" section at README. but i got
D:\Repos\dev\sky_sample>set ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=SkyWalking.Agent.AspNetCore
D:\Repos\dev\sky_sample>set DOTNET_ADDITIONAL_DEPS="C:\Program Files\dotnet\x64\additionalDeps\skywalking.agent.aspnetcore"
D:\Repos\dev\sky_sample>dotnet run
从 D:\Repos\dev\sky_sample\Properties\launchSettings.json 使用启动设置...
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\MaiReo\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Development
Content root path: D:\Repos\dev\sky_sample
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[11]
Hosting startup assembly exception
System.InvalidOperationException: Startup assembly SkyWalking.Agent.AspNetCore failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'SkyWalking.Agent.AspNetCore, Culture=neutral, PublicKeyToken=null'. 系统找不到指定的文件。
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
--- End of inner exception stack trace ---
Please answer these questions before submitting your issue.
Which version of SkyWalking, OS and .NET Runtime?
Which company or project?
What happen?
If possible, provide a way for reproducing the error. e.g. demo application, component version.
This requirement came from the upgrade, SkyWalking's agent and protocol are stable enough, and didn't need to update for a long time. But considering right now, there are a lot of buffer in agent, so end users must reboot the monitored applications to upgrade backend, which caused by backend upgrade is not forward-compatible.
By having this feature, the backend break upgrade should be:
- Stop all backends.
- Clear the ElasticSearch data.
- Set all flush file to true, and wait all agents refreshed and updated the new refresh time.
- Start up new version collector.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.