手把手教你搭APM之Skywalking搭建指南 (2)

酌情新增 SkyWalking.Diagnostics.EntityFrameworkCore, SkyWalking.Diagnostics.HttpClient, SkyWalking.Diagnostics.EntityFrameworkCore.Npgsql,SkyWalking.Diagnostics.EntityFrameworkCore.Pomelo.MySql 等等...

或者直接在xxx.csproj 新增下面这些包.

<PackageReference Include="SkyWalking.AspNetCore" Version="0.3.0"/> <PackageReference Include="SkyWalking.Diagnostics.EntityFrameworkCore" Version="0.3.0"/> <PackageReference Include="SkyWalking.Diagnostics.HttpClient" Version="0.3.0"/> <PackageReference Include="SkyWalking.Diagnostics.EntityFrameworkCore.Npgsql" Version="0.3.0"/> <PackageReference Include="SkyWalking.Diagnostics.EntityFrameworkCore.Pomelo.MySql" Version="0.3.0"/>

然后在 Startup.cs的ConfigureServices 方法中添加引用

// using SkyWalking.AspNetCore; // using SkyWalking.Diagnostics.EntityFrameworkCore; // using SkyWalking.Diagnostics.HttpClient; // using SkyWalking.Diagnostics.SqlClient; services.AddSkyWalking(option => { option.ApplicationCode = "my-first-api"; option.DirectServers = "127.0.0.1:11800"; // 每三秒采样的Trace数量,-1 为全部采集 option.SamplePer3Secs = -1; }).AddEntityFrameworkCore(c => { c.AddPomeloMysql(); }) .AddHttpClient();

接着启动应用.

看到有类似的日志输入,说明已经应用已经正常连接到SkyWalking了.

info: SkyWalking.Remote.GrpcApplicationService[0] Register application instance success. [applicationInstanceId] = 31 SkyWalking.Remote.GrpcApplicationService:Information: Register application instance success. [applicationInstanceId] = 31 info: SkyWalking.Remote.GrpcApplicationService[0] Register application instance success. [applicationInstanceId] = 31

这时候我们打开

2

可以看到APP已经有数量了.

接着我们访问一下已有的API/Web页面,就能看到对应的信息了.

3

点一下对应的URL.

4

http client请求(其实是查询ES):

5

Topology Map

234

其他的一些功能就看自己玩了.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpsdzs.html