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: avoid grpc types dependency #3551

Merged
merged 6 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :bug: (Bug Fix)

* fix: avoid grpc types dependency [#3551](https://github.com/open-telemetry/opentelemetry-js/pull/3551) @flarna
* fix(otlp-proto-exporter-base): Match Accept header with Content-Type in the proto exporter
[#3562](https://github.com/open-telemetry/opentelemetry-js/pull/3562) @scheler

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { CALL_SPAN_ENDED } from './serverUtils';
import { EventEmitter } from 'events';
import { AttributeNames } from '../enums/AttributeNames';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
import { metadataCaptureType } from '../types';
import { metadataCaptureType } from '../internal-types';
import { GRPC_STATUS_CODE_OK } from '../status-code';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
isWrapped,
} from '@opentelemetry/instrumentation';
import { InstrumentationBase } from '@opentelemetry/instrumentation';
import { GrpcInstrumentationConfig, metadataCaptureType } from '../types';
import { GrpcInstrumentationConfig } from '../types';
import { metadataCaptureType } from '../internal-types';
import {
ServerCallWithMeta,
SendUnaryDataCallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
findIndex,
} from '../utils';
import { AttributeNames } from '../enums/AttributeNames';
import { metadataCaptureType } from '../types';
import { metadataCaptureType } from '../internal-types';
import { GRPC_STATUS_CODE_OK } from '../status-code';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import {
SendUnaryDataCallback,
GrpcClientFunc,
} from './types';
import { GrpcInstrumentationConfig, metadataCaptureType } from '../types';
import { GrpcInstrumentationConfig } from '../types';
import { metadataCaptureType } from '../internal-types';
import {
context,
propagation,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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 { Span } from '@opentelemetry/api';
import type * as grpcJsTypes from '@grpc/grpc-js';
import type * as grpcTypes from 'grpc';

export type metadataCaptureType = {
client: {
captureRequestMetadata: (
span: Span,
metadata: grpcJsTypes.Metadata | grpcTypes.Metadata
) => void;
captureResponseMetadata: (
span: Span,
metadata: grpcJsTypes.Metadata | grpcTypes.Metadata
) => void;
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/

import { InstrumentationConfig } from '@opentelemetry/instrumentation';
import { Span } from '@opentelemetry/api';
import type * as grpcJsTypes from '@grpc/grpc-js';
import type * as grpcTypes from 'grpc';

export type IgnoreMatcher = string | RegExp | ((str: string) => boolean);

Expand All @@ -34,16 +31,3 @@ export interface GrpcInstrumentationConfig extends InstrumentationConfig {
};
};
}

export type metadataCaptureType = {
client: {
captureRequestMetadata: (
span: Span,
metadata: grpcJsTypes.Metadata | grpcTypes.Metadata
) => void;
captureResponseMetadata: (
span: Span,
metadata: grpcJsTypes.Metadata | grpcTypes.Metadata
) => void;
};
};