Skip to content

Commit

Permalink
fix: default url for otelcol (#1254)
Browse files Browse the repository at this point in the history
* fix: default url for otelcol

* docs: review example from default url otelcol

Co-authored-by: Mayur Kale <[email protected]>
  • Loading branch information
jufab and mayurkale22 authored Jun 29, 2020
1 parent 74a9e2c commit 5aa851a
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
receivers:
otlp:
endpoint: 0.0.0.0:55678
otlp: {}

exporters:
zipkin:
Expand Down
15 changes: 10 additions & 5 deletions examples/collector-exporter-node/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
version: "2"
version: "3"
services:

# Collector
collector:
image: omnition/opentelemetry-collector-contrib:0.2.8
image: otel/opentelemetry-collector:0.4.0
networks:
- otelcol
command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
volumes:
- ./collector-config.yaml:/conf/collector-config.yaml
ports:
- "55678:55678"
- "55680:55680"
depends_on:
- zipkin-all-in-one

# Zipkin
zipkin-all-in-one:
image: openzipkin/zipkin:latest
networks:
- otelcol
ports:
- "9411:9411"

networks:
otelcol:
2 changes: 1 addition & 1 deletion examples/collector-exporter-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "index.js",
"scripts": {
"start": "node ./start.js",
"docker:start": "cd ./docker && docker-compose down && docker-compose up",
"docker:start": "cd ./docker && docker-compose down && docker-compose up -d",
"docker:stop": "cd ./docker && docker-compose down"
},
"repository": {
Expand Down
5 changes: 3 additions & 2 deletions examples/collector-exporter-node/start.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
'use strict';

const opentelemetry = require('@opentelemetry/api');
const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tracing');
const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require('@opentelemetry/tracing');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector');

const address = '127.0.0.1:55678';
const address = '127.0.0.1:55680';
const exporter = new CollectorTraceExporter({
serviceName: 'basic-service',
url: address,
});

const provider = new BasicTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register();

const tracer = opentelemetry.trace.getTracer('example-collector-exporter-node');
Expand Down
8 changes: 4 additions & 4 deletions packages/opentelemetry-exporter-collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { WebTracerProvider } from '@opentelemetry/web';
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';

const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55678/v1/trace
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55680/v1/trace
headers: {}, //an optional object containing custom headers to be sent with each request
};

Expand All @@ -46,7 +46,7 @@ const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector')

const collectorOptions = {
serviceName: 'basic-service',
url: '<opentelemetry-collector-url>' // url is optional and can be omitted - default is localhost:55678
url: '<opentelemetry-collector-url>' // url is optional and can be omitted - default is localhost:55680
};

const provider = new BasicTracerProvider();
Expand All @@ -67,7 +67,7 @@ const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector')

const collectorOptions = {
serviceName: 'basic-service',
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is localhost:55678
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is localhost:55680
credentials: grpc.credentials.createSsl(
fs.readFileSync('./ca.crt'),
fs.readFileSync('./client.key'),
Expand Down Expand Up @@ -96,7 +96,7 @@ metadata.set('k', 'v');

const collectorOptions = {
serviceName: 'basic-service',
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is localhost:55678
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is localhost:55680
metadata, // // an optional grpc.Metadata object to be sent with each request
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { toCollectorExportTraceServiceRequest } from '../../transform';
import { CollectorExporterConfigBrowser } from '../../types';
import * as collectorTypes from '../../types';

const DEFAULT_COLLECTOR_URL = 'http://localhost:55678/v1/trace';
const DEFAULT_COLLECTOR_URL = 'http://localhost:55680/v1/trace';

/**
* Collector Exporter for Web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { toCollectorExportTraceServiceRequest } from '../../transform';
import { GRPCSpanQueueItem, ServiceClient } from './types';
import { removeProtocol } from './util';

const DEFAULT_COLLECTOR_URL = 'localhost:55678';
const DEFAULT_COLLECTOR_URL = 'localhost:55680';

/**
* Collector Trace Exporter for Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ describe('CollectorExporter - browser (getDefaultUrl)', () => {
setTimeout(() => {
assert.strictEqual(
collectorExporter['url'],
'http://localhost:55678/v1/trace'
'http://localhost:55680/v1/trace'
);
done();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe('CollectorExporter - node (getDefaultUrl)', () => {
it('should default to localhost', done => {
const collectorExporter = new CollectorTraceExporter({});
setTimeout(() => {
assert.strictEqual(collectorExporter['url'], 'localhost:55678');
assert.strictEqual(collectorExporter['url'], 'localhost:55680');
done();
});
});
Expand Down

0 comments on commit 5aa851a

Please sign in to comment.