Fix metric OTLP exporter examples (#2291)

This commit is contained in:
Cijo Thomas 2021-08-26 14:23:37 -07:00 committed by GitHub
parent c22a4189b7
commit 34a95c7fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 25 deletions

View File

@ -93,22 +93,19 @@ namespace Examples.Console
[Verb("metrics", HelpText = "Specify the options required to test Metrics")]
internal class MetricsOptions
{
[Option('d', "IsDelta", HelpText = "Export Delta metrics", Required = false, Default = true)]
[Option('d', "IsDelta", HelpText = "Export Delta metrics", Required = false, Default = false)]
public bool IsDelta { get; set; }
[Option('g', "Gauge", HelpText = "Include Observable Gauge.", Required = false)]
[Option('g', "Gauge", HelpText = "Include Observable Gauge.", Required = false, Default = false)]
public bool? FlagGauge { get; set; }
[Option('u', "UpDownCounter", HelpText = "Include Observable Up/Down Counter.", Required = false)]
public bool? FlagUpDownCounter { get; set; }
[Option('c', "Counter", HelpText = "Include Counter.", Required = false)]
[Option('c', "Counter", HelpText = "Include Counter.", Required = false, Default = true)]
public bool? FlagCounter { get; set; }
[Option('h', "Histogram", HelpText = "Include Histogram.", Required = false)]
[Option('h', "Histogram", HelpText = "Include Histogram.", Required = false, Default = false)]
public bool? FlagHistogram { get; set; }
[Option("defaultCollection", Default = 500, HelpText = "Default collection period in milliseconds.", Required = false)]
[Option("defaultCollection", Default = 1000, HelpText = "Default collection period in milliseconds.", Required = false)]
public int DefaultCollectionPeriodMilliseconds { get; set; }
[Option("runtime", Default = 5000, HelpText = "Run time in milliseconds.", Required = false)]

View File

@ -44,10 +44,10 @@ namespace Examples.Console
* launch the OpenTelemetry Collector with an OTLP receiver, by running:
*
* - On Unix based systems use:
* docker run --rm -it -p 4317:4317 -v $(pwd):/cfg otel/opentelemetry-collector:0.28.0 --config=/cfg/otlp-collector-example/config.yaml
* docker run --rm -it -p 4317:4317 -v $(pwd):/cfg otel/opentelemetry-collector:0.33.0 --config=/cfg/otlp-collector-example/config.yaml
*
* - On Windows use:
* docker run --rm -it -p 4317:4317 -v "%cd%":/cfg otel/opentelemetry-collector:0.28.0 --config=/cfg/otlp-collector-example/config.yaml
* docker run --rm -it -p 4317:4317 -v "%cd%":/cfg otel/opentelemetry-collector:0.33.0 --config=/cfg/otlp-collector-example/config.yaml
*
* Open another terminal window at the examples/Console/ directory and
* launch the OTLP example by running:
@ -109,19 +109,6 @@ namespace Examples.Console
});
}
if (options.FlagUpDownCounter ?? true)
{
var observableCounter = meter.CreateObservableCounter<int>("updown", () =>
{
return new List<Measurement<int>>()
{
new Measurement<int>(
(int)Process.GetCurrentProcess().PrivateMemorySize64,
new KeyValuePair<string, object>("tag1", "value1")),
};
});
}
var cts = new CancellationTokenSource();
var tasks = new List<Task>();

View File

@ -33,10 +33,10 @@ namespace Examples.Console
* launch the OpenTelemetry Collector with an OTLP receiver, by running:
*
* - On Unix based systems use:
* docker run --rm -it -p 4317:4317 -v $(pwd):/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/otlp-collector-example/config.yaml
* docker run --rm -it -p 4317:4317 -v $(pwd):/cfg otel/opentelemetry-collector:0.33.0 --config=/cfg/otlp-collector-example/config.yaml
*
* - On Windows use:
* docker run --rm -it -p 4317:4317 -v "%cd%":/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/otlp-collector-example/config.yaml
* docker run --rm -it -p 4317:4317 -v "%cd%":/cfg otel/opentelemetry-collector:0.33.0 --config=/cfg/otlp-collector-example/config.yaml
*
* Open another terminal window at the examples/Console/ directory and
* launch the OTLP example by running:

View File

@ -18,3 +18,6 @@ service:
traces:
receivers: [otlp]
exporters: [logging]
metrics:
receivers: [otlp]
exporters: [logging]