Beispiel #1
0
 def test_single_path(self):
     auto_instrumentation.run()
     self.assertEqual(
         environ["PYTHONPATH"],
         pathsep.join([self.auto_instrumentation_path,
                       getcwd(), "abc"]),
     )
Beispiel #2
0
 def test_empty(self):
     auto_instrumentation.run()
     self.assertEqual(
         environ["PYTHONPATH"],
         pathsep.join([self.auto_instrumentation_path,
                       getcwd()]),
     )
Beispiel #3
0
    def test_service_name(self, _):  # pylint: disable=no-self-use
        with patch("sys.argv", ["instrument", "2"]):
            auto_instrumentation.run()
            self.assertIsNone(environ.get("OTEL_SERVICE_NAME"))

        with patch("sys.argv", ["instrument", "-s", "my-service", "1", "2"]):
            auto_instrumentation.run()
            self.assertEqual(environ.get("OTEL_SERVICE_NAME"), "my-service")
Beispiel #4
0
    def test_exporter(self, _):  # pylint: disable=no-self-use
        with patch("sys.argv", ["instrument", "2"]):
            auto_instrumentation.run()
            self.assertIsNone(environ.get("OTEL_EXPORTER"))

        with patch("sys.argv", ["instrument", "-e", "zipkin", "1", "2"]):
            auto_instrumentation.run()
            self.assertEqual(environ.get("OTEL_EXPORTER"), "zipkin")
    def test_execl(
        self, mock_execl, mock_which
    ):  # pylint: disable=no-self-use
        mock_which.configure_mock(**{"return_value": "python"})

        auto_instrumentation.run()

        mock_execl.assert_called_with("python", "python", "3")
Beispiel #6
0
    def test_exporter(self, _):  # pylint: disable=no-self-use
        with patch("sys.argv", ["instrument", "2"]):
            auto_instrumentation.run()
            self.assertIsNone(environ.get(OTEL_TRACES_EXPORTER))

        with patch("sys.argv",
                   ["instrument", "--trace-exporter", "jaeger", "1", "2"]):
            auto_instrumentation.run()
            self.assertEqual(environ.get(OTEL_TRACES_EXPORTER), "jaeger")