OTel.Exporter.Elasticsearch.Http 3.0.0

dotnet add package OTel.Exporter.Elasticsearch.Http --version 3.0.0
NuGet\Install-Package OTel.Exporter.Elasticsearch.Http -Version 3.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OTel.Exporter.Elasticsearch.Http" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OTel.Exporter.Elasticsearch.Http --version 3.0.0
#r "nuget: OTel.Exporter.Elasticsearch.Http, 3.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install OTel.Exporter.Elasticsearch.Http as a Cake Addin
#addin nuget:?package=OTel.Exporter.Elasticsearch.Http&version=3.0.0

// Install OTel.Exporter.Elasticsearch.Http as a Cake Tool
#tool nuget:?package=OTel.Exporter.Elasticsearch.Http&version=3.0.0

opentelemetry-elk-exporter

Open Telemetry Exporter for Elasticsearch using http protocol.

How to use?

  1. Install OTel.Exporter.Elasticsearch.Http package using Nuget Package Manager in .NET 5.0 above project
  2. add Below code in programe.cs or startup.cs
	using var loggerFactory = LoggerFactory.Create(builder =>
        {
            builder.AddOpenTelemetry(options => options
                .AddElasticsearchExporter(new ElasticsearchExporterHttpOptions("telemetry", "http://localhost:9200"))
            );
        });

"telemetry": this is index name in Elasticsearch for which data will be pushed

"http://localhost:9200": This is url of Elasticsearch server.

Example:


        internal class Program
          {
            private static ActivitySource activitySource = new ActivitySource("OTel.POC.Web", "ASP.NET Core 5.0");

            private static void Main(string[] args)
            {
              Activity.DefaultIdFormat = ActivityIdFormat.W3C;
              Activity.ForceDefaultIdFormat = true;
              using var loggerFactory = LoggerFactory.Create(builder =>
              {
                builder.AddOpenTelemetry(options => options
                    .AddElasticsearchExporter(new ElasticsearchExporterHttpOptions("telemetry", "http://localhost:9200"))
                    );
              });
              using (var activity = activitySource.StartActivity("ActivityName"))
              {
                var logger = loggerFactory.CreateLogger<Program>();
                logger.LogInformation("Hello from {name} {price}.", "tomato", 2.99);
                Stopwatch s = new Stopwatch();
                s.Start();
                Stopwatch s1 = new Stopwatch();
                long[] timekeeping = new long[1000];   
                for (int i = 0; i < 1000; i++)
                {

                            s1.Reset();
                            s1.Start();
                            logger.LogInformation($"Counting from {i} to 100");
                            s1.Stop();
                            timekeeping[i] = s1.ElapsedMilliseconds;
                }
                s.Stop();
                Console.WriteLine($"Time Elapsed - {s.ElapsedMilliseconds} ms");
                Console.WriteLine("Average time takemn:"+ timekeeping.Average()+" ms");
              }
              Console.ReadLine();
            }
          }
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 805 12/23/2022
2.0.0 412 12/12/2021
1.0.0 332 10/31/2021

Upgraded to .NET 6, Added retry logic to push message to Elasticsearch