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

[Monitor] harden async try/catch #12563

Merged
merged 4 commits into from
Nov 19, 2020
Merged

Conversation

markwolff
Copy link
Contributor

No description provided.

@markwolff markwolff requested a review from xirzec as a code owner November 16, 2020 19:28
@ghost ghost added the Monitor Monitor, Monitor Ingestion, Monitor Query label Nov 16, 2020
@xirzec
Copy link
Member

xirzec commented Nov 16, 2020

This PR looks great but can we wait until after #12417 goes in so we don't accidentally lose the changes?

Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, just a couple comments.

const { _response: res } = await this._appInsightsClient.track(envelopes);
return { statusCode: res.status, result: res.bodyAsText ?? "" };
} catch (e) {
return { statusCode: 0, result: e?.message ?? "Error serializing envelope" };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have an alias for what statusCode: 0 means?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added StatusCode.Undefined to Constants. The ingestion server will never return this code and so I don't think it makes sense to move it to codegen, but it feels awkward having a one-off alias here. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean how is this code going to be documented so that the user can figure out what it means? Is there a different StatusCode that makes sense here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This status code is just meant to be a non-retriable error, but I'm not sure if another HTTP code make sense here. An OTel code could be used, but they are (were) grpc based, so they don't map well. Alternatively, I can just rethrow here and let the caller handle it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhhh it's an HTTP status code. I'm OK with 0 for this, other runtimes have used that for weird internal errors.

@xirzec
Copy link
Member

xirzec commented Nov 19, 2020

Some CI failues:

FAILURE (1)
================================
@microsoft/opentelemetry-exporter-azure-monitor (13.93 seconds)
An invalid connection string was passed in. There may be telemetry loss instrumentationkey=foo-ikey
[@microsoft/opentelemetry-exporter-azure-monitor] Returned error code: 1
An invalid connection string was passed in. There may be telemetry loss instrumentationkey=foo-ikey
An invalid connection string was passed in. There may be telemetry loss instrumentationkey=foo-ikey
An invalid connection string was passed in. There may be telemetry loss instrumentationkey=foo-ikey
An invalid connection string was passed in. There may be telemetry loss instrumentationkey=foo-ikey
An invalid connection string was passed in. There may be telemetry loss instrumentationkey=foo-ikey
{ [Error: ENOENT: no such file or directory, scandir 'C:\Users\VSSADM~1\AppData\Local\Temp\ot-azure-exporter-abc']
  errno: -4058,
  code: 'ENOENT',
  syscall: 'scandir',
  path:
   'C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\ot-azure-exporter-abc' }
{ [Error: ENOENT: no such file or directory, scandir 'C:\Users\VSSADM~1\AppData\Local\Temp\ot-azure-exporter-abc']
  errno: -4058,
  code: 'ENOENT',
  syscall: 'scandir',
  path:
   'C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\ot-azure-exporter-abc' }
================================

@markwolff markwolff merged commit 4ca1c77 into master Nov 19, 2020
@markwolff markwolff deleted the feature/monitor/harden-tests branch November 19, 2020 22:21
@jmealo
Copy link

jmealo commented Dec 9, 2020

@xirzec: Could we get these fixes tagged in a release on NPM? Thanks!

openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monitor Monitor, Monitor Ingestion, Monitor Query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants