在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例一般编程问题 → zipkin4net介绍:.NET环境下的Zipkin客户端库使用指南

zipkin4net介绍:.NET环境下的Zipkin客户端库使用指南

一般编程问题

下载此实例
  • 开发语言:Others
  • 实例大小:0.29M
  • 下载次数:0
  • 浏览次数:7
  • 发布时间:2024-04-16
  • 实例类别:一般编程问题
  • 发 布 人:chenxiaolan
  • 文件格式:.zip
  • 所需积分:2
 相关标签:

实例介绍

【实例简介】
openzipkin是一个专为.NET环境设计的Zipkin客户端库,旨在帮助开发者在.NET应用中轻松实现服务追踪功能。它提供了一系列核心功能,包括追踪原语(如spans、annotations等)、异步追踪数据发送、追踪传输抽象等。

要开始使用这个库,首先需要初始化并注册一个ZipkinTracer实例。示例如下:
var logger = CreateLogger(); // 实现ILogger接口
var sender = CreateYourTransport(); // 实现IZipkinSender接口

TraceManager.SamplingRate = 1.0f; // 开启全量追踪

var tracer = new ZipkinTracer(sender);
TraceManager.RegisterTracer(tracer);
TraceManager.Start(logger);

// 运行你的应用

// 应用关闭时
TraceManager.Stop();
创建新的追踪或者记录注解都非常简单,例如:
var trace = Trace.Create();
trace.Record(Annotations.ServerRecv());
trace.Record(Annotations.ServiceName(serviceName));
trace.Record(Annotations.Rpc("GET"));
trace.Record(Annotations.ServerSend());
trace.Record(Annotations.Tag("http.url", "<url>"));
此外,openzipkin支持多种追踪数据的传输方式,包括HTTP传输和自定义传输实现。例如,通过HTTP传输追踪数据到Zipkin收集器,或者通过实现Send(byte[])方法来自定义追踪数据的传输逻辑。

