Skip to content

Commit

Permalink
Merge 72348fc into 8974678
Browse files Browse the repository at this point in the history
  • Loading branch information
Flarna authored Mar 2, 2021
2 parents 8974678 + 72348fc commit 575f4d6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
5 changes: 4 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ module.exports = {
},
rules: {
"@typescript-eslint/no-this-alias": "off",
"eqeqeq": "off",
"eqeqeq": [
"error",
"smart"
],
"prefer-rest-params": "off",
"@typescript-eslint/naming-convention": [
"error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export class HttpBaggage implements TextMapPropagator {

private _serializeKeyPairs(keyPairs: string[]) {
return keyPairs.reduce((hValue: string, current: string) => {
const value = `${hValue}${hValue != '' ? ITEMS_SEPARATOR : ''}${current}`;
const value = `${hValue}${
hValue !== '' ? ITEMS_SEPARATOR : ''
}${current}`;
return value.length > MAX_TOTAL_LENGTH ? hValue : value;
}, '');
}
Expand All @@ -81,7 +83,7 @@ export class HttpBaggage implements TextMapPropagator {
const headerValue: string = getter.get(carrier, BAGGAGE_HEADER) as string;
if (!headerValue) return context;
const baggage: Record<string, BaggageEntry> = {};
if (headerValue.length == 0) {
if (headerValue.length === 0) {
return context;
}
const pairs = headerValue.split(ITEMS_SEPARATOR);
Expand All @@ -107,7 +109,7 @@ export class HttpBaggage implements TextMapPropagator {
const keyPairPart = valueProps.shift();
if (!keyPairPart) return;
const keyPair = keyPairPart.split(KEY_PAIR_SEPARATOR);
if (keyPair.length != 2) return;
if (keyPair.length !== 2) return;
const key = decodeURIComponent(keyPair[0].trim());
const value = decodeURIComponent(keyPair[1].trim());
let metadata;
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/src/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function setLogLevelFromEnv(
const value = values[key];
if (typeof value === 'string') {
const theLevel = logLevelMap[value.toUpperCase()];
if (theLevel != undefined) {
if (theLevel != null) {
environment[key] = theLevel;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('transformMetrics', () => {
let count3 = 0;

function getValue(count: number) {
if (count % 2 == 0) {
if (count % 2 === 0) {
return 3;
}
return -1;
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-instrumentation-fetch/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class FetchInstrumentation extends InstrumentationBase<
): void {
const parsedUrl = web.parseUrl(response.url);
span.setAttribute(HttpAttribute.HTTP_STATUS_CODE, response.status);
if (response.statusText != undefined) {
if (response.statusText != null) {
span.setAttribute(HttpAttribute.HTTP_STATUS_TEXT, response.statusText);
}
span.setAttribute(HttpAttribute.HTTP_HOST, parsedUrl.host);
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-metrics/test/Meter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ describe('Meter', () => {

function getValue() {
console.log('getting value, counter:', counter);
if (++counter % 2 == 0) {
if (++counter % 2 === 0) {
return 3;
}
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const SAMPLED_VALUES = new Set(['d', '1']);
const DEBUG_STATE = 'd';

function convertToTraceId128(traceId: string): string {
return traceId.length == 32 ? traceId : `${PADDING}${traceId}`;
return traceId.length === 32 ? traceId : `${PADDING}${traceId}`;
}

function convertToTraceFlags(samplingState: string | undefined): TraceFlags {
Expand Down

0 comments on commit 575f4d6

Please sign in to comment.