Skip to content

Commit

Permalink
feat(otlp-exporter-http): change otlp-http port to canonical 4318 (#2557
Browse files Browse the repository at this point in the history
)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
  • Loading branch information
secustor and dyladan authored Jan 20, 2022
1 parent 8bda25c commit e32879a
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 42 deletions.
13 changes: 9 additions & 4 deletions examples/basic-tracer-node/docker/ot/collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@ receivers:
protocols:
grpc:
http:
cors_allowed_origins:
- http://*
- https://*
cors:
allowed_origins:
- http://*
- https://*

exporters:
jaeger:
endpoint: jaeger-all-in-one:14250
insecure: true
tls:
insecure: true

processors:
batch:

service:
telemetry:
logs:
level: "debug"
pipelines:
traces:
receivers: [otlp]
Expand Down
8 changes: 4 additions & 4 deletions examples/basic-tracer-node/docker/ot/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ services:

# Collector
otel-collector:
image: otel/opentelemetry-collector:0.27.0
command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
image: otel/opentelemetry-collector-contrib:0.42.0
command: ["--config=/conf/collector-config.yaml"]
volumes:
- ./collector-config.yaml:/conf/collector-config.yaml
ports:
- "9464:9464"
- "4317:4317"
- "55681:55681"
- "4318:4318"
depends_on:
- jaeger-all-in-one

# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:1.22.0
image: jaegertracing/all-in-one:1.30.0
ports:
- "16686:16686"
- "14268:14268"
Expand Down
10 changes: 7 additions & 3 deletions examples/otlp-exporter-node/docker/collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ receivers:
protocols:
grpc:
http:
cors_allowed_origins:
- http://*
- https://*
cors:
allowed_origins:
- http://*
- https://*

exporters:
zipkin:
Expand All @@ -17,6 +18,9 @@ processors:
batch:

service:
telemetry:
logs:
level: "debug"
pipelines:
traces:
receivers: [otlp]
Expand Down
8 changes: 4 additions & 4 deletions examples/otlp-exporter-node/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ version: "3"
services:
# Collector
collector:
image: otel/opentelemetry-collector:0.25.0
# image: otel/opentelemetry-collector:latest
command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
image: otel/opentelemetry-collector-contrib:0.42.0
# image: otel/opentelemetry-collector-contrib:latest
command: ["--config=/conf/collector-config.yaml"]
volumes:
- ./collector-config.yaml:/conf/collector-config.yaml
ports:
- "9464:9464"
- "4317:4317"
- "55681:55681"
- "4318:4318"
depends_on:
- zipkin-all-in-one

Expand Down
4 changes: 2 additions & 2 deletions examples/otlp-exporter-node/metrics.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-http');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-http');
// const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-grpc');
// const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-proto');
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
Expand All @@ -12,7 +12,7 @@ const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventi
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);

const metricExporter = new OTLPMetricExporter({
// url: 'http://localhost:55681/v1/metrics',
url: 'http://localhost:4318/v1/metrics',
});

