예제 #1
0
        public ZipkinSpanExporter(
            ILogger <ZipkinSpanExporter> logger,
            string host,
            string serviceName,
            IHttpClientFactory httpClientFactory)
        {
            EnsureArg.IsNotNull(logger, nameof(logger));
            EnsureArg.IsNotNullOrEmpty(serviceName, nameof(serviceName));
            EnsureArg.IsNotNullOrEmpty(host, nameof(host));

            this.logger        = logger;
            this.serviceName   = serviceName;
            this.endpoint      = $"{host}/api/v2/spans";
            this.httpClient    = httpClientFactory.CreateClient("zipkin");
            this.localEndpoint = this.GetLocalZipkinEndpoint();
        }
예제 #2
0
        private ZipkinEndpoint GetLocalZipkinEndpoint()
        {
            var result = new ZipkinEndpoint()
            {
                ServiceName = this.serviceName,
            };

            var hostName = this.ResolveHostName();

            if (!string.IsNullOrEmpty(hostName))
            {
                result.Ipv4 = this.ResolveHostAddress(hostName, AddressFamily.InterNetwork);
                result.Ipv6 = this.ResolveHostAddress(hostName, AddressFamily.InterNetworkV6);
            }

            return(result);
        }
예제 #3
0
 internal Builder RemoteEndpoint(ZipkinEndpoint val)
 {
     this.result.RemoteEndpoint = val;
     return(this);
 }
예제 #4
0
 internal Builder LocalEndpoint(ZipkinEndpoint val)
 {
     this.result.LocalEndpoint = val;
     return(this);
 }