示例#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);
 }