openzipkin还提供了高级功能,如追踪器监控、B3头部传播、强制采样等,以满足更复杂的追踪需求。使用这些高级功能可以帮助开发者更好地控制和优化追踪过程,确保追踪数据的准确性和有效性。
【实例截图】
【核心代码】
文件清单
└── zipkin4net-63976c5325f36c38df3a3b237f10a9ac2e33f482
    ├── appveyor.yml
    ├── build.cmd
    ├── build.sh
    ├── Examples
    │   ├── aspnetcore
    │   │   ├── aspnetcore-example.sln
    │   │   ├── backend
    │   │   │   ├── appSettings.json
    │   │   │   ├── backend.csproj
    │   │   │   ├── Program.cs
    │   │   │   └── Startup.cs
    │   │   ├── common
    │   │   │   ├── common.csproj
    │   │   │   ├── CommonStartup.cs
    │   │   │   ├── ConfigureSettings.cs
    │   │   │   └── Settings.cs
    │   │   ├── frontend
    │   │   │   ├── appSettings.json
    │   │   │   ├── frontend.csproj
    │   │   │   ├── Program.cs
    │   │   │   └── Startup.cs
    │   │   └── README.md
    │   ├── async.spans
    │   │   ├── example.message.center
    │   │   │   ├── appsettings.Development.json
    │   │   │   ├── appsettings.json
    │   │   │   ├── Controllers
    │   │   │   │   ├── MessagesController.cs
    │   │   │   │   └── WelcomeController.cs
    │   │   │   ├── example.message.center.csproj
    │   │   │   ├── Program.cs
    │   │   │   ├── Properties
    │   │   │   │   └── launchSettings.json
    │   │   │   └── Startup.cs
    │   │   ├── example.message.common
    │   │   │   ├── example.message.common.csproj
    │   │   │   ├── Message.cs
    │   │   │   ├── ZipkinConsoleLogger.cs
    │   │   │   └── ZipkinHelper.cs
    │   │   ├── example.message.consumer
    │   │   │   ├── example.message.consumer.csproj
    │   │   │   ├── Program.cs
    │   │   │   └── Properties
    │   │   │       └── launchSettings.json
    │   │   ├── example.message.producer
    │   │   │   ├── example.message.producer.csproj
    │   │   │   ├── Program.cs
    │   │   │   └── Properties
    │   │   │       └── launchSettings.json
    │   │   ├── images
    │   │   │   ├── run-example.message.center.PNG
    │   │   │   ├── run-example.message.consumer.PNG
    │   │   │   ├── run-example.message.producer.PNG
    │   │   │   └── run-example-output.PNG
    │   │   └── README.md
    │   └── owin
    │       ├── backend
    │       │   ├── App.config
    │       │   ├── example.owin.backend.csproj
    │       │   ├── packages.config
    │       │   ├── Program.cs
    │       │   ├── Properties
    │       │   │   └── AssemblyInfo.cs
    │       │   └── Startup.cs
    │       ├── common
    │       │   ├── app.config
    │       │   ├── CommonStartup.cs
    │       │   ├── ConsoleLogger.cs
    │       │   ├── example.owin.common.csproj
    │       │   ├── packages.config
    │       │   └── Properties
    │       │       └── AssemblyInfo.cs
    │       ├── frontend
    │       │   ├── App.config
    │       │   ├── example.owin.frontend.csproj
    │       │   ├── packages.config
    │       │   ├── Program.cs
    │       │   ├── Properties
    │       │   │   └── AssemblyInfo.cs
    │       │   └── Startup.cs
    │       ├── owin-example.sln
    │       ├── README.md
    │       └── run.cmd
    ├── LICENSE
    ├── README.md
    ├── release.sh
    ├── Src
    │   ├── zipkin4net
    │   │   ├── Benchmark
    │   │   │   ├── Program.cs
    │   │   │   ├── README.md
    │   │   │   ├── Tracers
    │   │   │   │   └── Zipkin
    │   │   │   │       ├── jsondotnet
    │   │   │   │       │   └── JsonDotNetSerializer.cs
    │   │   │   │       ├── JSONSerializerBenchmark.cs
    │   │   │   │       ├── Spans.cs
    │   │   │   │       └── ThriftSerializerBenchmark.cs
    │   │   │   └── zipkin4net.Benchmark.csproj
    │   │   ├── Src
    │   │   │   ├── Annotation
    │   │   │   │   ├── Addr.cs
    │   │   │   │   ├── ClientAddr.cs
    │   │   │   │   ├── ClientRecv.cs
    │   │   │   │   ├── ClientSend.cs
    │   │   │   │   ├── CommonTags.cs
    │   │   │   │   ├── ConsumerStart.cs
    │   │   │   │   ├── ConsumerStop.cs
    │   │   │   │   ├── Event.cs
    │   │   │   │   ├── IAnnotation.cs
    │   │   │   │   ├── IAnnotationVisitor.cs
    │   │   │   │   ├── LocalAddr.cs
    │   │   │   │   ├── LocalOperationStart.cs
    │   │   │   │   ├── LocalOperationStop.cs
    │   │   │   │   ├── MessageAddr.cs
    │   │   │   │   ├── ProducerStart.cs
    │   │   │   │   ├── ProducerStop.cs
    │   │   │   │   ├── Rpc.cs
    │   │   │   │   ├── ServerAddr.cs
    │   │   │   │   ├── ServerRecv.cs
    │   │   │   │   ├── ServerSend.cs
    │   │   │   │   ├── ServiceName.cs
    │   │   │   │   ├── TagAnnotation.cs
    │   │   │   │   ├── WireRecv.cs
    │   │   │   │   └── WireSend.cs
    │   │   │   ├── Annotations.cs
    │   │   │   ├── BaseStandardTrace.cs
    │   │   │   ├── ClientTrace.cs
    │   │   │   ├── ClientTraceFactory.cs
    │   │   │   ├── ConsumerTrace.cs
    │   │   │   ├── Dispatcher
    │   │   │   │   ├── InOrderAsyncActionBlockDispatcher.cs
    │   │   │   │   ├── InOrderAsyncQueueDispatcher.cs
    │   │   │   │   ├── IRecordDispatcher.cs
    │   │   │   │   └── VoidDispatcher.cs
    │   │   │   ├── IClientTraceFactory.cs
    │   │   │   ├── ILogger.cs
    │   │   │   ├── Internal
    │   │   │   │   ├── Recorder
    │   │   │   │   │   ├── IReporter.cs
    │   │   │   │   │   └── MutableSpanMap.cs
    │   │   │   │   └── V2
    │   │   │   │       ├── Annotation.cs
    │   │   │   │       ├── Endpoint.cs
    │   │   │   │       └── Span.cs
    │   │   │   ├── ISamplingFlags.cs
    │   │   │   ├── IServerTraceFactory.cs
    │   │   │   ├── ITraceContext.cs
    │   │   │   ├── ITracer.cs
    │   │   │   ├── Logger
    │   │   │   │   └── VoidLogger.cs
    │   │   │   ├── packages.config
    │   │   │   ├── ProducerTrace.cs
    │   │   │   ├── Propagation
    │   │   │   │   ├── B3Extractor.cs
    │   │   │   │   ├── B3Injector.cs
    │   │   │   │   ├── B3Propagation.cs
    │   │   │   │   ├── B3SingleExtractor.cs
    │   │   │   │   ├── B3SingleFormat.cs
    │   │   │   │   ├── B3SingleInjector.cs
    │   │   │   │   ├── B3SinglePropagation.cs
    │   │   │   │   ├── ExtractorHelper.cs
    │   │   │   │   ├── ExtraFieldPropagation.cs
    │   │   │   │   ├── IExtractor.cs
    │   │   │   │   ├── IInjector.cs
    │   │   │   │   ├── InjectorHelper.cs
    │   │   │   │   ├── IPropagation.cs
    │   │   │   │   ├── KeyFactories.cs
    │   │   │   │   └── Propagations.cs
    │   │   │   ├── Properties
    │   │   │   │   └── AssemblyInfo.cs
    │   │   │   ├── Record.cs
    │   │   │   ├── Sampling
    │   │   │   │   ├── DefaultSampler.cs
    │   │   │   │   └── ISampler.cs
    │   │   │   ├── ServerTrace.cs
    │   │   │   ├── ServerTraceFactory.cs
    │   │   │   ├── SpanState.cs
    │   │   │   ├── TraceContext.cs
    │   │   │   ├── Trace.cs
    │   │   │   ├── TraceManager.cs
    │   │   │   ├── Trace.netfw.cs
    │   │   │   ├── Tracers
    │   │   │   │   ├── ConsoleTracer.cs
    │   │   │   │   ├── InMemoryTracer.cs
    │   │   │   │   ├── VoidTracer.cs
    │   │   │   │   └── Zipkin
    │   │   │   │       ├── BinaryAnnotation.cs
    │   │   │   │       ├── BinaryAnnotationValueEncoder.cs
    │   │   │   │       ├── ISpanSerializer.cs
    │   │   │   │       ├── IZipkinSender.cs
    │   │   │   │       ├── JSONSpanSerializer.cs
    │   │   │   │       ├── RateLimiterZipkinSender.cs
    │   │   │   │       ├── SerializerUtils.cs
    │   │   │   │       ├── Span.cs
    │   │   │   │       ├── Statistics.cs
    │   │   │   │       ├── thrift_gen
    │   │   │   │       │   └── gen-csharp
    │   │   │   │       │       └── zipkin4net
    │   │   │   │       │           └── Tracers
    │   │   │   │       │               └── Zipkin
    │   │   │   │       │                   └── Thrift
    │   │   │   │       │                       ├── Annotation.cs
    │   │   │   │       │                       ├── AnnotationType.cs
    │   │   │   │       │                       ├── BinaryAnnotation.cs
    │   │   │   │       │                       ├── Endpoint.cs
    │   │   │   │       │                       ├── Span.cs
    │   │   │   │       │                       └── zipkinCore.Constants.cs
    │   │   │   │       ├── ThriftSpanSerializer.cs
    │   │   │   │       ├── ZipkinAnnotation.cs
    │   │   │   │       ├── ZipkinAnnotationVisitor.cs
    │   │   │   │       ├── zipkinCore.thrift
    │   │   │   │       ├── ZipkinTracer.cs
    │   │   │   │       └── ZipkinTracerReporter.cs
    │   │   │   ├── Transport
    │   │   │   │   ├── Http
    │   │   │   │   │   ├── HttpZipkinSender.cs
    │   │   │   │   │   └── TracingHandler.cs
    │   │   │   │   ├── ITraceExtractor.cs
    │   │   │   │   ├── ITraceInjector.cs
    │   │   │   │   ├── ZipkinHttpHeaders.cs
    │   │   │   │   ├── ZipkinHttpTraceExtractor.cs
    │   │   │   │   └── ZipkinHttpTraceInjector.cs
    │   │   │   ├── Utils
    │   │   │   │   ├── HighResolutionDateTime.cs
    │   │   │   │   ├── IpUtils.cs
    │   │   │   │   ├── NumberUtils.cs
    │   │   │   │   ├── RandomUtils.cs
    │   │   │   │   └── TimeUtils.cs
    │   │   │   └── zipkin4net.csproj
    │   │   ├── Tests
    │   │   │   ├── Dispatchers
    │   │   │   │   └── T_AsyncDispatcher.cs
    │   │   │   ├── Internal
    │   │   │   │   └── Reporter
    │   │   │   │       └── T_MutableSpanMap.cs
    │   │   │   ├── packages.config
    │   │   │   ├── Propagation
    │   │   │   │   ├── T_B3SingleFormat.cs
    │   │   │   │   └── T_ExtraFieldPropagation.cs
    │   │   │   ├── Properties
    │   │   │   │   └── AssemblyInfo.cs
    │   │   │   ├── Sampling
    │   │   │   │   └── T_Sampler.cs
    │   │   │   ├── T_Annotations.cs
    │   │   │   ├── T_BaseStandardTrace.cs
    │   │   │   ├── T_ClientTrace.cs
    │   │   │   ├── T_ConsumerTrace.cs
    │   │   │   ├── T_ProducerTrace.cs
    │   │   │   ├── Tracers
    │   │   │   │   ├── T_InMemoryTracer.cs
    │   │   │   │   └── Zipkin
    │   │   │   │       ├── T_BinaryAnnotationValueEncoder.cs
    │   │   │   │       ├── T_RateLimiter.cs
    │   │   │   │       ├── T_SerializerUtils.cs
    │   │   │   │       ├── T_Span.cs
    │   │   │   │       ├── T_Statistics.cs
    │   │   │   │       ├── T_ThriftSpanSerializer.cs
    │   │   │   │       ├── T_ZipkinAnnotationVisitor.cs
    │   │   │   │       ├── T_ZipkinTracer.cs
    │   │   │   │       └── T_ZipkinTracerReporter.cs
    │   │   │   ├── Transport
    │   │   │   │   ├── Http
    │   │   │   │   │   ├── T_HttpZipkinSender.cs
    │   │   │   │   │   └── T_TracingHandler.cs
    │   │   │   │   ├── T_ZipkinHttpHeaders.cs
    │   │   │   │   ├── T_ZipkinHttpTraceExtractor.cs
    │   │   │   │   ├── T_ZipkinHttpTraceInjector.cs
    │   │   │   │   └── T_ZipkinHttpTraceInjectorExtractor.cs
    │   │   │   ├── T_ServerTrace.cs
    │   │   │   ├── T_SpanState.cs
    │   │   │   ├── T_TraceContext.cs
    │   │   │   ├── T_Trace.cs
    │   │   │   ├── T_TraceManager.cs
    │   │   │   ├── Utils
    │   │   │   │   ├── T_NumberUtils.cs
    │   │   │   │   ├── T_SerializerUtils.cs
    │   │   │   │   └── T_TimeUtils.cs
    │   │   │   └── zipkin4net.Tests.csproj
    │   │   └── zipkin4net.sln
    │   ├── zipkin4net.middleware.aspnetcore
    │   │   ├── Src
    │   │   │   ├── TracingLogger.cs
    │   │   │   ├── TracingMiddleware.cs
    │   │   │   └── zipkin4net.middleware.aspnetcore.csproj
    │   │   └── zipkin4net.middleware.aspnetcore.sln
    │   └── zipkin4net.middleware.owin
    │       ├── Src
    │       │   ├── Extensions
    │       │   │   └── OwinExtensions.cs
    │       │   ├── packages.config
    │       │   ├── Properties
    │       │   │   └── AssemblyInfo.cs
    │       │   ├── zipkin4net.middleware.owin.csproj
    │       │   └── ZipkinMiddleware.cs
    │       ├── Tests
    │       │   ├── app.config
    │       │   ├── Helpers
    │       │   │   ├── CheckHelper.cs
    │       │   │   └── OwinHelper.cs
    │       │   ├── packages.config
    │       │   ├── Properties
    │       │   │   └── AssemblyInfo.cs
    │       │   ├── WhenOwinMiddlewareIsActive.cs
    │       │   └── zipkin4net.middleware.owin.Tests.csproj
    │       └── zipkin4net.middleware.owin.sln
    └── zipkin4net.sln

71 directories, 237 files

标签:

实例下载地址

zipkin4net介绍:.NET环境下的Zipkin客户端库使用指南

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警