const meter = new MeterProvider({
Expand Down
21 changes: 12 additions & 9 deletions examples/otlp-exporter-node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "example-otlp-exporter-node",
"private": true,
"version": "0.25.0",
"version": "0.27.0",
"description": "Example of using @opentelemetry/collector-exporter in Node.js",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -29,14 +29,17 @@
},
"dependencies": {
"@opentelemetry/api": "^1.0.2",
"@opentelemetry/core": "0.25.0",
"@opentelemetry/exporter-otlp-http": "0.25.0",
"@opentelemetry/exporter-otlp-grpc": "0.25.0",
"@opentelemetry/exporter-otlp-proto": "0.25.0",
"@opentelemetry/resources": "0.25.0",
"@opentelemetry/semantic-conventions": "0.25.0",
"@opentelemetry/sdk-metrics-base": "0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0"
"@opentelemetry/core": "1.0.1",
"@opentelemetry/exporter-trace-otlp-http": "0.27.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.27.0",
"@opentelemetry/exporter-trace-otlp-grpc": "0.27.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "0.27.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.27.0",
"@opentelemetry/exporter-metrics-otlp-proto": "0.27.0",
"@opentelemetry/resources": "1.0.1",
"@opentelemetry/semantic-conventions": "1.0.1",
"@opentelemetry/sdk-metrics-base": "0.27.0",
"@opentelemetry/sdk-trace-base": "1.0.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
}
2 changes: 1 addition & 1 deletion examples/otlp-exporter-node/tracing.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const opentelemetry = require('@opentelemetry/api');
const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-http');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
// const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-grpc');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The OTLPMetricExporter in Web expects the endpoint to end in `/v1/metrics`.
import { MeterProvider } from '@opentelemetry/sdk-metrics-base';
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/metrics
headers: {}, // an optional object containing custom headers to be sent with each request
concurrencyLimit: 1, // an optional limit on pending requests
};
Expand All @@ -49,7 +49,7 @@ counter.add(10, { 'key': 'value' });
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-http');
const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/metrics
concurrencyLimit: 1, // an optional limit on pending requests
};
const exporter = new OTLPMetricExporter(collectorOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { toOTLPExportMetricServiceRequest } from '../../transformMetrics';
import { getEnv, baggageUtils } from '@opentelemetry/core';

const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;

/**
* Collector Metric Exporter for Web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { toOTLPExportMetricServiceRequest } from '../../transformMetrics';
import { getEnv, baggageUtils } from '@opentelemetry/core';

const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;

/**
* Collector Metric Exporter for Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ describe('OTLPMetricExporter - node with json over http', () => {
setTimeout(() => {
assert.strictEqual(
collectorExporter['url'],
'http://localhost:55681/v1/metrics'
'http://localhost:4318/v1/metrics'
);
done();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To see sample code and documentation for the traces exporter, visit the [Collect
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto');
const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/metrics
};
const exporter = new OTLPMetricExporter(collectorOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { ServiceClientType, OTLPExporterNodeBase } from '@opentelemetry/exporter
import { getEnv, baggageUtils } from '@opentelemetry/core';

const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics';
const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;

/**
* OTLP Metric Exporter for Node with protobuf
Expand Down
4 changes: 2 additions & 2 deletions packages/exporter-trace-otlp-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';

const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/traces
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/traces
headers: {}, // an optional object containing custom headers to be sent with each request
concurrencyLimit: 10, // an optional limit on pending requests
};
Expand Down Expand Up @@ -56,7 +56,7 @@ const { BasicTracerProvider, BatchSpanProcessor } = require('@opentelemetry/sdk-
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');

const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/traces
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/traces
headers: {
foo: 'bar'
}, // an optional object containing custom headers to be sent with each request will only work with http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { getEnv, baggageUtils } from '@opentelemetry/core';
import { appendResourcePathToUrlIfNotPresent } from '../../util';

const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces';
const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;

/**
* Collector Trace Exporter for Web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { getEnv, baggageUtils } from '@opentelemetry/core';
import { appendResourcePathToUrlIfNotPresent } from '../../util';

const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces';
const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;

/**
* Collector Trace Exporter for Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ describe('OTLPTraceExporter - browser (getDefaultUrl)', () => {
setTimeout(() => {
assert.strictEqual(
collectorExporter['url'],
'http://localhost:55681/v1/traces'
'http://localhost:4318/v1/traces'
);
done();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ describe('OTLPTraceExporter - node with json over http', () => {
setTimeout(() => {
assert.strictEqual(
collectorExporter['url'],
'http://localhost:55681/v1/traces'
'http://localhost:4318/v1/traces'
);
done();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/exporter-trace-otlp-proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto');

const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/traces
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/traces
headers: {
foo: 'bar'
}, //an optional object containing custom headers to be sent with each request will only work with http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { ServiceClientType } from './types';
import { getEnv, baggageUtils } from '@opentelemetry/core';

const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces';
const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`;

/**
* Collector Trace Exporter for Node with protobuf
Expand Down

0 comments on commit e32879a

Please sign in to comment.