Skip to content

docs: improve gRPC insecure connection guidance#6215

Merged
pichlermarc merged 2 commits intoopen-telemetry:mainfrom
zxzinn:docs/improve-grpc-insecure-connection-guidance
Mar 18, 2026
Merged

docs: improve gRPC insecure connection guidance#6215
pichlermarc merged 2 commits intoopen-telemetry:mainfrom
zxzinn:docs/improve-grpc-insecure-connection-guidance

Conversation

@zxzinn
Copy link
Copy Markdown
Contributor

@zxzinn zxzinn commented Dec 13, 2025

Which problem is this PR solving?

When connecting the gRPC exporter to a local OTLP collector (e.g., Phoenix, Jaeger) without TLS, developers encounter errors like:

14 UNAVAILABLE: No connection established.
Last error: SSL routines:ssl3_get_record:wrong version number

The README states "By default, plaintext connection is used" (line 47), which is outdated since v0.29.0. The exporter now defaults to secure connections, but there's no clear guidance on using insecure connections for local development.

Short description of the changes

  • Fixes outdated default behavior description
  • Adds two complete examples for insecure connections:
    • Using http:// URL scheme (recommended, simpler)
    • Using explicit credentials.createInsecure() (alternative)
  • Examples follow existing README style with full working code

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Checklist:

  • Followed the style guidelines of this project
  • Documentation has been updated

- Clarify that secure (TLS) connection is used by default
- Add example showing http:// scheme for insecure connections
- Add example with explicit insecure credentials configuration
- Update documentation to better guide local development setup
@zxzinn zxzinn requested a review from a team as a code owner December 13, 2025 14:44
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Dec 13, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.57%. Comparing base (a36e8e9) to head (9a0e3ab).
⚠️ Report is 174 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6215      +/-   ##
==========================================
+ Coverage   95.43%   95.57%   +0.14%     
==========================================
  Files         317      368      +51     
  Lines        9521    11795    +2274     
  Branches     2197     2751     +554     
==========================================
+ Hits         9086    11273    +2187     
- Misses        435      522      +87     

see 370 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions Bot added the stale label Feb 16, 2026
@github-actions github-actions Bot removed the stale label Feb 23, 2026
Comment on lines +47 to +86
By default, the exporter creates a secure (TLS) connection. When connecting to a local development collector without TLS, you can use an insecure connection by specifying the `http://` scheme in the URL:

```js
const { NodeTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');

const collectorOptions = {
url: 'http://localhost:4317', // http:// creates an insecure connection
};

const exporter = new OTLPTraceExporter(collectorOptions);
const provider = new NodeTracerProvider({
spanProcessors: [new SimpleSpanProcessor(exporter)]
});

provider.register();
```

Alternatively, you can explicitly configure insecure credentials:

```js
const grpc = require('@grpc/grpc-js');

const { NodeTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');

const collectorOptions = {
url: 'localhost:4317',
credentials: grpc.credentials.createInsecure(),
};

const exporter = new OTLPTraceExporter(collectorOptions);
const provider = new NodeTracerProvider({
spanProcessors: [new SimpleSpanProcessor(exporter)]
});

provider.register();
```

To use TLS in Node.js, provide `credentials` option like so:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hi @zxzinn - thanks for adding this, can you also add this to the metrics/logs grpc exporters? :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pichlermarc
Sure! I'll ping you again once I complete it, because I've been busy recently, thank you!

- Fix BatchRecordProcessor to BatchLogRecordProcessor in logs
  exporter example
- Add documentation for http:// scheme for insecure connections
- Add examples using grpc.credentials.createInsecure() for both
  logs and metrics exporters
const loggerExporter = new OTLPLogExporter(collectorOptions);
const loggerProvider = new LoggerProvider({
processors: [new BatchRecordProcessor(loggerExporter)]
processors: [new BatchLogRecordProcessor(loggerExporter)]
Copy link
Copy Markdown
Contributor Author

@zxzinn zxzinn Mar 6, 2026

Choose a reason for hiding this comment

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

The BatchRecordProcessor was undefined, BatchLogRecordProcessor is the right one.

@zxzinn
Copy link
Copy Markdown
Contributor Author

zxzinn commented Mar 6, 2026

@pichlermarc
Hi! I've added additional docs description in the exporters you mentioned, and I've also fixed a documentation bug where BatchRecordProcessor was used instead of BatchLogRecordProcessor, thanks for your patience!

Copy link
Copy Markdown
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

thanks!

@pichlermarc pichlermarc added this pull request to the merge queue Mar 18, 2026
Merged via the queue into open-telemetry:main with commit 84bfa90 Mar 18, 2026
27 checks passed
@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented Mar 18, 2026

Thank you for your contribution @zxzinn! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants