Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud committed Apr 25, 2021
1 parent a7f1619 commit 124a8ee
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 32 deletions.
7 changes: 6 additions & 1 deletion src/api/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import { ProxyTracerProvider } from '../trace/ProxyTracerProvider';
import { Tracer } from '../trace/tracer';
import { TracerProvider } from '../trace/tracer_provider';
import { isSpanContextValid } from '../trace/spancontext-utils';
import { getSpan, getSpanContext, setSpan, setSpanContext } from '../trace/context-utils'
import {
getSpan,
getSpanContext,
setSpan,
setSpanContext,
} from '../trace/context-utils';
import {
getGlobal,
registerGlobal,
Expand Down
35 changes: 17 additions & 18 deletions src/baggage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ import { BaggageEntry, BaggageEntryMetadata } from './Entry';
import { BaggageImpl } from './internal/baggage';
import { baggageEntryMetadataSymbol } from './internal/symbol';
import { Context } from '../context/types';
import { createContextKey } from '../context/context'

import { createContextKey } from '../context/context';

export * from './Baggage';
export * from './Entry';

/**
* Baggage key
*/
const BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');
const BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');

/**
* Create a new Baggage with optional entries
Expand All @@ -41,21 +40,21 @@ export function createBaggage(
return new BaggageImpl(new Map(Object.entries(entries)));
}

/**
* @param {Context} Context that manage all context values
* @returns {Baggage} Extracted baggage from the context
*/
export function getBaggage(context: Context): Baggage | undefined {
return (context.getValue(BAGGAGE_KEY) as Baggage) || undefined;
}
/**
* @param {Context} Context that manage all context values
* @param {Baggage} baggage that will be set in the actual context
*/
export function setBaggage(context: Context, baggage: Baggage): Context {
return context.setValue(BAGGAGE_KEY, baggage);
}
/**
* @param {Context} Context that manage all context values
* @returns {Baggage} Extracted baggage from the context
*/
export function getBaggage(context: Context): Baggage | undefined {
return (context.getValue(BAGGAGE_KEY) as Baggage) || undefined;
}

/**
* @param {Context} Context that manage all context values
* @param {Baggage} baggage that will be set in the actual context
*/
export function setBaggage(context: Context, baggage: Baggage): Context {
return context.setValue(BAGGAGE_KEY, baggage);
}

/**
* Create a serializable BaggageEntryMetadata object from a string.
Expand Down
1 change: 0 additions & 1 deletion src/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import { Context } from './types';


/** Get a key to uniquely identify a context value */
export function createContextKey(description: string) {
return Symbol.for(description);
Expand Down
22 changes: 11 additions & 11 deletions src/trace/context-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* limitations under the License.
*/

import { createContextKey } from '../context/context'
import { Context } from '../context/types'
import { Span } from './span'
import { SpanContext } from './span_context'
import { NoopSpan } from './NoopSpan'
import { createContextKey } from '../context/context';
import { Context } from '../context/types';
import { Span } from './span';
import { SpanContext } from './span_context';
import { NoopSpan } from './NoopSpan';

/**
* span key
*/
const SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');
const SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');

/**
/**
* Shared key for indicating if instrumentation should be suppressed beyond
* this current scope.
*/
Expand All @@ -38,7 +38,7 @@ const SUPPRESS_INSTRUMENTATION_KEY = createContextKey(
*
* @param context context to get span from
*/
export function getSpan(context: Context): Span | undefined {
export function getSpan(context: Context): Span | undefined {
return (context.getValue(SPAN_KEY) as Span) || undefined;
}

Expand All @@ -59,7 +59,7 @@ export function setSpan(context: Context, span: Span): Context {
* @param context context to set active span on
* @param spanContext span context to be wrapped
*/
export function setSpanContext(
export function setSpanContext(
context: Context,
spanContext: SpanContext
): Context {
Expand All @@ -81,7 +81,7 @@ export function getSpanContext(context: Context): SpanContext | undefined {
*
* @param context context to set the suppress instrumentation value on.
*/
export function suppressInstrumentation(context: Context): Context {
export function suppressInstrumentation(context: Context): Context {
return context.setValue(SUPPRESS_INSTRUMENTATION_KEY, true);
}

Expand All @@ -103,4 +103,4 @@ export function unsuppressInstrumentation(context: Context): Context {
*/
export function isInstrumentationSuppressed(context: Context): boolean {
return Boolean(context.getValue(SUPPRESS_INSTRUMENTATION_KEY));
}
}
2 changes: 1 addition & 1 deletion test/trace/context-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
suppressInstrumentation,
unsuppressInstrumentation,
} from '../../src/trace/context-utils';
import { createContextKey, ROOT_CONTEXT} from '../../src/context/context'
import { createContextKey, ROOT_CONTEXT } from '../../src/context/context';

const SUPPRESS_INSTRUMENTATION_KEY = createContextKey(
'OpenTelemetry Context Key SUPPRESS_INSTRUMENTATION'
Expand Down

0 comments on commit 124a8ee

Please sign in to comment.