Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2

* fix(opentelemetry-instrumentation): improve `_warnOnPreloadedModules` function not to show warning logs when the module is not marked as loaded [#6095](https://github.com/open-telemetry/opentelemetry-js/pull/6095) @rlj1202
* fix(sdk-trace-base): derive internal `SpanOptions` from API type to prevent drift [#6478](https://github.com/open-telemetry/opentelemetry-js/pull/6478) @overbalance
* fix(span): enforce `attributePerEventCountLimit`, `attributePerLinkCountLimit`, `linkCountLimit`, and `attributeValueLengthLimit` for event/link attributes [#6479](https://github.com/open-telemetry/opentelemetry-js/pull/6479) @overbalance

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.

Revert this unintended change

* fix(otlp-grpc-exporter-base): remove `headers` from gRPC exporter config type, passing headers now results in a compile-time error instead of being silently ignored [#6487](https://github.com/open-telemetry/opentelemetry-js/pull/6487)

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.

This is in the wrong place and replaces an existing entry rather than creating a new one. This should be under the :breaking: header in experimental/CHANGELOG.md. It is also not a bugfix so i'd consider switching this to be a refactor! type.


### :books: Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type { OTLPGRPCExporterConfigNode } from '../types';
import { diag } from '@opentelemetry/api';
import type { OtlpGrpcConfiguration } from './otlp-grpc-configuration';
import {
getOtlpGrpcDefaultConfiguration,
Expand All @@ -21,10 +20,6 @@ export function convertLegacyOtlpGrpcOptions(
config: OTLPGRPCExporterConfigNode,
signalIdentifier: string
): OtlpGrpcConfiguration {
if (config.headers) {
diag.warn('Headers cannot be set when using grpc');
}

// keep credentials locally in case user updates the reference on the config object
const userProvidedCredentials = config.credentials;
return mergeOtlpGrpcConfigurationWithDefaults(
Expand Down
11 changes: 5 additions & 6 deletions experimental/packages/otlp-grpc-exporter-base/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
*/

import type { ChannelCredentials, Metadata } from '@grpc/grpc-js';

import type {
CompressionAlgorithm,
OTLPExporterConfigBase,
} from '@opentelemetry/otlp-exporter-base';
import type { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base';

/**
* OTLP Exporter Config for Node
*/
export interface OTLPGRPCExporterConfigNode extends OTLPExporterConfigBase {
export interface OTLPGRPCExporterConfigNode {
url?: string;
concurrencyLimit?: number;
timeoutMillis?: number;

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.

These typically come from OTLPExporterConfigBase. If they're removed here we risk them becoming out of sync. It would be better to remove the bad header property from the base and add it specifically to the HTTP exporters. Alternatively you could use Omit<T, K> to remove it from the parent class before using it here.

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.

Switched to Omit<OTLPExporterConfigBase, 'headers'> and All tests passed. Pls review it.

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.

hmm, IMO it's a positive thing that they diverge:

  • they're different exporters and the same options (url in particular) behave differently based on whether they're used for gRPC or http, which makes them hard to document.
  • we also don't consume OTLPGRPCExporterConfigNode as OTLPExporterConfigBase anywhere anymore.
  • it makes it less likely that things are added to the base that unintentionally get added to the gRPC exporter's public API which can confuse users (like what happened to headers in this case).

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.

That makes sense! So should I revert back to the original approach (manually listing the fields with TS types) and drop the Omit change?

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.

We can do that in a follow up PR, your current change addresses what the linked issue was about. :)

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.

Sure!

credentials?: ChannelCredentials;
metadata?: Metadata;
compression?: CompressionAlgorithm;
Expand Down
13 changes: 1 addition & 12 deletions package-lock.json

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.

Unrelated change

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.