Beispiel #1
0
        public static async Task <bool> CheckAgentConnectionAsync(string agentUrl)
        {
            var env = new NameValueCollection();

            if (!string.IsNullOrWhiteSpace(agentUrl))
            {
                env["DD_TRACE_AGENT_URL"] = agentUrl;
            }

            var globalSettings = GlobalSettings.CreateDefaultConfigurationSource();

            globalSettings.Add(new NameValueConfigurationSource(env));
            var tracerSettings = new TracerSettings(globalSettings);
            var agentWriter    = new CIAgentWriter(tracerSettings.Build(), new CISampler());

            try
            {
                if (!await agentWriter.Ping().ConfigureAwait(false))
                {
                    WriteError($"Error connecting to the Datadog Agent at {tracerSettings.Exporter.AgentUri}.");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                WriteError($"Error connecting to the Datadog Agent at {tracerSettings.Exporter.AgentUri}.");
                AnsiConsole.WriteException(ex);
                return(false);
            }
            finally
            {
                await agentWriter.FlushAndCloseAsync().ConfigureAwait(false);
            }

            return(true);
        }
        public static SecuritySettings FromDefaultSources()
        {
            var source = GlobalSettings.CreateDefaultConfigurationSource();

            return(new SecuritySettings(source));
        }
Beispiel #3
0
 public static TelemetrySettings FromDefaultSources(ImmutableTracerSettings tracerSettings)
 => new TelemetrySettings(GlobalSettings.CreateDefaultConfigurationSource(), tracerSettings);
 public static TelemetrySettings FromDefaultSources() => FromSource(GlobalSettings.CreateDefaultConfigurationSource());