-
Notifications
You must be signed in to change notification settings - Fork 978
feat(otlp-grpc-exporter-base): use statically generated protobuf code #3705
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
Merged
pichlermarc
merged 25 commits into
open-telemetry:main
from
dynatrace-oss-contrib:use-generated-grpc
Apr 28, 2023
+246
−72
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7bfd12a
feat(otlp-grpc-exporter-base): use generated protos
pichlermarc e5ce22e
feat(otlp-grpc-exporter-otlp): remove submodule step from postcompile
pichlermarc ac133ad
feat(otlp-grpc-exporter-otlp): address protos concurrency problem
pichlermarc a9c22ce
feat(otlp-grpc-exporter-otlp): undo re-ordering of scripts in package…
pichlermarc 56ca2d3
fix(changlog): add changelog entry
pichlermarc 0923df9
feat(otlp-grpc-exporter-otlp): move proto code generation script
pichlermarc 2ed678f
feat(otlp-grpc-exporter-otlp): delete copied proto script
pichlermarc 1f760dd
feat(otlp-grpc-exporter-otlp): remove unused client path from tsconfi…
pichlermarc ec3ccd0
feat(otlp-grpc-exporter-otlp): clean up
pichlermarc c6d01dd
feat(otlp-grpc-exporter-otlp): clean up
pichlermarc f285019
Merge branch 'main' into use-generated-grpc
pichlermarc 1f14ad2
feat(otlp-exporter-grpc-base): fix up package.json
pichlermarc 9bc203c
Merge branch 'main' into use-generated-grpc
pichlermarc c5bc39a
feat(otlp-exporter-grpc-base): remove protos from package
pichlermarc 84c39d4
feat(otlp-exporter-grpc-base): collapse serialization into one line
pichlermarc 3fd3e51
feat(otlp-exporter-grpc-base): rename ExportRequestType to ExportType
pichlermarc fbd2d28
feat(otlp-exporter-grpc-base): use type import for protobufjs
pichlermarc d62daab
feat(otlp-exporter-grpc-base): remove proto-loader dependency
pichlermarc 5e702fc
Merge branch 'main' into use-generated-grpc
pichlermarc 09ad75f
Merge branch 'main' into use-generated-grpc
pichlermarc ccad4b5
Merge branch 'main' into use-generated-grpc
dyladan 073b01a
feat(otlp-exporter-grpc-base): only run submodule once in top-level c…
pichlermarc 9891f60
Merge branch 'main' into use-generated-grpc
pichlermarc cd8dbfe
feat(otlp-grpc-exporter-base): add logs client
pichlermarc eb3bb5b
Merge branch 'main' into use-generated-grpc
pichlermarc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| src/generated/* | ||
| !src/generated/.gitkeep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
experimental/packages/otlp-grpc-exporter-base/src/LogsExportServiceClient.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import * as root from './generated/root'; | ||
| import * as grpc from '@grpc/grpc-js'; | ||
| import { IExportLogsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
| import { ExportType } from './internal-types'; | ||
| import IExportLogsServiceResponse = root.opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse; | ||
|
|
||
| const responseType = root.opentelemetry.proto.collector.logs.v1 | ||
| .ExportLogsServiceResponse as ExportType<IExportLogsServiceResponse>; | ||
|
|
||
| const requestType = root.opentelemetry.proto.collector.logs.v1 | ||
| .ExportLogsServiceRequest as ExportType<IExportLogsServiceRequest>; | ||
|
|
||
| const logsServiceDefinition = { | ||
| export: { | ||
| path: '/opentelemetry.proto.collector.logs.v1.LogsService/Export', | ||
| requestStream: false, | ||
| responseStream: false, | ||
| requestSerialize: (arg: IExportLogsServiceRequest) => { | ||
| return Buffer.from(requestType.encode(arg).finish()); | ||
| }, | ||
| requestDeserialize: (arg: Buffer) => { | ||
| return requestType.decode(arg); | ||
| }, | ||
| responseSerialize: (arg: IExportLogsServiceResponse) => { | ||
| return Buffer.from(responseType.encode(arg).finish()); | ||
| }, | ||
| responseDeserialize: (arg: Buffer) => { | ||
| return responseType.decode(arg); | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| // Creates a new instance of a gRPC service client for OTLP logs | ||
| export const LogsExportServiceClient: grpc.ServiceClientConstructor = | ||
| grpc.makeGenericClientConstructor(logsServiceDefinition, 'LogsExportService'); |
54 changes: 54 additions & 0 deletions
54
experimental/packages/otlp-grpc-exporter-base/src/MetricsExportServiceClient.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import * as root from './generated/root'; | ||
| import * as grpc from '@grpc/grpc-js'; | ||
| import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
| import { ExportType } from './internal-types'; | ||
| import IExportMetricsServiceResponse = root.opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse; | ||
|
|
||
| const responseType = root.opentelemetry.proto.collector.metrics.v1 | ||
dyladan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .ExportMetricsServiceResponse as ExportType<IExportMetricsServiceResponse>; | ||
|
|
||
| const requestType = root.opentelemetry.proto.collector.metrics.v1 | ||
| .ExportMetricsServiceRequest as ExportType<IExportMetricsServiceRequest>; | ||
|
|
||
| const metricsServiceDefinition = { | ||
| export: { | ||
| path: '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export', | ||
| requestStream: false, | ||
| responseStream: false, | ||
| requestSerialize: (arg: IExportMetricsServiceRequest) => { | ||
| return Buffer.from(requestType.encode(arg).finish()); | ||
| }, | ||
| requestDeserialize: (arg: Buffer) => { | ||
| return requestType.decode(arg); | ||
| }, | ||
| responseSerialize: (arg: IExportMetricsServiceResponse) => { | ||
| return Buffer.from(responseType.encode(arg).finish()); | ||
| }, | ||
| responseDeserialize: (arg: Buffer) => { | ||
| return responseType.decode(arg); | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| // Creates a new instance of a gRPC service client for OTLP metrics | ||
| export const MetricExportServiceClient: grpc.ServiceClientConstructor = | ||
| grpc.makeGenericClientConstructor( | ||
| metricsServiceDefinition, | ||
| 'MetricsExportService' | ||
| ); | ||
54 changes: 54 additions & 0 deletions
54
experimental/packages/otlp-grpc-exporter-base/src/TraceExportServiceClient.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import * as root from './generated/root'; | ||
| import * as grpc from '@grpc/grpc-js'; | ||
| import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer'; | ||
| import { ExportType } from './internal-types'; | ||
| import IExportTraceServiceResponse = root.opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse; | ||
|
|
||
| const responseType = root.opentelemetry.proto.collector.trace.v1 | ||
| .ExportTraceServiceResponse as ExportType<IExportTraceServiceResponse>; | ||
|
|
||
| const requestType = root.opentelemetry.proto.collector.trace.v1 | ||
| .ExportTraceServiceRequest as ExportType<IExportTraceServiceRequest>; | ||
|
|
||
| const traceServiceDefinition = { | ||
| export: { | ||
| path: '/opentelemetry.proto.collector.trace.v1.TraceService/Export', | ||
| requestStream: false, | ||
| responseStream: false, | ||
| requestSerialize: (arg: IExportTraceServiceRequest) => { | ||
| return Buffer.from(requestType.encode(arg).finish()); | ||
| }, | ||
| requestDeserialize: (arg: Buffer) => { | ||
| return requestType.decode(arg); | ||
| }, | ||
| responseSerialize: (arg: IExportTraceServiceResponse) => { | ||
| return Buffer.from(responseType.encode(arg).finish()); | ||
| }, | ||
| responseDeserialize: (arg: Buffer) => { | ||
| return responseType.decode(arg); | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| // Creates a new instance of a gRPC service client for exporting OTLP traces | ||
| export const TraceExportServiceClient: grpc.ServiceClientConstructor = | ||
| grpc.makeGenericClientConstructor( | ||
| traceServiceDefinition, | ||
| 'TraceExportService' | ||
| ); |
Empty file.
22 changes: 22 additions & 0 deletions
22
experimental/packages/otlp-grpc-exporter-base/src/internal-types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import type * as protobuf from 'protobufjs'; | ||
|
|
||
| export interface ExportType<T, R = T & { toJSON: () => unknown }> { | ||
| encode(message: T, writer?: protobuf.Writer): protobuf.Writer; | ||
| decode(reader: protobuf.Reader | Uint8Array, length?: number): R; | ||
| } | ||
dyladan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.