Skip to content

Commit

Permalink
Merge 0b4bd3a into 16c941d
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbley authored Feb 20, 2021
2 parents 16c941d + 0b4bd3a commit 22e5f7c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
5 changes: 4 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ module.exports = {
"leadingUnderscore": "require"
}
],
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["warn"],
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_", "args": "after-used"}],
"@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }],
"arrow-parens": ["error", "as-needed"],
Expand All @@ -43,7 +45,8 @@ module.exports = {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off"
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-shadow": ["off"],
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ export class HttpBaggage implements TextMapPropagator {
pairs.forEach(entry => {
const keyPair = this._parsePairKeyValue(entry);
if (keyPair) {
const entry: BaggageEntry = { value: keyPair.value };
const baggageEntry: BaggageEntry = { value: keyPair.value };
if (keyPair.metadata) {
entry.metadata = keyPair.metadata;
baggageEntry.metadata = keyPair.metadata;
}
baggage[keyPair.key] = entry;
baggage[keyPair.key] = baggageEntry;
}
});
if (Object.entries(baggage).length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ export function sendWithHttp<ExportItem, ServiceRequest>(
const request = parsedUrl.protocol === 'http:' ? http.request : https.request;

const req = request(options, (res: http.IncomingMessage) => {
let data = '';
res.on('data', chunk => (data += chunk));
let responseData = '';
res.on('data', chunk => (responseData += chunk));
res.on('end', () => {
if (res.statusCode && res.statusCode < 299) {
diag.debug(`statusCode: ${res.statusCode}`, data);
diag.debug(`statusCode: ${res.statusCode}`, responseData);
onSuccess();
} else {
const error = new collectorTypes.CollectorExporterError(
res.statusMessage,
res.statusCode,
data
responseData
);
onError(error);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-instrumentation-http/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
request.on(
'response',
(response: http.IncomingMessage & { aborted?: boolean }) => {
const attributes = utils.getOutgoingRequestAttributesOnResponse(
const responseAttributes = utils.getOutgoingRequestAttributesOnResponse(
response,
{ hostname }
);
span.setAttributes(attributes);
span.setAttributes(responseAttributes);
if (this._getConfig().responseHook) {
this._callResponseHook(span, response);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-metrics/src/Meter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ export class Meter implements api.Meter {
await Promise.all(observations);

// after this all remaining metrics can be run
const metrics = Array.from(this._metrics.values()).map(metric => {
const metricsRecords = Array.from(this._metrics.values()).map(metric => {
return metric.getMetricRecord();
});

await Promise.all(metrics).then(records => {
await Promise.all(metricsRecords).then(records => {
records.forEach(metrics => {
metrics.forEach(metric => this._processor.process(metric));
});
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-plugin-http/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ export class HttpPlugin extends BasePlugin<Http> {
request.on(
'response',
(response: IncomingMessage & { aborted?: boolean }) => {
const attributes = utils.getOutgoingRequestAttributesOnResponse(
const responseAttributes = utils.getOutgoingRequestAttributesOnResponse(
response,
{ hostname }
);
span.setAttributes(attributes);
span.setAttributes(responseAttributes);
if (this._config.responseHook) {
this._callResponseHook(span, response);
}
Expand Down

0 comments on commit 22e5f7c

Please sign in to comment.