Skip to content

Commit 3af5a3b

Browse files
authored
Fix analyzer issues in docs (#3026)
1 parent 36d5319 commit 3af5a3b

File tree

16 files changed

+37
-21
lines changed

16 files changed

+37
-21
lines changed

docs/logs/extending-the-sdk/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
using Microsoft.Extensions.Logging;
1919
using OpenTelemetry;
2020

21+
namespace ExtendingTheSdk;
22+
2123
public class Program
2224
{
2325
public static void Main()
@@ -37,8 +39,8 @@ public static void Main()
3739
// unstructured log
3840
logger.LogInformation("Hello, World!");
3941

40-
// unstructured log with string interpolation
41-
logger.LogInformation($"Hello from potato {0.99}.");
42+
// String interpolation, as in the below line, results in unstructured logging, and is not recommended
43+
// logger.LogInformation($"Hello from potato {0.99}.");
4244

4345
// structured log with template
4446
logger.LogInformation("Hello from {name} {price}.", "tomato", 2.99);

docs/logs/getting-started/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
using Microsoft.Extensions.Logging;
1818
using OpenTelemetry.Logs;
1919

20+
namespace GettingStarted;
21+
2022
public class Program
2123
{
2224
public static void Main()

docs/logs/source-generation/FoodSupplyLogs.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
using Microsoft.Extensions.Logging;
1818

19+
namespace SourceGeneration;
20+
1921
public static partial class FoodSupplyLogs
2022
{
2123
[LoggerMessage(

docs/logs/source-generation/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
using Microsoft.Extensions.Logging;
1818
using OpenTelemetry.Logs;
1919

20+
namespace SourceGeneration;
21+
2022
public class Program
2123
{
2224
public static void Main()

docs/metrics/customizing-the-sdk/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
using OpenTelemetry;
2020
using OpenTelemetry.Metrics;
2121

22+
namespace CustomizingTheSdk;
23+
2224
public class Program
2325
{
2426
private static readonly Meter Meter1 = new("CompanyA.ProductA.Library1", "1.0");
2527
private static readonly Meter Meter2 = new("CompanyA.ProductB.Library2", "1.0");
2628

27-
public static void Main(string[] args)
29+
public static void Main()
2830
{
2931
using var meterProvider = Sdk.CreateMeterProviderBuilder()
3032
.AddMeter(Meter1.Name)

docs/metrics/extending-the-sdk/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
using OpenTelemetry;
2222
using OpenTelemetry.Metrics;
2323

24+
namespace ExtendingTheSdk;
25+
2426
public class Program
2527
{
2628
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
@@ -38,7 +40,7 @@ static Program()
3840
});
3941
}
4042

41-
public static void Main(string[] args)
43+
public static void Main()
4244
{
4345
using var meterProvider = Sdk.CreateMeterProviderBuilder()
4446
.AddMeter("MyCompany.MyProduct.MyLibrary")

docs/metrics/getting-started-prometheus-grafana/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020
using OpenTelemetry;
2121
using OpenTelemetry.Metrics;
2222

23+
namespace GettingStartedPrometheusGrafana;
24+
2325
public class Program
2426
{
2527
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
2628
private static readonly Counter<long> MyFruitCounter = MyMeter.CreateCounter<long>("MyFruitCounter");
2729

28-
public static void Main(string[] args)
30+
public static void Main()
2931
{
3032
using var meterProvider = Sdk.CreateMeterProviderBuilder()
3133
.AddMeter("MyCompany.MyProduct.MyLibrary")

docs/metrics/getting-started/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
using OpenTelemetry;
1919
using OpenTelemetry.Metrics;
2020

21+
namespace GettingStarted;
22+
2123
public class Program
2224
{
2325
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
2426
private static readonly Counter<long> MyFruitCounter = MyMeter.CreateCounter<long>("MyFruitCounter");
2527

26-
public static void Main(string[] args)
28+
public static void Main()
2729
{
2830
using var meterProvider = Sdk.CreateMeterProviderBuilder()
2931
.AddMeter("MyCompany.MyProduct.MyLibrary")

docs/metrics/learning-more-instruments/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
using OpenTelemetry;
2222
using OpenTelemetry.Metrics;
2323

24+
namespace LearningMoreInstruments;
25+
2426
public class Program
2527
{
2628
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
@@ -35,7 +37,7 @@ static Program()
3537
MyMeter.CreateObservableGauge("Thread.State", () => GetThreadState(process));
3638
}
3739

38-
public static void Main(string[] args)
40+
public static void Main()
3941
{
4042
using var meterProvider = Sdk.CreateMeterProviderBuilder()
4143
.AddMeter("MyCompany.MyProduct.MyLibrary")

docs/trace/customizing-the-sdk/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
using OpenTelemetry;
1919
using OpenTelemetry.Trace;
2020

21+
namespace CustomizingTheSdk;
22+
2123
public class Program
2224
{
2325
private static readonly ActivitySource MyLibraryActivitySource = new(

0 commit comments

Comments
 (0)