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
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
12 changes: 11 additions & 1 deletion src/Microsoft.Tye.Extensions/Dapr/DaprExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override Task ProcessAsync(ExtensionContext context, ExtensionConfigurati

// These environment variables are replaced with environment variables
// defined for this service.
Args = $"-app-id {project.Name} -app-port %APP_PORT% -dapr-grpc-port %DAPR_GRPC_PORT% --dapr-http-port %DAPR_HTTP_PORT% --metrics-port %METRICS_PORT% --placement-address localhost:50005",
Args = $"-app-id {project.Name} -app-port %APP_PORT% -dapr-grpc-port %DAPR_GRPC_PORT% --dapr-http-port %DAPR_HTTP_PORT% --metrics-port %METRICS_PORT% -log-level %LOG_LEVEL% -config %CONFIG% --placement-address localhost:50005",
};
context.Application.Services.Add(proxy);

Expand Down Expand Up @@ -137,6 +137,16 @@ public override Task ProcessAsync(ExtensionContext context, ExtensionConfigurati
deployment.Annotations.Add("dapr.io/enabled", "true");
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
if (config.Data.TryGetValue("config", out var daprConfig) && daprConfig is object)
{
deployment.Annotations.TryAdd("dapr.io/config", daprConfig!.ToString() ?? string.Empty);
}
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() ?? string.Empty);
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions test/E2ETest/testassets/generate/dapr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ metadata:
dapr.io/enabled: 'true'
dapr.io/id: 'dapr_test_project'
dapr.io/port: '80'
dapr.io/config: 'tracing'
dapr.io/log-level: 'debug'
labels:
app.kubernetes.io/name: 'dapr_test_project'
app.kubernetes.io/part-of: 'dapr_test_application'
Expand All @@ -20,6 +22,8 @@ spec:
dapr.io/enabled: 'true'
dapr.io/id: 'dapr_test_project'
dapr.io/port: '80'
dapr.io/config: 'tracing'
dapr.io/log-level: 'debug'
labels:
app.kubernetes.io/name: 'dapr_test_project'
app.kubernetes.io/part-of: 'dapr_test_application'
Expand Down
2 changes: 2 additions & 0 deletions test/E2ETest/testassets/projects/dapr/tye.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: dapr_test_application
extensions:
- name: dapr
config: tracing
log-level: debug
services:
- name: dapr_test_project
project: dapr.csproj