Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@

## Unreleased

* Updated the database semantic conventions to
[v1.43.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.43.0/docs/db/elasticsearch.md)
of the Semantic Conventions for Elasticsearch client operations. The new
attributes can be opted in to by setting the `OTEL_SEMCONV_STABILITY_OPT_IN`
environment variable. This allows for a transition period for users to
experiment with the new semantic conventions and adapt as necessary. The
environment variable supports the following values:
* `database` - emit the new, frozen (proposed for stable) database attributes,
and stop emitting the old experimental database attributes that the
instrumentation emitted previously.
* `database/dup` - emit both the old and the frozen (proposed for stable)
database attributes, allowing for a more seamless transition.
* The default behavior (in the absence of one of these values) is to continue
emitting the same database semantic conventions that were emitted in
the previous version.
* Note: this option will be removed after the new database semantic
conventions are marked stable. At which time this instrumentation can receive
a stable release, and the old database semantic conventions will no longer be
supported. Refer to the
[specification](https://github.com/open-telemetry/semantic-conventions/blob/v1.43.0/docs/db/elasticsearch.md)
for more information.

When the new attributes are emitted:
* `net.peer.ip` and `net.peer.name` are replaced by `server.address`.
* `net.peer.port` is replaced by `server.port`.
* `db.system` is replaced by `db.system.name`.
* `db.name` is replaced by `db.collection.name`.
* `db.method` is replaced by `http.request.method`.
* `db.statement` is replaced by `db.query.text`.
* `http.status_code` is replaced by `db.response.status_code`.
* `error.type` is emitted when the operation fails.
* `db.operation.name` is emitted, derived from the request URL.
* The span name is `{db.operation.name} {db.collection.name}`.

([#4635](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/4635))

## 1.16.0-beta.1

Released 2026-Jul-09
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0

using System.Diagnostics;
using Microsoft.Extensions.Configuration;
using static OpenTelemetry.Internal.DatabaseSemanticConventionHelper;

namespace OpenTelemetry.Instrumentation.ElasticsearchClient;

Expand All @@ -10,6 +12,21 @@ namespace OpenTelemetry.Instrumentation.ElasticsearchClient;
/// </summary>
public class ElasticsearchClientInstrumentationOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="ElasticsearchClientInstrumentationOptions"/> class.
/// </summary>
public ElasticsearchClientInstrumentationOptions()
: this(new ConfigurationBuilder().AddEnvironmentVariables().Build())
{
}

internal ElasticsearchClientInstrumentationOptions(IConfiguration configuration)
{
var databaseSemanticConvention = GetSemanticConventionOptIn(configuration);
this.EmitOldAttributes = databaseSemanticConvention.HasFlag(DatabaseSemanticConvention.Old);
this.EmitNewAttributes = databaseSemanticConvention.HasFlag(DatabaseSemanticConvention.New);
}

/// <summary>
/// Gets or sets a value indicating whether down stream instrumentation (HttpClient) is suppressed (disabled).
/// </summary>
Expand Down Expand Up @@ -41,4 +58,14 @@ public class ElasticsearchClientInstrumentationOptions
/// The type of this object depends on the event, which is given by the above parameter.</para>
/// </remarks>
public Action<Activity, string, object?>? Enrich { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the old database attributes should be emitted.
/// </summary>
internal bool EmitOldAttributes { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the new database attributes should be emitted.
/// </summary>
internal bool EmitNewAttributes { get; set; }
}
Loading