Content-Length: 271217 | pFad | http://github.com/dotnet/tye/pull/816/files/5ee1b10494066a94a83f250d08c6dc7179d0a637

31 Refactore zipkin extension by sirh3e · Pull Request #816 · dotnet/tye · GitHub
Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Refactore zipkin extension #816

Merged
merged 3 commits into from
Dec 1, 2020
Merged
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
49 changes: 29 additions & 20 deletions src/Microsoft.Tye.Extensions/Zipkin/ZipkinExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,48 @@ public override Task ProcessAsync(ExtensionContext context, ExtensionConfigurati
};
context.Application.Services.Add(service);

foreach (var s in context.Application.Services)
foreach (var serviceBuilder in context.Application.Services)
{
if (object.ReferenceEquals(s, service))
if (ReferenceEquals(serviceBuilder, service))
{
continue;
}

// make zipkin available as a dependency of everything.
if (!s.Dependencies.Contains(service.Name))
if (!serviceBuilder.Dependencies.Contains(service.Name))
{
s.Dependencies.Add(service.Name);
serviceBuilder.Dependencies.Add(service.Name);
}
}
}

if (context.Operation == ExtensionContext.OperationKind.LocalRun)
switch (context.Operation)
{
if (context.Options!.DistributedTraceProvider is null)
{
// For local development we hardcode the port and hostname
context.Options.DistributedTraceProvider = "zipkin=http://localhost:9411";
}
}
else if (context.Operation == ExtensionContext.OperationKind.Deploy)
{
foreach (var project in context.Application.Services.OfType<DotnetProjectServiceBuilder>())
{
var sidecar = DiagnosticAgent.GetOrAddSidecar(project);
case ExtensionContext.OperationKind.LocalRun:
{
if (context.Options!.DistributedTraceProvider is null)
{
// For local development we hardcode the port and hostname
context.Options.DistributedTraceProvider = "zipkin=http://localhost:9411";
}

// Use service discovery to find zipkin
sidecar.Args.Add("--provider:zipkin=service:zipkin");
sidecar.Dependencies.Add("zipkin");
}
break;
}
case ExtensionContext.OperationKind.Deploy:
{
foreach (var project in context.Application.Services.OfType<DotnetProjectServiceBuilder>())
{
var sidecar = DiagnosticAgent.GetOrAddSidecar(project);

// Use service discovery to find zipkin
sidecar.Args.Add("--provider:zipkin=service:zipkin");
sidecar.Dependencies.Add("zipkin");
}

break;
}
default:
throw new ArgumentOutOfRangeException();
}

return Task.CompletedTask;
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/dotnet/tye/pull/816/files/5ee1b10494066a94a83f250d08c6dc7179d0a637

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy