OTel.Exporter.Elasticsearch.Http
2.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package OTel.Exporter.Elasticsearch.Http --version 2.0.0
NuGet\Install-Package OTel.Exporter.Elasticsearch.Http -Version 2.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="2.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 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OTel.Exporter.Elasticsearch.Http, 2.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=2.0.0 // Install OTel.Exporter.Elasticsearch.Http as a Cake Tool #tool nuget:?package=OTel.Exporter.Elasticsearch.Http&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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.
-
net6.0
- NEST (>= 7.16.0)
- OpenTelemetry (>= 1.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Upgraded to .NET 6, Added retry logic to push message to Elasticsearch