Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

0.7.0 beta testing fixes #120

Merged
merged 9 commits into from
Sep 8, 2023
Merged

0.7.0 beta testing fixes #120

merged 9 commits into from
Sep 8, 2023

Conversation

brettimus
Copy link
Collaborator

@brettimus brettimus commented Sep 7, 2023

This PR includes the following fixes:

Conditionally access the window object for push gateway exporter

The push gateway exporter has a reference to window, which won't be defined for serverless functions. I added a check to make sure window was defined before adding/removing event listeners to it.

Do not pass MAX_SAFE_INTEGER as an interval value

The push gateway and otlp-http exporters both used Number.MAX_SAFE_INTEGER for the PeriodicExportingMetricReader export interval. Because this value is ultimately passed to setInterval, we need to use a smaller value instead.

This is because setInterval and setTimeout represent the timeout value as a 32bit unsigned integer. So, MAX_SAFE_INTEGER will cause wrapping, leading to some funkiness. (See: MDN docs)

Wrap Deno.cwd() in a try/catch

It's possible for Deno.cwd to be defined (and even return "function" when passed to typeof), but if the Deno script was not given permissions to access the filesystem, then calling Deno.cwd() will throw an error. I uncovered this is in Supabase/Deno Deploy.

So, I added a try-catch there... as well as for process.cwd, just to be defensive (could remove that upon request)

@brettimus brettimus merged commit 83be8da into main Sep 8, 2023
@brettimus brettimus deleted the brett-beta-testing-fixes branch September 8, 2023 13:08
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants