File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
instrumentation/opentelemetry-instrumentation-django/tests Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -917,6 +917,29 @@ def test_wsgi_metrics_both_semconv(self):
917917 )
918918 self .assertTrue (histrogram_data_point_seen and number_data_point_seen )
919919
920+ def test_wsgi_metrics_context_propagation (self ):
921+ with (
922+ patch .object (
923+ _DjangoMiddleware ,
924+ "_duration_histogram_old" ,
925+ ) as mock_histogram_old ,
926+ patch .object (
927+ _DjangoMiddleware ,
928+ "_duration_histogram_new" ,
929+ ) as mock_histogram_new ,
930+ ):
931+ mock_histogram_old .record = Mock ()
932+ mock_histogram_new .record = Mock ()
933+
934+ Client ().get ("/traced/" )
935+
936+ self .assertTrue (mock_histogram_old .record .called )
937+ call_args = mock_histogram_old .record .call_args
938+ self .assertIsNotNone (call_args )
939+ self .assertIn ("context" , call_args .kwargs )
940+ context_arg = call_args .kwargs ["context" ]
941+ self .assertIsNotNone (context_arg )
942+
920943 def test_wsgi_metrics_unistrument (self ):
921944 Client ().get ("/span_name/1234/" )
922945 _django_instrumentor .uninstrument ()
You can’t perform that action at this time.
0 commit comments