public async Task StartAsync(CancellationToken stoppingToken) { _logger.LogInformation("Timed Hosted Service running."); _logger.LogInformation($"Connecting to {_baseAddress}"); _channel = GrpcChannel.ForAddress(_baseAddress); var client = new GrpcDottyLogs.DottyLogs.DottyLogsClient(_channel); _metricsUpdateChannel = client.MetricsUpdate(cancellationToken: stoppingToken); _heatbeatChannel = client.Heartbeat(cancellationToken: stoppingToken); await _heatbeatChannel.RequestStream.WriteAsync(new GrpcDottyLogs.HeartbeatRequest { ApplicationName = Assembly.GetEntryAssembly().GetName().Name, Hostname = Dns.GetHostName() }); _timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromSeconds(1)); }
static async Task Main(string[] args) { var notquit = true; using var channel = GrpcChannel.ForAddress("https://localhost:5001"); var client = new GrpcDottyLogs.DottyLogs.DottyLogsClient(channel); while (notquit) { Console.WriteLine("Press any key to send"); var reply = await client.StartSpanAsync( new GrpcDottyLogs.StartSpanRequest { RequestUrl = "/test-" + new Random().Next(0, 1000), ThreadId = new Random().Next(0, 1000), TraceIdentifier = "121412312" + new Random().Next(0, 1000) }); Console.WriteLine("Sent"); if (Console.ReadKey().Key == ConsoleKey.Q) { notquit = false; } } }
public UpdatePusherService(IOptions <DottyLogLoggerConfiguration> config) { _channel = GrpcChannel.ForAddress(config.Value.DottyAddress); _client = new GrpcDottyLogs.DottyLogs.DottyLogsClient(_channel); }
public DottyLogSink(DottyLogLoggerConfiguration config) { _channel = GrpcChannel.ForAddress(config.DottyAddress); _client = new GrpcDottyLogs.DottyLogs.DottyLogsClient(_channel); }