28 lines
999 B
C#
28 lines
999 B
C#
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
using System.Diagnostics.Metrics;
|
|
|
|
public class Program
|
|
{
|
|
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
|
|
private static readonly Counter<long> MyFruitCounter = MyMeter.CreateCounter<long>("MyFruitCounter");
|
|
|
|
public static void Main()
|
|
{
|
|
Console.WriteLine("Press any key to exit");
|
|
|
|
while (!Console.KeyAvailable)
|
|
{
|
|
MyFruitCounter.Add(1, new("name", "apple"), new("color", "red"));
|
|
MyFruitCounter.Add(2, new("name", "lemon"), new("color", "yellow"));
|
|
MyFruitCounter.Add(1, new("name", "lemon"), new("color", "yellow"));
|
|
MyFruitCounter.Add(2, new("name", "apple"), new("color", "green"));
|
|
MyFruitCounter.Add(5, new("name", "apple"), new("color", "red"));
|
|
MyFruitCounter.Add(4, new("name", "lemon"), new("color", "yellow"));
|
|
|
|
Thread.Sleep(300);
|
|
}
|
|
}
|
|
}
|