Skip to content
This repository has been archived by the owner on Apr 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #85 from petemounce/read_domain_easier
Browse files Browse the repository at this point in the history
Make it easier to configure
  • Loading branch information
bvillanueva-mdsol authored Jul 18, 2016
2 parents e573030 + ce39713 commit 2896027
Show file tree
Hide file tree
Showing 6 changed files with 531 additions and 546 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ service/environment.
- **true**: Disables the ZipkinMiddleware/ZipkinMessageHandler
- `ZipkinBaseUri` - is the zipkin scribe/collector server URI with port to send the Spans
- `Domain` - is a valid public facing base url for your app instance. Zipkin will use to label the trace.
- by default this looks at the incoming requests and uses the hostname from them. It's a `Func<IOwinRequest, Uri>` - customise this to your requirements.
- `SpanProcessorBatchSize` - how many Spans should be sent to the zipkin scribe/collector in one go.
- `SampleRate` - 1 decimal point float value between 0 and 1. This value will determine randomly if the current request will be traced or not.
- `NotToBeDisplayedDomainList`(optional) - It will be used when logging host name by excluding these strings in service name attribute
Expand All @@ -38,7 +39,7 @@ service/environment.
var config = new ZipkinConfig
{
Bypass = request => request.Uri.AbsolutePath.StartsWith("/allowed"),
Domain = new Uri("https://yourservice.com"),
Domain = request => new Uri("https://yourservice.com"), // or, you might like to derive a value from the request, like r => new Uri($"{r.Scheme}{Uri.SchemeDelimiter}{r.Host}"),
ZipkinBaseUri = new Uri("http://zipkin.xyz.net:9411"),
SpanProcessorBatchSize = 10,
SampleRate = 0.5,
Expand Down
2 changes: 1 addition & 1 deletion src/Medidata.ZipkinTracer.Core/IZipkinConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface IZipkinConfig

Uri ZipkinBaseUri { get; set; }

Uri Domain { get; set; }
Func<IOwinRequest, Uri> Domain { get; set; }

uint SpanProcessorBatchSize { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Medidata.ZipkinTracer.Core/ZipkinClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ZipkinClient(IZipkinConfig zipkinConfig, IOwinContext context, SpanCollec
spanCollector,
new ServiceEndpoint(),
zipkinConfig.NotToBeDisplayedDomainList,
zipkinConfig.Domain);
zipkinConfig.Domain(context.Request));

TraceProvider = traceProvider;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Medidata.ZipkinTracer.Core/ZipkinConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ZipkinConfig : IZipkinConfig
{
public Predicate<IOwinRequest> Bypass { get; set; } = r => false;
public Uri ZipkinBaseUri { get; set; }
public Uri Domain { get; set; }
public Func<IOwinRequest, Uri> Domain { get; set; }
public uint SpanProcessorBatchSize { get; set; }
public IList<string> ExcludedPathList { get; set; } = new List<string>();
public double SampleRate { get; set; }
Expand All @@ -24,7 +24,7 @@ public void Validate()

if (Domain == null)
{
throw new ArgumentNullException("Domain");
Domain = request => new Uri(request.Uri.Host);
}

if (ExcludedPathList == null)
Expand Down
Loading

0 comments on commit 2896027

Please sign in to comment.