Ejemplo n.º 1
0
        public void ValidateConfig_ValidPort_ShouldNotThrow()
        {
            var config = new Observability();

            config.Prometheus.Enabled = true;
            config.Prometheus.Port    = 8000;
        }
        public void ValidateConfig_Disabled_DoesNotThrow()
        {
            var config = new Observability();

            config.Jaeger.Enabled = false;

            Tracing.ValidateConfig(config);
        }
        public void ValidateConfig_ValidHostPort_DoesNotThrow()
        {
            var config = new Observability();

            config.Jaeger.Enabled   = true;
            config.Jaeger.AgentPort = 8000;
            config.Jaeger.AgentHost = "host";

            Tracing.ValidateConfig(config);
        }
Ejemplo n.º 4
0
        public void ValidateConfig_InvalidPort_Throws([Values(-1, 0)] int port)
        {
            var config = new Observability();

            config.Prometheus.Enabled = true;
            config.Prometheus.Port    = port;

            Action action = () => Metrics.ValidateConfig(config);

            action.Should().Throw <ArgumentException>();
        }
        public void ValidateConfig_InvalidHost_Throws([Values(null, "")] string agentHost)
        {
            var config = new Observability();

            config.Jaeger.Enabled   = true;
            config.Jaeger.AgentPort = 8000;
            config.Jaeger.AgentHost = agentHost;

            Action action = () => Tracing.ValidateConfig(config);

            action.Should().Throw <ArgumentException>();
        }
        public void ValidateConfig_InvalidPort_Throws([Values(-1, 0)] int port)
        {
            var config = new Observability();

            config.Jaeger.Enabled   = true;
            config.Jaeger.AgentPort = port;
            config.Jaeger.AgentHost = "host";

            Action action = () => Tracing.ValidateConfig(config);

            action.Should().Throw <ArgumentException>();
        }
Ejemplo n.º 7
0
        public static void ValidateConfig(Observability config)
        {
            if (!config.Prometheus.Enabled)
            {
                return;
            }

            if (config.Prometheus.Port.HasValue && config.Prometheus.Port <= 0)
            {
                Log.Error("Prometheus Port must be a valid port: {@ConfigSection}.{@ConfigProperty}.", nameof(config), nameof(config.Prometheus.Port));
                throw new ArgumentException("Prometheus port must be greater than 0.", nameof(config.Prometheus.Port));
            }
        }
Ejemplo n.º 8
0
        public static void ValidateConfig(Observability config)
        {
            if (!config.Jaeger.Enabled)
            {
                return;
            }

            if (string.IsNullOrEmpty(config.Jaeger.AgentHost))
            {
                Log.Error("Agent Host must be set: {@ConfigSection}.{@ConfigProperty}.", nameof(config), nameof(config.Jaeger.AgentHost));
                throw new ArgumentException("Agent Host must be set.", nameof(config.Jaeger.AgentHost));
            }

            if (config.Jaeger.AgentPort is null || config.Jaeger.AgentPort <= 0)
            {
                Log.Error("Agent Port must be set: {@ConfigSection}.{@ConfigProperty}.", nameof(config), nameof(config.Jaeger.AgentPort));
                throw new ArgumentException("Agent Port must be a valid port.", nameof(config.Jaeger.AgentPort));
            }
        }
Ejemplo n.º 9
0
        public void ValidateConfig_Disabled_ShouldNotThrow()
        {
            var config = new Observability();

            config.Prometheus.Enabled = false;
        }
Ejemplo n.º 10
0
 public Composite(Observability child = null, Observability[] children = null)
 {
     Child    = child;
     Children = children;
 }