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

redis cleanup #195

Merged
merged 2 commits into from
Sep 8, 2020
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
2 changes: 1 addition & 1 deletion plugins/node/opentelemetry-plugin-redis/src/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { BasePlugin } from '@opentelemetry/core';
import * as redisTypes from 'redis';
import type * as redisTypes from 'redis';
import * as shimmer from 'shimmer';
import {
getTracedCreateClient,
Expand Down
7 changes: 1 addition & 6 deletions plugins/node/opentelemetry-plugin-redis/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import * as redisTypes from 'redis';
import { EventEmitter } from 'events';
import type * as redisTypes from 'redis';

// exported from
// https://github.com/NodeRedis/node_redis/blob/master/lib/command.js
Expand All @@ -35,7 +34,3 @@ export interface RedisPluginClientTypes {

address?: string;
}

export interface RedisPluginStreamTypes {
stream?: { get(): EventEmitter; set(val: EventEmitter): void };
}
12 changes: 4 additions & 8 deletions plugins/node/opentelemetry-plugin-redis/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@
* limitations under the License.
*/

import * as redisTypes from 'redis';
import type * as redisTypes from 'redis';
import { Tracer, SpanKind, Span, CanonicalCode } from '@opentelemetry/api';
import {
RedisPluginStreamTypes,
RedisPluginClientTypes,
RedisCommand,
} from './types';
import { RedisCommand, RedisPluginClientTypes } from './types';
import { EventEmitter } from 'events';
import { RedisPlugin } from './redis';
import {
Expand Down Expand Up @@ -51,7 +47,7 @@ export const getTracedCreateStreamTrace = (
tracer: Tracer,
original: Function
) => {
return function create_stream_trace(this: RedisPluginStreamTypes) {
return function create_stream_trace(this: redisTypes.RedisClient) {
if (!this.stream) {
Object.defineProperty(this, 'stream', {
get() {
Expand All @@ -72,7 +68,7 @@ export const getTracedInternalSendCommand = (
original: Function
) => {
return function internal_send_command_trace(
this: redisTypes.RedisClient & RedisPluginClientTypes,
this: RedisPluginClientTypes,
cmd?: RedisCommand
) {
// New versions of redis (2.4+) use a single options object
Expand Down