Fix metric OTLP exporter examples (#2291)
This commit is contained in:
parent
c22a4189b7
commit
34a95c7fb2
|
|
@ -93,22 +93,19 @@ namespace Examples.Console
|
||||||
[Verb("metrics", HelpText = "Specify the options required to test Metrics")]
|
[Verb("metrics", HelpText = "Specify the options required to test Metrics")]
|
||||||
internal class MetricsOptions
|
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; }
|
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; }
|
public bool? FlagGauge { get; set; }
|
||||||
|
|
||||||
[Option('u', "UpDownCounter", HelpText = "Include Observable Up/Down Counter.", Required = false)]
|
[Option('c', "Counter", HelpText = "Include Counter.", Required = false, Default = true)]
|
||||||
public bool? FlagUpDownCounter { get; set; }
|
|
||||||
|
|
||||||
[Option('c', "Counter", HelpText = "Include Counter.", Required = false)]
|
|
||||||
public bool? FlagCounter { get; set; }
|
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; }
|
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; }
|
public int DefaultCollectionPeriodMilliseconds { get; set; }
|
||||||
|
|
||||||
[Option("runtime", Default = 5000, HelpText = "Run time in milliseconds.", Required = false)]
|
[Option("runtime", Default = 5000, HelpText = "Run time in milliseconds.", Required = false)]
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@ namespace Examples.Console
|
||||||
* launch the OpenTelemetry Collector with an OTLP receiver, by running:
|
* launch the OpenTelemetry Collector with an OTLP receiver, by running:
|
||||||
*
|
*
|
||||||
* - On Unix based systems use:
|
* - 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:
|
* - 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
|
* Open another terminal window at the examples/Console/ directory and
|
||||||
* launch the OTLP example by running:
|
* 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 cts = new CancellationTokenSource();
|
||||||
|
|
||||||
var tasks = new List<Task>();
|
var tasks = new List<Task>();
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ namespace Examples.Console
|
||||||
* launch the OpenTelemetry Collector with an OTLP receiver, by running:
|
* launch the OpenTelemetry Collector with an OTLP receiver, by running:
|
||||||
*
|
*
|
||||||
* - On Unix based systems use:
|
* - 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:
|
* - 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
|
* Open another terminal window at the examples/Console/ directory and
|
||||||
* launch the OTLP example by running:
|
* launch the OTLP example by running:
|
||||||
|
|
|
||||||
|
|
@ -18,3 +18,6 @@ service:
|
||||||
traces:
|
traces:
|
||||||
receivers: [otlp]
|
receivers: [otlp]
|
||||||
exporters: [logging]
|
exporters: [logging]
|
||||||
|
metrics:
|
||||||
|
receivers: [otlp]
|
||||||
|
exporters: [logging]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue