Skip to content

Commit

Permalink
Merge branch 'main' into rauno
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Jul 21, 2021
2 parents d1aea15 + 11719ed commit 3165e8b
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 47 deletions.
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
"project": "./tsconfig.json"
},
rules: {
"quotes": [2, "single", { "avoidEscape": true }],
"@typescript-eslint/no-floating-promises": 2,
"@typescript-eslint/no-this-alias": "off",
"brace-style": ["error", "1tbs"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
ServiceClientType,
} from './types';
import { ServiceClient } from './types';
import { getEnv, baggageUtils } from "@opentelemetry/core";
import { getEnv, baggageUtils } from '@opentelemetry/core';

/**
* Collector Metric Exporter abstract base class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { CollectorExporterConfigNode, ServiceClientType } from './types';
import { CollectorExporterNodeBase } from './CollectorExporterNodeBase';
import { baggageUtils, getEnv } from '@opentelemetry/core';
import { validateAndNormalizeUrl } from './util';
import { Metadata } from "@grpc/grpc-js";
import { Metadata } from '@grpc/grpc-js';

const DEFAULT_COLLECTOR_URL = 'localhost:4317';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import { CollectorExporterConfigNode, ServiceClientType } from './types';
import { baggageUtils, getEnv } from '@opentelemetry/core';
import { validateAndNormalizeUrl } from './util';
import { Metadata } from "@grpc/grpc-js";
import { Metadata } from '@grpc/grpc-js';

const DEFAULT_COLLECTOR_URL = 'localhost:4317';

Expand Down
32 changes: 16 additions & 16 deletions packages/opentelemetry-exporter-collector-grpc/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,31 +410,31 @@ export function ensureResourceIsCorrect(
assert.deepStrictEqual(resource, {
attributes: [
{
"key": "service.name",
"value": {
"stringValue": `unknown_service:${process.argv0}`,
"value": "stringValue"
'key': 'service.name',
'value': {
'stringValue': `unknown_service:${process.argv0}`,
'value': 'stringValue'
}
},
{
"key": "telemetry.sdk.language",
"value": {
"stringValue": "nodejs",
"value": "stringValue"
'key': 'telemetry.sdk.language',
'value': {
'stringValue': 'nodejs',
'value': 'stringValue'
}
},
{
"key": "telemetry.sdk.name",
"value": {
"stringValue": "opentelemetry",
"value": "stringValue"
'key': 'telemetry.sdk.name',
'value': {
'stringValue': 'opentelemetry',
'value': 'stringValue'
}
},
{
"key": "telemetry.sdk.version",
"value": {
"stringValue": VERSION,
"value": "stringValue"
'key': 'telemetry.sdk.version',
'value': {
'stringValue': VERSION,
'value': 'stringValue'
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-jaeger/src/jaeger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class JaegerExporter implements SpanExporter {
}

const serviceNameTag = span.tags.find(t => t.key === ResourceAttributes.SERVICE_NAME)
const serviceName = serviceNameTag?.vStr || "unknown_service";
const serviceName = serviceNameTag?.vStr || 'unknown_service';

sender.setProcess({
serviceName,
Expand Down
16 changes: 8 additions & 8 deletions packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ describe('JaegerExporter', () => {

const process: ThriftProcess = exporter['_getSender']({
tags: [{
key: "service.name",
vStr: "opentelemetry"
key: 'service.name',
vStr: 'opentelemetry'
}]
} as any)._process;
assert.strictEqual(exporter['_sender']._host, 'remotehost');
Expand All @@ -109,8 +109,8 @@ describe('JaegerExporter', () => {
const exporter = new JaegerExporter();
const sender = exporter['_getSender']({
tags: [{
key: "service.name",
vStr: "opentelemetry"
key: 'service.name',
vStr: 'opentelemetry'
}]
} as any);
assert.strictEqual(sender._host, 'localhost');
Expand All @@ -121,8 +121,8 @@ describe('JaegerExporter', () => {
const exporter = new JaegerExporter();
const sender = exporter['_getSender']({
tags: [{
key: "service.name",
vStr: "opentelemetry"
key: 'service.name',
vStr: 'opentelemetry'
}]
} as any);
assert.strictEqual(sender._host, 'env-set-host');
Expand All @@ -135,8 +135,8 @@ describe('JaegerExporter', () => {
});
const sender = exporter['_getSender']({
tags: [{
key: "service.name",
vStr: "opentelemetry"
key: 'service.name',
vStr: 'opentelemetry'
}]
} as any);
assert.strictEqual(sender._host, 'option-set-host');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { InstrumentationBase, registerInstrumentations } from '../../src';

class DummyTracerProvider implements TracerProvider {
getTracer(name: string, version?: string): Tracer {
throw new Error("not implemented");
throw new Error('not implemented');
}
}
class FooInstrumentation extends InstrumentationBase {
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-node/test/registration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('API registration', () => {
contextManager: null,
});

assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change");
assert.strictEqual(context['_getContextManager'](), ctxManager, 'context manager should not change');

assert.ok(
propagation['_getGlobalPropagator']() instanceof CompositePropagator
Expand Down
12 changes: 6 additions & 6 deletions packages/opentelemetry-sdk-node/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ describe('Node SDK', () => {

await sdk.start();

assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change");
assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, "propagator should not change");
assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, "tracer provider should not have changed");
assert.strictEqual(context['_getContextManager'](), ctxManager, 'context manager should not change');
assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, 'propagator should not change');
assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, 'tracer provider should not have changed');

assert.ok(metrics.getMeterProvider() instanceof NoopMeterProvider);
});
Expand Down Expand Up @@ -173,9 +173,9 @@ describe('Node SDK', () => {

await sdk.start();

assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change");
assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, "propagator should not change");
assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, "tracer provider should not have changed");
assert.strictEqual(context['_getContextManager'](), ctxManager, 'context manager should not change');
assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, 'propagator should not change');
assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, 'tracer provider should not have changed');

assert.ok(metrics.getMeterProvider() instanceof MeterProvider);
});
Expand Down
10 changes: 5 additions & 5 deletions packages/opentelemetry-shim-opentracing/src/shim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as api from '@opentelemetry/api';
import { SpanAttributes, SpanAttributeValue, SpanStatusCode, TextMapPropagator } from '@opentelemetry/api';
import * as opentracing from 'opentracing';
import { SemanticAttributes } from "@opentelemetry/semantic-conventions";
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';

function translateReferences(references: opentracing.Reference[]): api.Link[] {
const links: api.Link[] = [];
Expand Down Expand Up @@ -301,23 +301,23 @@ export class SpanShim extends opentracing.Span {
const entries = Object.entries(attributes);
const errorEntry = entries.find(([key]) => key === 'error.object');
const error = errorEntry?.[1];
if (typeof error === "string") {
if (typeof error === 'string') {
this._span.recordException(error, timestamp);
return;
}

const mappedAttributes: api.SpanAttributes = {};
for (const [k, v] of entries) {
switch (k) {
case "error.kind": {
case 'error.kind': {
mappedAttributes[SemanticAttributes.EXCEPTION_TYPE] = v;
break;
}
case "message": {
case 'message': {
mappedAttributes[SemanticAttributes.EXCEPTION_MESSAGE] = v;
break;
}
case "stack": {
case 'stack': {
mappedAttributes[SemanticAttributes.EXCEPTION_STACKTRACE] = v;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-shim-opentracing/test/Shim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
import { performance } from 'perf_hooks';
import { B3Propagator } from '@opentelemetry/propagator-b3';
import { JaegerPropagator } from '@opentelemetry/propagator-jaeger';
import { SemanticAttributes } from "@opentelemetry/semantic-conventions";
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';

describe('OpenTracing Shim', () => {
const compositePropagator = new CompositePropagator({
Expand Down
6 changes: 3 additions & 3 deletions packages/opentelemetry-tracing/test/common/Tracer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe('Tracer', () => {
tracerProvider
);

const spy = sinon.spy(tracer, "startSpan");
const spy = sinon.spy(tracer, 'startSpan');

assert.strictEqual(tracer.startActiveSpan('my-span', span => {
try {
Expand All @@ -259,7 +259,7 @@ describe('Tracer', () => {
tracerProvider
);

const spy = sinon.spy(tracer, "startSpan");
const spy = sinon.spy(tracer, 'startSpan');

assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, span => {
try {
Expand All @@ -283,7 +283,7 @@ describe('Tracer', () => {

const ctx = context.active().setValue(ctxKey, 'bar')

const spy = sinon.spy(tracer, "startSpan");
const spy = sinon.spy(tracer, 'startSpan');

assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, ctx, span => {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-web/test/registration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('API registration', () => {
contextManager: null,
});

assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change");
assert.strictEqual(context['_getContextManager'](), ctxManager, 'context manager should not change');

assert.ok(
propagation['_getGlobalPropagator']() instanceof CompositePropagator
Expand All @@ -84,7 +84,7 @@ describe('API registration', () => {
propagator: null,
});

assert.strictEqual(propagation["_getGlobalPropagator"](), propagator, "propagator should not change")
assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, 'propagator should not change')

assert.ok(context['_getContextManager']() instanceof StackContextManager);
const apiTracerProvider = trace.getTracerProvider() as ProxyTracerProvider;
Expand Down

0 comments on commit 3165e8b

Please sign in to comment.