Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(exporter-collector-grpc): incorrect URL format on docs after 0.20.0 update #2266

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions packages/opentelemetry-exporter-collector-grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');

const collectorOptions = {
// url is optional and can be omitted - default is localhost:4317
// url is optional and can be omitted - default is grpc://localhost:4317
url: '<collector-hostname>:<port>',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and elsewhere, this might be warranted

Suggested change
url: '<collector-hostname>:<port>',
url: '<collector-scheme>://<collector-hostname>:<port>',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, for this specific case, where the collector is grpc only, shouldn't we inform the use the required scheme is grpc? Or does it actually support other schemes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then it should be 'grpc://<collector-hostname>:<port>' right ?

};

Expand All @@ -51,7 +51,7 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');

const collectorOptions = {
// url is optional and can be omitted - default is localhost:4317
// url is optional and can be omitted - default is grpc://localhost:4317
url: '<collector-hostname>:<port>',
credentials: grpc.credentials.createSsl(),
};
Expand Down Expand Up @@ -91,7 +91,7 @@ const metadata = new grpc.Metadata();
metadata.set('k', 'v');

const collectorOptions = {
// url is optional and can be omitted - default is localhost:4317
// url is optional and can be omitted - default is grpc://localhost:4317
url: '<collector-hostname>:<port>',
metadata, // // an optional grpc.Metadata object to be sent with each request
};
Expand All @@ -116,7 +116,7 @@ The CollectorTraceExporter in Node expects the URL to only be the hostname. It w
const { MeterProvider } = require('@opentelemetry/metrics');
const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-grpc');
const collectorOptions = {
// url is optional and can be omitted - default is localhost:4317
// url is optional and can be omitted - default is grpc://localhost:4317
url: '<collector-hostname>:<port>',
};
const exporter = new CollectorMetricExporter(collectorOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { CollectorExporterNodeBase } from './CollectorExporterNodeBase';
import { getEnv } from '@opentelemetry/core';
import { validateAndNormalizeUrl } from './util';

const DEFAULT_COLLECTOR_URL = 'localhost:4317';
const DEFAULT_COLLECTOR_URL = 'grpc://localhost:4317';

/**
* Collector Metric Exporter for Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { CollectorExporterConfigNode, ServiceClientType } from './types';
import { getEnv } from '@opentelemetry/core';
import { validateAndNormalizeUrl } from './util';

const DEFAULT_COLLECTOR_URL = 'localhost:4317';
const DEFAULT_COLLECTOR_URL = 'grpc://localhost:4317';

/**
* Collector Trace Exporter for Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ describe('CollectorMetricExporter - node (getDefaultUrl)', () => {
it('should default to localhost', done => {
const collectorExporter = new CollectorMetricExporter({});
setTimeout(() => {
assert.strictEqual(collectorExporter['url'], 'localhost:4317');
assert.strictEqual(collectorExporter['url'], 'grpc://localhost:4317');
done();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ describe('CollectorTraceExporter - node (getDefaultUrl)', () => {
it('should default to localhost', done => {
const collectorExporter = new CollectorTraceExporter({});
setTimeout(() => {
assert.strictEqual(collectorExporter['url'], 'localhost:4317');
assert.strictEqual(collectorExporter['url'], 'grpc://localhost:4317');
done();
});
});
Expand Down