-
Notifications
You must be signed in to change notification settings - Fork 803
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-*-otlp-grpc)!: lazy load gRPC #4432
fix(exporter-*-otlp-grpc)!: lazy load gRPC #4432
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4432 +/- ##
==========================================
- Coverage 92.39% 92.32% -0.07%
==========================================
Files 330 327 -3
Lines 9531 9462 -69
Branches 2036 2024 -12
==========================================
- Hits 8806 8736 -70
- Misses 725 726 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just a couple places I think clarifying comments would be a good idea.
getServiceClientType() { | ||
return ServiceClientType.LOGS; | ||
} | ||
|
||
getServiceProtoPath(): string { | ||
return 'opentelemetry/proto/collector/logs/v1/logs_service.proto'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: breaking change
getServiceClientType() { | ||
return ServiceClientType.SPANS; | ||
} | ||
|
||
getServiceProtoPath(): string { | ||
return 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: breaking
getServiceProtoPath(): string { | ||
return 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto'; | ||
} | ||
|
||
getServiceClientType(): ServiceClientType { | ||
return ServiceClientType.METRICS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: breaking
experimental/packages/otlp-grpc-exporter-base/src/grpc-exporter-transport.ts
Show resolved
Hide resolved
experimental/packages/otlp-grpc-exporter-base/src/grpc-exporter-transport.ts
Show resolved
Hide resolved
experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts
Show resolved
Hide resolved
experimental/packages/otlp-grpc-exporter-base/src/export-response.ts
Outdated
Show resolved
Hide resolved
experimental/packages/otlp-grpc-exporter-base/src/grpc-exporter-transport.ts
Show resolved
Hide resolved
experimental/packages/otlp-grpc-exporter-base/src/grpc-exporter-transport.ts
Show resolved
Hide resolved
experimental/packages/otlp-grpc-exporter-base/src/create-service-client-constructor.ts
Show resolved
Hide resolved
ad22981
to
02f703c
Compare
* fix(exporter-*-otlp-grpc)!: lazy load gRPC
Which problem is this PR solving?
We've had problems in the past with the gRPC exporters, as they do not lazy-require the
@grpc/grpc-js
library. This causes problems with@opentelemetry/instrumentation-grpc
and@opentelemetry/instrumentation-http
. This PR addresses this by re-structuring internals in a way that@grpc/grpc-js
is only required on the first export.Fixes #4151
Fixes #4266 (now loads gRPC on export, instead of the next tick, which means this should not happen anymore IF the SDK/exporter is shut down properly before the test environment is torn down).
Type of change
Breaking changes
Removes
getServiceClientType()
This affects
@opentelemetry/exporter-trace-otlp-grpc
@opentelemetry/exporter-logs-otlp-grpc
@opentelemetry/otlp-grpc-exporter-base
(intended for internal use only)It was previously possible to get the service client type (Traces, Metrics, Logs) from the exporter - this is now not possible anymore. This was used internally to construct a service client. Due to the restructuring of the internals in this PR, this is now not needed anymore.
Possible impact: low this returned a static string that did not change per-exporter.
Removes
getServiceProtoPath()
This affects
@opentelemetry/exporter-trace-otlp-grpc
@opentelemetry/exporter-logs-otlp-grpc
@opentelemetry/otlp-grpc-exporter-base
(intended for internal use only)It was previously possible to get the service proto path used by exporter - this is now not possible anymore. This was used internally to construct a service client. Due to the restructuring of the internals in this PR, this is now not needed anymore.
Possible impact: low this returned a static string that did not change per-exporter.
Removes
metadata
property, this affects@opentelemetry/exporter-trace-otlp-grpc
@opentelemetry/exporter-logs-otlp-grpc
@opentelemetry/otlp-grpc-exporter-base
(intended for internal use only)It was previously possible to edit metadata while the exporter is running. This is likely not an intended feature as the property was only read in the internal export code and tests, but only written by the exporters themselves.
Possible impact: medium users could have used the
metadata
property to dynamically modify metadata while the export is running.Removes
serviceClient
property, this affects@opentelemetry/exporter-trace-otlp-grpc
@opentelemetry/exporter-logs-otlp-grpc
@opentelemetry/otlp-grpc-exporter-base
(intended for internal use only)This was likely also intended for internal use but unintentionally exposed to users. It allowed full access to the internally used grpc service client.
Possible impact: unknown users could have used the service client directly to modify export behavior.
Removes
compression
property, this affects@opentelemetry/exporter-trace-otlp-grpc
@opentelemetry/exporter-logs-otlp-grpc
@opentelemetry/otlp-grpc-exporter-base
(intended for internal use only)This was likely also intended for internal use but unintentionally exposed to users. It allowed reading the compression property. It was read when a new service client was created, but changes to it would not affect the export.
Possible impact: low, if needed it can be read from the config that's passed to the constructor
How Has This Been Tested?