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

Commit

Permalink
feat: add a default zipkin url (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoemery authored and kjin committed Aug 30, 2018
1 parent 5d42114 commit 13cab60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/opencensus-exporter-zipkin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ wget -O zipkin.jar 'https://search.maven.org/remote_content?g=io.zipkin.java&a=z
java -jar zipkin.jar
```

Instance the exporter on your application and pass the options. For javascript:
Instance the exporter on your application and pass the options, it must contain a service name and, optionaly, an URL. If no URL is passed, `http://localhost:9411/api/v2/spans` is used as default.

For javascript:

```javascript
var tracing = require('@opencensus/nodejs');
Expand Down
6 changes: 4 additions & 2 deletions packages/opencensus-exporter-zipkin/src/zipkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as http from 'http';
import * as url from 'url';

export interface ZipkinExporterOptions extends ExporterConfig {
url: string;
url?: string;
serviceName: string;
}

Expand All @@ -40,13 +40,15 @@ interface TranslatedSpan {

/** Zipkin Exporter manager class */
export class ZipkinTraceExporter implements Exporter {
static readonly DEFAULT_URL = 'http://localhost:9411/api/v2/spans';
private zipkinUrl: url.UrlWithStringQuery;
private serviceName: string;
buffer: ExporterBuffer;
logger: Logger;

constructor(options: ZipkinExporterOptions) {
this.zipkinUrl = url.parse(options.url);
this.zipkinUrl = options.url && url.parse(options.url) ||
url.parse(ZipkinTraceExporter.DEFAULT_URL);
this.serviceName = options.serviceName;
this.buffer = new ExporterBuffer(this, options);
this.logger = options.logger || logger.logger();
Expand Down

0 comments on commit 13cab60

Please sign in to comment.