@@ -642,6 +642,12 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigJsonBytesMappingTest)
642
642
EXPECT_EQ (GetOptions (exporter).json_bytes_mapping , JsonBytesMappingKind::kHex );
643
643
}
644
644
645
+ TEST (OtlpHttpLogRecordExporterTest, ConfigDefaultProtocolTest)
646
+ {
647
+ OtlpHttpLogRecordExporterOptions opts;
648
+ EXPECT_EQ (opts.content_type , HttpRequestContentType::kBinary );
649
+ }
650
+
645
651
# ifndef NO_GETENV
646
652
// Test exporter configuration options with use_ssl_credentials
647
653
TEST_F (OtlpHttpLogRecordExporterTestPeer, ConfigFromEnv)
@@ -651,6 +657,7 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigFromEnv)
651
657
setenv (" OTEL_EXPORTER_OTLP_TIMEOUT" , " 20s" , 1 );
652
658
setenv (" OTEL_EXPORTER_OTLP_HEADERS" , " k1=v1,k2=v2" , 1 );
653
659
setenv (" OTEL_EXPORTER_OTLP_LOGS_HEADERS" , " k1=v3,k1=v4" , 1 );
660
+ setenv (" OTEL_EXPORTER_OTLP_PROTOCOL" , " http/json" , 1 );
654
661
655
662
std::unique_ptr<OtlpHttpLogRecordExporter> exporter (new OtlpHttpLogRecordExporter ());
656
663
EXPECT_EQ (GetOptions (exporter).url , url);
@@ -677,11 +684,13 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigFromEnv)
677
684
++range.first ;
678
685
EXPECT_TRUE (range.first == range.second );
679
686
}
687
+ EXPECT_EQ (GetOptions (exporter).content_type , HttpRequestContentType::kJson );
680
688
681
689
unsetenv (" OTEL_EXPORTER_OTLP_ENDPOINT" );
682
690
unsetenv (" OTEL_EXPORTER_OTLP_TIMEOUT" );
683
691
unsetenv (" OTEL_EXPORTER_OTLP_HEADERS" );
684
692
unsetenv (" OTEL_EXPORTER_OTLP_LOGS_HEADERS" );
693
+ unsetenv (" OTEL_EXPORTER_OTLP_PROTOCOL" );
685
694
}
686
695
687
696
TEST_F (OtlpHttpLogRecordExporterTestPeer, ConfigFromLogsEnv)
@@ -691,6 +700,7 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigFromLogsEnv)
691
700
setenv (" OTEL_EXPORTER_OTLP_LOGS_TIMEOUT" , " 20s" , 1 );
692
701
setenv (" OTEL_EXPORTER_OTLP_HEADERS" , " k1=v1,k2=v2" , 1 );
693
702
setenv (" OTEL_EXPORTER_OTLP_LOGS_HEADERS" , " k1=v3,k1=v4" , 1 );
703
+ setenv (" OTEL_EXPORTER_OTLP_LOGS_PROTOCOL" , " http/json" , 1 );
694
704
695
705
std::unique_ptr<OtlpHttpLogRecordExporter> exporter (new OtlpHttpLogRecordExporter ());
696
706
EXPECT_EQ (GetOptions (exporter).url , url);
@@ -717,11 +727,13 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigFromLogsEnv)
717
727
++range.first ;
718
728
EXPECT_TRUE (range.first == range.second );
719
729
}
730
+ EXPECT_EQ (GetOptions (exporter).content_type , HttpRequestContentType::kJson );
720
731
721
732
unsetenv (" OTEL_EXPORTER_OTLP_LOGS_ENDPOINT" );
722
733
unsetenv (" OTEL_EXPORTER_OTLP_LOGS_TIMEOUT" );
723
734
unsetenv (" OTEL_EXPORTER_OTLP_HEADERS" );
724
735
unsetenv (" OTEL_EXPORTER_OTLP_LOGS_HEADERS" );
736
+ unsetenv (" OTEL_EXPORTER_OTLP_LOGS_PROTOCOL" );
725
737
}
726
738
727
739
TEST_F (OtlpHttpLogRecordExporterTestPeer, DefaultEndpoint)
0 commit comments