public HttpReportingActor(ZipkinHttpReportingOptions options) { _options = options; PendingMessages = new List <Span>(_options.MaximumBatchSize); var uri = ZipkinHttpApiTransmitter.GetFullZipkinUri(_options.ZipkinUrl); _transmitter = new ZipkinHttpApiTransmitter(new HttpClient(), uri); Batching(); }
/// <summary> /// Performs all of the setup and initialization needed to get the Zipkin HTTP reporting engine up and running. /// </summary> /// <param name="options">The set of options for configuring timeouts and batch sizes.</param> /// <param name="actorSystem"> /// Optional. If using Akka.NET, you can hook your own <see cref="ActorSystem" /> into our /// reporting engine. /// </param> /// <returns></returns> public static ZipkinHttpSpanReporter Create(ZipkinHttpReportingOptions options, ActorSystem actorSystem = null) { // force this component to explode if the end-user screwed up the URI somehow. var uri = ZipkinHttpApiTransmitter.GetFullZipkinUri(options.ZipkinUrl); var weOwnActorSystem = false; if (actorSystem == null) // create our own ActorSystem if it doesn't already exist. { weOwnActorSystem = true; actorSystem = ActorSystem.Create("pbzipkin", options.DebugLogging ? DebugHocon : NormalHocon); } // spawn as a System actor, so in the event of being in a non-owned system our traces get shut down // only after all of the user-defined actors have terminated. var zipkinActor = actorSystem.AsInstanceOf <ExtendedActorSystem>().SystemActorOf( Props.Create(() => new HttpReportingActor(options)), $"zipkin-tracing-{NameCounter.GetAndIncrement()}"); return(new ZipkinHttpSpanReporter(zipkinActor, weOwnActorSystem ? actorSystem : null)); }