Skip to content

Commit 4ab9896

Browse files
authored
Merge pull request #6 from digma-ai/bug/issue#5_fix_typo
environment set to hostname + local when null
2 parents 04f450d + cbca9d2 commit 4ab9896

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

DigmaConfigurationOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace OpenTelemetry.Instrumentation.Digma
1818
public class DigmaConfigurationOptions
1919
{
2020
private const string DEFAULT_COMMIT_ENV_VAR="DEPLOYMENT_COMMIT_ID";
21-
private const string DEFAULT_ENV_ENV_VAR="DEPLOYMENT_ENVIORNMENT";
21+
private const string DEFAULT_ENV_ENV_VAR="DEPLOYMENT_ENV";
2222

2323
public string? NamespaceRoot { get; set; } = null;
2424
public string? Environment { get; set; } = null;

DigmaInstrumentationHelperExtensions.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,15 @@ public static ResourceBuilder AddDigmaAttributes(this ResourceBuilder builder,
6060

6161
if (options.Environment == null)
6262
{
63-
options.Environment = Environment.GetEnvironmentVariable(options.EnvironmentEnvVariable) ?? "UNSET_ENV";
63+
var env = Environment.GetEnvironmentVariable(options.EnvironmentEnvVariable);
64+
if (env is null)
65+
{
66+
options.Environment = Environment.MachineName + "[local]";
67+
}
68+
else
69+
{
70+
options.Environment = env;
71+
}
6472
}
6573

6674
builder.AddAttributes(new[]

0 commit comments

Comments
 (0)