Esempio n. 1
0
        public string GetSampleApplicationOutputDirectory(string packageVersion = "", string framework = "")
        {
            var targetFramework = string.IsNullOrEmpty(framework) ? GetTargetFramework() : framework;
            var binDir          = Path.Combine(
                GetSampleProjectDirectory(),
                "bin");

            string outputDir;

            if (_samplesDirectory.Contains("aspnet"))
            {
                outputDir = binDir;
            }
            else if (EnvironmentTools.GetOS() == "win")
            {
                outputDir = Path.Combine(
                    binDir,
                    packageVersion,
                    EnvironmentTools.GetPlatform(),
                    EnvironmentTools.GetBuildConfiguration(),
                    targetFramework);
            }
            else
            {
                outputDir = Path.Combine(
                    binDir,
                    packageVersion,
                    EnvironmentTools.GetBuildConfiguration(),
                    targetFramework,
                    "publish");
            }

            return(outputDir);
        }
        public static string GetTracerNativeDLLPath()
        {
            var tracerHome = GetTracerHomePath();

            var(extension, dir) = (EnvironmentTools.GetOS(), EnvironmentTools.GetPlatform()) switch
            {
                ("win", "X64") => ("dll", "win-x64"),
                ("win", "X86") => ("dll", "win-x86"),
                ("linux", "X64") => ("so", null),
                ("linux", "Arm64") => ("so", null),
                ("osx", _) => ("dylib", null),
                _ => throw new PlatformNotSupportedException()
            };

            var fileName = $"Datadog.Trace.ClrProfiler.Native.{extension}";

            var path = dir is null
                           ? Path.Combine(tracerHome, fileName)
                           : Path.Combine(tracerHome, dir, fileName);

            if (!File.Exists(path))
            {
                throw new Exception($"Unable to find profiler at {path}");
            }

            return(path);
        }
Esempio n. 3
0
 private string GetProfilerProjectBin()
 {
     return(Path.Combine(
                GetSolutionDirectory(),
                "src",
                "Datadog.Trace.ClrProfiler.Native",
                "bin",
                EnvironmentTools.GetBuildConfiguration(),
                EnvironmentTools.GetPlatform().ToLower()));
 }
Esempio n. 4
0
        protected TestHelper(EnvironmentHelper environmentHelper, ITestOutputHelper output)
        {
            EnvironmentHelper = environmentHelper;
            Output            = output;

            Output.WriteLine($"Platform: {EnvironmentTools.GetPlatform()}");
            Output.WriteLine($"Configuration: {EnvironmentTools.GetBuildConfiguration()}");
            Output.WriteLine($"TargetFramework: {EnvironmentHelper.GetTargetFramework()}");
            Output.WriteLine($".NET Core: {EnvironmentHelper.IsCoreClr()}");
            Output.WriteLine($"Tracer Native DLL: {EnvironmentHelper.GetTracerNativeDLLPath()}");
            Output.WriteLine($"Native Loader DLL: {EnvironmentHelper.GetNativeLoaderPath()}");
        }
        public static string GetNativeLoaderPath()
        {
            var monitoringHome = GetMonitoringHomePath();

            string fileName = (EnvironmentTools.GetOS(), EnvironmentTools.GetPlatform()) switch
            {
                ("win", "X64") => "Datadog.AutoInstrumentation.NativeLoader.x64.dll",
                ("win", "X86") => "Datadog.AutoInstrumentation.NativeLoader.x86.dll",
                ("linux", "X64") => "Datadog.AutoInstrumentation.NativeLoader.so",
                ("linux", "Arm64") => "Datadog.AutoInstrumentation.NativeLoader.so",
                ("osx", _) => throw new PlatformNotSupportedException("The Native Loader is not yet supported on osx"),
                      _ => throw new PlatformNotSupportedException()
            };

            var path = Path.Combine(monitoringHome, fileName);

            if (!File.Exists(path))
            {
                throw new Exception($"Unable to find Native Loader at {path}");
            }

            return(path);
        }
Esempio n. 6
0
 public static string GetRuntimeIdentifier()
 {
     return(IsCoreClr()
                ? string.Empty
                : $"{EnvironmentTools.GetOS()}-{EnvironmentTools.GetPlatform()}");
 }