Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Add debug and tracing annotations #298

Merged
merged 8 commits into from
Apr 16, 2020
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
6 changes: 4 additions & 2 deletions src/Microsoft.Tye.Extensions/Dapr/DaprExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,17 @@ public override Task ProcessAsync(ExtensionContext context, ExtensionConfigurati
deployment.Annotations.Add("dapr.io/id", project.Name);
deployment.Annotations.Add("dapr.io/port", (httpBinding.Port ?? 80).ToString(CultureInfo.InvariantCulture));

thangchung marked this conversation as resolved.
Show resolved Hide resolved
#pragma warning disable CS8604 // Possible null reference argument.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's usally done by doing this:

daprConfig!.ToString()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it with your suggestion, but no luck. Could anyone tell me how can I overcome this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did deployment.Annotations.TryAdd("dapr.io/config", daprConfig!.ToString() ?? string.Empty);, and it can overcome this check but not sure it is correctly

if (config.Data.TryGetValue("config", out var daprConfig) && daprConfig is object)
{
deployment.Annotations.TryAdd("dapr.io/config", daprConfig?.ToString());
deployment.Annotations.TryAdd("dapr.io/config", daprConfig.ToString());
}
thangchung marked this conversation as resolved.
Show resolved Hide resolved

if (config.Data.TryGetValue("log-level", out var logLevel) && logLevel is object)
{
deployment.Annotations.TryAdd("dapr.io/log-level", logLevel?.ToString());
deployment.Annotations.TryAdd("dapr.io/log-level", logLevel.ToString());
}
#pragma warning restore CS8604 // Possible null reference argument.
}
}
}
Expand Down