Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Skip adding service name
  • Loading branch information
stevejgordon committed Feb 28, 2025
commit 6815f053090965eefd6531d5729b2f7ca467abe8
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,8 @@ internal static ResourceBuilder WithElasticDefaults(this ResourceBuilder builder
"is guarded by a RuntimeFeature.IsDynamicCodeSupported` check and therefore this method is safe to call in AoT scenarios.")]
private static void ConfigureBuilder(ResourceBuilder builder, BuilderState builderState, IServiceCollection? services)
{
var defaultServiceName = "unknown_service";

try
{
var processName = Process.GetCurrentProcess().ProcessName;
if (!string.IsNullOrWhiteSpace(processName))
defaultServiceName = processName;
}
catch (Exception ex)
{
builderState.Components.Logger.LogError(new EventId(510, "GetCurrentProcessFailed"), ex, "An exception occurred when attempting to " +
"get determine the process name.");
}

var attributes = new Dictionary<string, object>
{
{ ResourceSemanticConventions.AttributeServiceName, defaultServiceName },
{ ResourceSemanticConventions.AttributeServiceInstanceId, ApplicationInstanceId },
{ ResourceSemanticConventions.AttributeTelemetryDistroName, "elastic" },
{ ResourceSemanticConventions.AttributeTelemetryDistroVersion, VersionHelper.InformationalVersion }
Expand Down
Loading