|
1 | 1 | namespace Samples |
2 | 2 | { |
| 3 | + using CommandLine; |
3 | 4 | using System; |
4 | 5 |
|
| 6 | + [Verb("stackdriver", HelpText = "Specify the options required to test Stackdriver exporter", Hidden = false)] |
| 7 | + class StackdriverOptions |
| 8 | + { |
| 9 | + [Option('p', "projectId", HelpText = "Please specify the projectId of your GCP project", Required = true)] |
| 10 | + public string ProjectId { get; set; } |
| 11 | + } |
| 12 | + |
| 13 | + [Verb("zipkin", HelpText = "Specify the options required to test Zipkin exporter")] |
| 14 | + class ZipkinOptions |
| 15 | + { |
| 16 | + } |
| 17 | + |
| 18 | + [Verb("appInsights", HelpText = "Specify the options required to test ApplicationInsights")] |
| 19 | + class ApplicationInsightsOptions |
| 20 | + { |
| 21 | + } |
| 22 | + |
| 23 | + [Verb("prometheus", HelpText = "Specify the options required to test Prometheus")] |
| 24 | + class PrometheusOptions |
| 25 | + { |
| 26 | + } |
| 27 | + |
| 28 | + [Verb("httpclient", HelpText = "Specify the options required to test HttpClient")] |
| 29 | + class HttpClientOptions |
| 30 | + { |
| 31 | + } |
| 32 | + |
5 | 33 | /// <summary> |
6 | 34 | /// Main samples entry point. |
7 | 35 | /// </summary> |
8 | 36 | public class Program |
9 | 37 | { |
10 | 38 | /// <summary> |
11 | | - /// Main method. |
| 39 | + /// Main method - invoke this using command line. |
| 40 | + /// For example: |
| 41 | + /// |
| 42 | + /// Samples.dll zipkin |
| 43 | + /// Sample.dll appInsights |
| 44 | + /// Sample.dll prometheus |
12 | 45 | /// </summary> |
13 | 46 | /// <param name="args">Arguments from command line.</param> |
14 | 47 | public static void Main(string[] args) |
15 | 48 | { |
16 | | - Console.WriteLine("Uncomment test to run... "); |
17 | | - |
18 | | - TestZipkin.Run(); |
| 49 | + Parser.Default.ParseArguments<ZipkinOptions, ApplicationInsightsOptions, PrometheusOptions, HttpClientOptions, StackdriverOptions>(args) |
| 50 | + .MapResult( |
| 51 | + (ZipkinOptions options) => TestZipkin.Run(), |
| 52 | + (ApplicationInsightsOptions options) => TestApplicationInsights.Run(), |
| 53 | + (PrometheusOptions options) => TestPrometheus.Run(), |
| 54 | + (HttpClientOptions options) => TestHttpClient.Run(), |
| 55 | + (StackdriverOptions options) => TestStackdriver.Run(options.ProjectId), |
| 56 | + errs => 1); |
| 57 | + |
| 58 | + // TestZipkin.Run(); |
19 | 59 | // TestApplicationInsights.Run(); |
20 | 60 | // TestPrometheus.Run(); |
21 | 61 | // TestHttpClient.Run(); |
|
0 commit comments