Added instructions to run console examples (#1525)
This commit is contained in:
parent
93f614ba58
commit
4385164d85
|
@ -35,7 +35,7 @@ namespace Examples.Console
|
|||
/// dotnet run -p Examples.Console.csproj zpages
|
||||
///
|
||||
/// The above must be run from the project root folder
|
||||
/// (eg: C:\repos\opentelemetry-dotnet\src\examples\Console\).
|
||||
/// (eg: C:\repos\opentelemetry-dotnet\examples\Console\).
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments from command line.</param>
|
||||
public static void Main(string[] args)
|
||||
|
|
|
@ -24,6 +24,11 @@ namespace Examples.Console
|
|||
{
|
||||
internal class TestConsoleExporter
|
||||
{
|
||||
// To run this example, run the following command from
|
||||
// the reporoot\examples\Console\.
|
||||
// (eg: C:\repos\opentelemetry-dotnet\examples\Console\)
|
||||
//
|
||||
// dotnet run console
|
||||
internal static object Run(ConsoleOptions options)
|
||||
{
|
||||
// Enable TracerProvider for the source "MyCompany.MyProduct.MyWebServer"
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Examples.Console
|
|||
var source = new ActivitySource("grpc-net-client-test");
|
||||
using (var parent = source.StartActivity("Main", ActivityKind.Server))
|
||||
{
|
||||
using var channel = GrpcChannel.ForAddress("https://localhost:5001");
|
||||
using var channel = GrpcChannel.ForAddress("https://localhost:44335");
|
||||
var client = new Greeter.GreeterClient(channel);
|
||||
|
||||
try
|
||||
|
|
|
@ -23,6 +23,11 @@ namespace Examples.Console
|
|||
{
|
||||
internal class TestHttpClient
|
||||
{
|
||||
// To run this example, run the following command from
|
||||
// the reporoot\examples\Console\.
|
||||
// (eg: C:\repos\opentelemetry-dotnet\examples\Console\)
|
||||
//
|
||||
// dotnet run httpclient
|
||||
internal static object Run()
|
||||
{
|
||||
System.Console.WriteLine("Hello World!");
|
||||
|
@ -41,7 +46,7 @@ namespace Examples.Console
|
|||
client.GetStringAsync("http://bing.com").GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
System.Console.ReadLine();
|
||||
System.Console.WriteLine("Press Enter key to exit.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,11 @@ namespace Examples.Console
|
|||
{
|
||||
internal static object Run(string host, int port)
|
||||
{
|
||||
// To run this example, run the following command from
|
||||
// the reporoot\examples\Console\.
|
||||
// (eg: C:\repos\opentelemetry-dotnet\examples\Console\)
|
||||
//
|
||||
// dotnet run jaeger -h localhost -p 6831
|
||||
return RunWithActivity(host, port);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,13 +22,9 @@ namespace Examples.Console
|
|||
internal static class TestOtlpExporter
|
||||
{
|
||||
internal static object Run(string endpoint)
|
||||
{
|
||||
return RunWithActivitySource(endpoint);
|
||||
}
|
||||
|
||||
private static object RunWithActivitySource(string endpoint)
|
||||
{
|
||||
/*
|
||||
* Prerequisite to run this example:
|
||||
* Setup an OpenTelemetry Collector to run on local docker.
|
||||
*
|
||||
* Open a terminal window at the examples/Console/ directory and
|
||||
|
@ -51,7 +47,11 @@ namespace Examples.Console
|
|||
* For more information about the OpenTelemetry Collector go to https://github.com/open-telemetry/opentelemetry-collector
|
||||
*
|
||||
*/
|
||||
return RunWithActivitySource(endpoint);
|
||||
}
|
||||
|
||||
private static object RunWithActivitySource(string endpoint)
|
||||
{
|
||||
// Enable OpenTelemetry for the sources "Samples.SampleServer" and "Samples.SampleClient"
|
||||
// and use OTLP exporter.
|
||||
using var openTelemetry = Sdk.CreateTracerProviderBuilder()
|
||||
|
|
|
@ -24,12 +24,15 @@ namespace Examples.Console
|
|||
{
|
||||
internal static object Run(string zipkinUri)
|
||||
{
|
||||
/*
|
||||
* Setup zipkin inside local docker.
|
||||
* docker run -d -p 9411:9411 openzipkin/zipkin
|
||||
*
|
||||
* In zipkinUri, use http://localhost:9411/api/v2/spans
|
||||
*/
|
||||
// Prerequisite for running this example.
|
||||
// Setup zipkin inside local docker using following command:
|
||||
// docker run -d -p 9411:9411 openzipkin/zipkin
|
||||
|
||||
// To run this example, run the following command from
|
||||
// the reporoot\examples\Console\.
|
||||
// (eg: C:\repos\opentelemetry-dotnet\examples\Console\)
|
||||
//
|
||||
// dotnet run zipkin -u http://localhost:9411/api/v2/spans
|
||||
|
||||
// Enable OpenTelemetry for the sources "Samples.SampleServer" and "Samples.SampleClient"
|
||||
// and use the Zipkin exporter.
|
||||
|
|
Loading…
Reference in New Issue