Ejemplo n.º 1
0
        /// <summary>
        /// Main method - invoke this using command line.
        /// For example:
        ///
        /// dotnet run -p Examples.Console.csproj console
        /// dotnet run -p Examples.Console.csproj inmemory
        /// dotnet run -p Examples.Console.csproj zipkin -u http://localhost:9411/api/v2/spans
        /// dotnet run -p Examples.Console.csproj jaeger -h localhost -p 6831
        /// dotnet run -p Examples.Console.csproj prometheus -i 15 -p 9184 -d 2
        /// dotnet run -p Examples.Console.csproj otlp -e "localhost:55680"
        /// dotnet run -p Examples.Console.csproj zpages
        ///
        /// The above must be run from the project root folder
        /// (eg: C:\repos\opentelemetry-dotnet\examples\Console\).
        /// </summary>
        /// <param name="args">Arguments from command line.</param>
        public static void Main(string[] args)
        {
            Parser.Default.ParseArguments <JaegerOptions, ZipkinOptions, GrpcNetClientOptions, HttpClientOptions, RedisOptions, ZPagesOptions, ConsoleOptions, OpenTelemetryShimOptions, OpenTracingShimOptions, OtlpOptions, InMemoryOptions>(args)
            .MapResult(
                (JaegerOptions options) => TestJaegerExporter.Run(options.Host, options.Port),
                (ZipkinOptions options) => TestZipkinExporter.Run(options.Uri),
                (GrpcNetClientOptions options) => TestGrpcNetClient.Run(),
                (HttpClientOptions options) => TestHttpClient.Run(),
                (RedisOptions options) => TestRedis.Run(options.Uri),
                (ZPagesOptions options) => TestZPagesExporter.Run(),
                (ConsoleOptions options) => TestConsoleExporter.Run(options),
                (OpenTelemetryShimOptions options) => TestOTelShimWithConsoleExporter.Run(options),
                (OpenTracingShimOptions options) => TestOpenTracingShim.Run(options),
                (OtlpOptions options) => TestOtlpExporter.Run(options.Endpoint),
                (InMemoryOptions options) => TestInMemoryExporter.Run(options),
                errs => 1);

            System.Console.ReadLine();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Main method - invoke this using command line.
 /// For example:
 ///
 /// dotnet run -p Examples.Console.csproj console
 /// dotnet run -p Examples.Console.csproj inmemory
 /// dotnet run -p Examples.Console.csproj zipkin -u http://localhost:9411/api/v2/spans
 /// dotnet run -p Examples.Console.csproj jaeger -h localhost -p 6831
 /// dotnet run -p Examples.Console.csproj prometheus -p 9184 -d 2
 /// dotnet run -p Examples.Console.csproj otlp -e "http://localhost:4317" -p "grpc"
 /// dotnet run -p Examples.Console.csproj zpages
 /// dotnet run -p Examples.Console.csproj metrics --help
 ///
 /// The above must be run from the project root folder
 /// (eg: C:\repos\opentelemetry-dotnet\examples\Console\).
 /// </summary>
 /// <param name="args">Arguments from command line.</param>
 public static void Main(string[] args)
 {
     Parser.Default.ParseArguments <JaegerOptions, ZipkinOptions, PrometheusOptions, MetricsOptions, LogsOptions, GrpcNetClientOptions, HttpClientOptions, RedisOptions, ZPagesOptions, ConsoleOptions, OpenTelemetryShimOptions, OpenTracingShimOptions, OtlpOptions, InMemoryOptions>(args)
     .MapResult(
         (JaegerOptions options) => TestJaegerExporter.Run(options.Host, options.Port),
         (ZipkinOptions options) => TestZipkinExporter.Run(options.Uri),
         (PrometheusOptions options) => TestPrometheusExporter.Run(options.Port, options.DurationInMins),
         (MetricsOptions options) => TestMetrics.Run(options),
         (LogsOptions options) => TestLogs.Run(options),
         (GrpcNetClientOptions options) => TestGrpcNetClient.Run(),
         (HttpClientOptions options) => TestHttpClient.Run(),
         (RedisOptions options) => TestRedis.Run(options.Uri),
         (ZPagesOptions options) => TestZPagesExporter.Run(),
         (ConsoleOptions options) => TestConsoleExporter.Run(options),
         (OpenTelemetryShimOptions options) => TestOTelShimWithConsoleExporter.Run(options),
         (OpenTracingShimOptions options) => TestOpenTracingShim.Run(options),
         (OtlpOptions options) => TestOtlpExporter.Run(options.Endpoint, options.Protocol),
         (InMemoryOptions options) => TestInMemoryExporter.Run(options),
         errs => 1);
 }