Exemplo n.º 1
0
        internal NewRelicTraceExporter(TraceDataSender spanDataSender, NewRelicExporterOptions options, ITelemetryLogger logger)
        {
            _spanDataSender = spanDataSender;
            spanDataSender.AddVersionInfo(ProductInfo.Name, ProductInfo.Version);

            _config = options.TelemetryConfiguration;

            _logger = logger;
        }
Exemplo n.º 2
0
        public void AddVersionInfo(string productName, string productVersion)
        {
            var dataSender = new TraceDataSender(new TelemetryConfiguration()
            {
                ApiKey = "123456"
            }, null);

            var expectedUserAgentValue = dataSender.UserAgent;

            if (!string.IsNullOrEmpty(productName) && !string.IsNullOrEmpty(productVersion))
            {
                expectedUserAgentValue += " " + $@"{productName}/{productVersion}";
            }

            dataSender.AddVersionInfo(productName, productVersion);

            var userAgentValueAfter = dataSender.UserAgent;

            Assert.Equal(expectedUserAgentValue, userAgentValueAfter);
        }