Compare commits

..

1 Commits

Author SHA1 Message Date
standardci
1322f99808 chore(release): publish new version
- @standardnotes/analytics@2.9.7
 - @standardnotes/api-gateway@1.38.2
 - @standardnotes/auth-server@1.59.8
 - @standardnotes/common@1.44.2
 - @standardnotes/domain-events-infra@1.9.24
 - @standardnotes/domain-events@2.86.1
 - @standardnotes/event-store@1.6.19
 - @standardnotes/files-server@1.8.19
 - @standardnotes/predicates@1.5.5
 - @standardnotes/scheduler-server@1.13.20
 - @standardnotes/security@1.6.2
 - @standardnotes/settings@1.18.1
 - @standardnotes/sncrypto-node@1.12.1
 - @standardnotes/syncing-server@1.13.3
 - @standardnotes/time@1.13.1
 - @standardnotes/websockets-server@1.4.21
 - @standardnotes/workspace-server@1.17.19
2022-11-14 09:08:49 +00:00
810 changed files with 7165 additions and 72665 deletions

View File

@@ -187,12 +187,12 @@ jobs:
tags: standardnotes/${{ inputs.service_name }}:${{ github.sha }}
- name: Run E2E test suite
uses: convictional/trigger-workflow-and-wait@master
uses: convictional/trigger-workflow-and-wait@v1.6.3
with:
owner: standardnotes
repo: self-hosted
repo: e2e
github_token: ${{ secrets.CI_PAT_TOKEN }}
workflow_file_name: testing-with-updating-client-and-server.yml
workflow_file_name: testing-with-stable-client.yml
wait_interval: 30
client_payload: '{"${{ inputs.e2e_tag_parameter_name }}": "${{ github.sha }}"}'
propagate_failure: true

View File

@@ -1,46 +0,0 @@
name: Revisions Server
concurrency:
group: revisions_server
cancel-in-progress: true
on:
push:
tags:
- '*standardnotes/revisions-server*'
workflow_dispatch:
jobs:
call_server_application_workflow:
name: Server Application
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
with:
service_name: revisions
workspace_name: "@standardnotes/revisions-server"
e2e_tag_parameter_name: revisions_image_tag
package_path: packages/revisions
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Web
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_REVISIONS_WEB_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"
- name: Create New Relic deployment marker for Worker
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_REVISIONS_WORKER_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

2
.nvmrc
View File

@@ -1 +1 @@
18.12.1
16.15.1

704
.pnp.cjs generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +0,0 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 120,
"semi": false
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -326,8 +326,8 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
endif
quiet_cmd_regen_makefile = ACTION Regenerating $@
cmd_regen_makefile = cd $(srcdir); /Users/karolsojko/workspace/server/.yarn/unplugged/node-gyp-npm-9.0.0-0eccfca4d1/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/karolsojko/Library/Caches/node-gyp/18.12.1" "-Dnode_gyp_dir=/Users/karolsojko/workspace/server/.yarn/unplugged/node-gyp-npm-9.0.0-0eccfca4d1/node_modules/node-gyp" "-Dnode_lib_file=/Users/karolsojko/Library/Caches/node-gyp/18.12.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/karolsojko/workspace/server/.yarn/unplugged/@newrelic-native-metrics-npm-9.0.0-590d2e713a/node_modules/@newrelic/native-metrics" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/Users/karolsojko/workspace/server/.yarn/unplugged/@newrelic-native-metrics-npm-9.0.0-590d2e713a/node_modules/@newrelic/native-metrics/build/config.gypi -I/Users/karolsojko/workspace/server/.yarn/unplugged/node-gyp-npm-9.0.0-0eccfca4d1/node_modules/node-gyp/addon.gypi -I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/include/node/common.gypi "--toplevel-dir=." binding.gyp
Makefile: $(srcdir)/build/config.gypi $(srcdir)/../../../../node-gyp-npm-9.0.0-0eccfca4d1/node_modules/node-gyp/addon.gypi $(srcdir)/../../../../../../../../Library/Caches/node-gyp/18.12.1/include/node/common.gypi $(srcdir)/binding.gyp
cmd_regen_makefile = cd $(srcdir); /Users/karolsojko/workspace/server/.yarn/unplugged/node-gyp-npm-9.0.0-0eccfca4d1/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/karolsojko/Library/Caches/node-gyp/16.15.1" "-Dnode_gyp_dir=/Users/karolsojko/workspace/server/.yarn/unplugged/node-gyp-npm-9.0.0-0eccfca4d1/node_modules/node-gyp" "-Dnode_lib_file=/Users/karolsojko/Library/Caches/node-gyp/16.15.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/karolsojko/workspace/server/.yarn/unplugged/@newrelic-native-metrics-npm-9.0.0-590d2e713a/node_modules/@newrelic/native-metrics" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/Users/karolsojko/workspace/server/.yarn/unplugged/@newrelic-native-metrics-npm-9.0.0-590d2e713a/node_modules/@newrelic/native-metrics/build/config.gypi -I/Users/karolsojko/workspace/server/.yarn/unplugged/node-gyp-npm-9.0.0-0eccfca4d1/node_modules/node-gyp/addon.gypi -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/common.gypi "--toplevel-dir=." binding.gyp
Makefile: $(srcdir)/binding.gyp $(srcdir)/../../../../node-gyp-npm-9.0.0-0eccfca4d1/node_modules/node-gyp/addon.gypi $(srcdir)/../../../../../../../../Library/Caches/node-gyp/16.15.1/include/node/common.gypi $(srcdir)/build/config.gypi
$(call do_cmd,regen_makefile)
# "all" is a concatenation of the "all" targets from all the included

View File

@@ -0,0 +1 @@
cmd_Release/native_metrics.node := c++ -bundle -undefined dynamic_lookup -Wl,-search_paths_first -mmacosx-version-min=10.13 -arch x86_64 -L./Release -stdlib=libc++ -o Release/native_metrics.node Release/obj.target/native_metrics/src/native_metrics.o Release/obj.target/native_metrics/src/GCBinder.o Release/obj.target/native_metrics/src/LoopChecker.o

View File

@@ -0,0 +1,69 @@
cmd_Release/obj.target/native_metrics/src/GCBinder.o := c++ -o Release/obj.target/native_metrics/src/GCBinder.o ../src/GCBinder.cpp '-DNODE_GYP_MODULE_NAME=native_metrics' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNOMINMAX' '-DBUILDING_NODE_EXTENSION' -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/src -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/config -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/openssl/include -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/uv/include -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/zlib -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/v8/include -I../src -I../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan -O3 -gdwarf-2 -mmacosx-version-min=10.13 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++14 -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/native_metrics/src/GCBinder.o.d.raw -c
Release/obj.target/native_metrics/src/GCBinder.o: ../src/GCBinder.cpp \
../src/GCBinder.hpp \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/errno.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/unix.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/threadpool.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/darwin.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/cppgc/common.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8config.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-internal.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-platform.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_buffer.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_object_wrap.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_maybe_43_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters_43_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_new.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_implementation_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_persistent_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_weak.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_object_wrap.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_private.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_typedarray_contents.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_json.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_scriptorigin.h \
../src/Metric.hpp
../src/GCBinder.cpp:
../src/GCBinder.hpp:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/errno.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/unix.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/threadpool.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/darwin.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/cppgc/common.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8config.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-internal.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-platform.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_buffer.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_object_wrap.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_maybe_43_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters_43_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_new.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_implementation_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_persistent_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_weak.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_object_wrap.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_private.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_typedarray_contents.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_json.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_scriptorigin.h:
../src/Metric.hpp:

View File

@@ -0,0 +1,70 @@
cmd_Release/obj.target/native_metrics/src/LoopChecker.o := c++ -o Release/obj.target/native_metrics/src/LoopChecker.o ../src/LoopChecker.cpp '-DNODE_GYP_MODULE_NAME=native_metrics' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNOMINMAX' '-DBUILDING_NODE_EXTENSION' -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/src -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/config -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/openssl/include -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/uv/include -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/zlib -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/v8/include -I../src -I../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan -O3 -gdwarf-2 -mmacosx-version-min=10.13 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++14 -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/native_metrics/src/LoopChecker.o.d.raw -c
Release/obj.target/native_metrics/src/LoopChecker.o: \
../src/LoopChecker.cpp \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/errno.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/unix.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/threadpool.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/darwin.h \
../src/LoopChecker.hpp \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/cppgc/common.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8config.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-internal.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-platform.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_buffer.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_object_wrap.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_maybe_43_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters_43_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_new.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_implementation_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_persistent_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_weak.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_object_wrap.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_private.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_typedarray_contents.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_json.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_scriptorigin.h \
../src/Metric.hpp
../src/LoopChecker.cpp:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/errno.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/unix.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/threadpool.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/darwin.h:
../src/LoopChecker.hpp:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/cppgc/common.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8config.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-internal.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-platform.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_buffer.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_object_wrap.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_maybe_43_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters_43_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_new.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_implementation_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_persistent_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_weak.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_object_wrap.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_private.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_typedarray_contents.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_json.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_scriptorigin.h:
../src/Metric.hpp:

View File

@@ -0,0 +1,70 @@
cmd_Release/obj.target/native_metrics/src/native_metrics.o := c++ -o Release/obj.target/native_metrics/src/native_metrics.o ../src/native_metrics.cpp '-DNODE_GYP_MODULE_NAME=native_metrics' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNOMINMAX' '-DBUILDING_NODE_EXTENSION' -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/src -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/config -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/openssl/include -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/uv/include -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/zlib -I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/v8/include -I../src -I../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan -O3 -gdwarf-2 -mmacosx-version-min=10.13 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++14 -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/native_metrics/src/native_metrics.o.d.raw -c
Release/obj.target/native_metrics/src/native_metrics.o: \
../src/native_metrics.cpp \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/errno.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/unix.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/threadpool.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/darwin.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/cppgc/common.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8config.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-internal.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-version.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-platform.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_buffer.h \
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_object_wrap.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_maybe_43_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters_43_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_new.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_implementation_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_persistent_12_inl.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_weak.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_object_wrap.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_private.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_typedarray_contents.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_json.h \
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_scriptorigin.h \
../src/GCBinder.hpp ../src/Metric.hpp ../src/LoopChecker.hpp
../src/native_metrics.cpp:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/errno.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/unix.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/threadpool.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/uv/darwin.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/cppgc/common.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8config.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-internal.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-version.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/v8-platform.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_buffer.h:
/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node/node_object_wrap.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_callbacks_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_maybe_43_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_converters_43_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_new.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_implementation_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_persistent_12_inl.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_weak.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_object_wrap.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_private.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_typedarray_contents.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_json.h:
../../../../../nan-npm-2.16.0-cac314a230/node_modules/nan/nan_scriptorigin.h:
../src/GCBinder.hpp:
../src/Metric.hpp:
../src/LoopChecker.hpp:

View File

@@ -19,316 +19,293 @@
"error_on_warn": "false",
"force_dynamic_crt": 0,
"host_arch": "x64",
"icu_data_in": "../../deps/icu-tmp/icudt71l.dat",
"icu_data_in": "../../deps/icu-tmp/icudt70l.dat",
"icu_endianness": "l",
"icu_gyp_path": "tools/icu/icu-generic.gyp",
"icu_path": "deps/icu-small",
"icu_small": "false",
"icu_ver_major": "71",
"icu_ver_major": "70",
"is_debug": 0,
"libdir": "lib",
"llvm_version": "11.0",
"napi_build_version": "8",
"node_byteorder": "little",
"node_debug_lib": "false",
"node_enable_d8": "false",
"node_fipsinstall": "false",
"node_install_corepack": "true",
"node_install_npm": "true",
"node_library_files": [
"lib/_http_agent.js",
"lib/_http_client.js",
"lib/_http_common.js",
"lib/_http_incoming.js",
"lib/_http_outgoing.js",
"lib/_http_server.js",
"lib/_stream_duplex.js",
"lib/_stream_passthrough.js",
"lib/_stream_readable.js",
"lib/_stream_transform.js",
"lib/_stream_wrap.js",
"lib/_stream_writable.js",
"lib/_tls_common.js",
"lib/_tls_wrap.js",
"lib/assert.js",
"lib/assert/strict.js",
"lib/async_hooks.js",
"lib/buffer.js",
"lib/child_process.js",
"lib/cluster.js",
"lib/console.js",
"lib/constants.js",
"lib/crypto.js",
"lib/dgram.js",
"lib/diagnostics_channel.js",
"lib/dns.js",
"lib/dns/promises.js",
"lib/domain.js",
"lib/events.js",
"lib/fs.js",
"lib/fs/promises.js",
"lib/http.js",
"lib/http2.js",
"lib/https.js",
"lib/inspector.js",
"lib/internal/abort_controller.js",
"lib/internal/assert.js",
"lib/internal/assert/assertion_error.js",
"lib/internal/assert/calltracker.js",
"lib/internal/assert/snapshot.js",
"lib/internal/async_hooks.js",
"lib/internal/blob.js",
"lib/internal/blocklist.js",
"lib/internal/bootstrap/browser.js",
"lib/internal/bootstrap/loaders.js",
"lib/internal/bootstrap/node.js",
"lib/internal/bootstrap/switches/does_not_own_process_state.js",
"lib/internal/bootstrap/switches/does_own_process_state.js",
"lib/internal/bootstrap/switches/is_main_thread.js",
"lib/internal/bootstrap/switches/is_not_main_thread.js",
"lib/internal/buffer.js",
"lib/internal/child_process.js",
"lib/internal/child_process/serialization.js",
"lib/internal/cli_table.js",
"lib/internal/cluster/child.js",
"lib/internal/cluster/primary.js",
"lib/internal/cluster/round_robin_handle.js",
"lib/internal/cluster/shared_handle.js",
"lib/internal/cluster/utils.js",
"lib/internal/cluster/worker.js",
"lib/internal/console/constructor.js",
"lib/internal/console/global.js",
"lib/internal/constants.js",
"lib/internal/crypto/aes.js",
"lib/internal/crypto/certificate.js",
"lib/internal/crypto/cfrg.js",
"lib/internal/crypto/cipher.js",
"lib/internal/crypto/diffiehellman.js",
"lib/internal/crypto/ec.js",
"lib/internal/crypto/hash.js",
"lib/internal/crypto/hashnames.js",
"lib/internal/crypto/hkdf.js",
"lib/internal/crypto/keygen.js",
"lib/internal/crypto/keys.js",
"lib/internal/crypto/mac.js",
"lib/internal/crypto/pbkdf2.js",
"lib/internal/crypto/random.js",
"lib/internal/crypto/rsa.js",
"lib/internal/crypto/scrypt.js",
"lib/internal/crypto/sig.js",
"lib/internal/crypto/util.js",
"lib/internal/crypto/webcrypto.js",
"lib/internal/crypto/x509.js",
"lib/internal/debugger/inspect.js",
"lib/internal/debugger/inspect_client.js",
"lib/internal/debugger/inspect_repl.js",
"lib/internal/dgram.js",
"lib/internal/dns/callback_resolver.js",
"lib/internal/dns/promises.js",
"lib/internal/dns/utils.js",
"lib/internal/dtrace.js",
"lib/internal/encoding.js",
"lib/internal/error_serdes.js",
"lib/internal/errors.js",
"lib/internal/event_target.js",
"lib/internal/fixed_queue.js",
"lib/internal/freelist.js",
"lib/internal/freeze_intrinsics.js",
"lib/internal/fs/cp/cp-sync.js",
"lib/internal/fs/cp/cp.js",
"lib/internal/fs/dir.js",
"lib/internal/fs/promises.js",
"lib/internal/fs/read_file_context.js",
"lib/internal/fs/rimraf.js",
"lib/internal/fs/streams.js",
"lib/internal/fs/sync_write_stream.js",
"lib/internal/fs/utils.js",
"lib/internal/fs/watchers.js",
"lib/internal/heap_utils.js",
"lib/internal/histogram.js",
"lib/internal/http.js",
"lib/internal/http2/compat.js",
"lib/internal/http2/core.js",
"lib/internal/http2/util.js",
"lib/internal/idna.js",
"lib/internal/inspector_async_hook.js",
"lib/internal/js_stream_socket.js",
"lib/internal/legacy/processbinding.js",
"lib/internal/linkedlist.js",
"lib/internal/main/check_syntax.js",
"lib/internal/main/environment.js",
"lib/internal/main/eval_stdin.js",
"lib/internal/main/eval_string.js",
"lib/internal/main/inspect.js",
"lib/internal/main/mksnapshot.js",
"lib/internal/main/print_help.js",
"lib/internal/main/prof_process.js",
"lib/internal/main/repl.js",
"lib/internal/main/run_main_module.js",
"lib/internal/main/test_runner.js",
"lib/internal/main/watch_mode.js",
"lib/internal/main/worker_thread.js",
"lib/internal/modules/cjs/helpers.js",
"lib/internal/modules/cjs/loader.js",
"lib/internal/modules/esm/assert.js",
"lib/internal/modules/esm/create_dynamic_module.js",
"lib/internal/modules/esm/fetch_module.js",
"lib/internal/modules/esm/formats.js",
"lib/internal/modules/esm/get_format.js",
"lib/internal/modules/esm/handle_process_exit.js",
"lib/internal/modules/esm/initialize_import_meta.js",
"lib/internal/modules/esm/load.js",
"lib/internal/modules/esm/loader.js",
"lib/internal/modules/esm/module_job.js",
"lib/internal/modules/esm/module_map.js",
"lib/internal/modules/esm/package_config.js",
"lib/internal/modules/esm/resolve.js",
"lib/internal/modules/esm/translators.js",
"lib/internal/modules/package_json_reader.js",
"lib/internal/modules/run_main.js",
"lib/internal/net.js",
"lib/internal/options.js",
"lib/internal/per_context/domexception.js",
"lib/internal/per_context/messageport.js",
"lib/internal/per_context/primordials.js",
"lib/internal/perf/event_loop_delay.js",
"lib/internal/perf/event_loop_utilization.js",
"lib/internal/perf/nodetiming.js",
"lib/internal/perf/observe.js",
"lib/internal/perf/performance.js",
"lib/internal/perf/performance_entry.js",
"lib/internal/perf/resource_timing.js",
"lib/internal/perf/timerify.js",
"lib/internal/perf/usertiming.js",
"lib/internal/perf/utils.js",
"lib/internal/policy/manifest.js",
"lib/internal/policy/sri.js",
"lib/internal/priority_queue.js",
"lib/internal/process/esm_loader.js",
"lib/internal/process/execution.js",
"lib/internal/process/per_thread.js",
"lib/internal/process/policy.js",
"lib/internal/process/pre_execution.js",
"lib/internal/process/promises.js",
"lib/internal/process/report.js",
"lib/internal/process/signal.js",
"lib/internal/process/task_queues.js",
"lib/internal/process/warning.js",
"lib/internal/process/worker_thread_only.js",
"lib/internal/promise_hooks.js",
"lib/internal/querystring.js",
"lib/internal/readline/callbacks.js",
"lib/internal/readline/emitKeypressEvents.js",
"lib/internal/readline/interface.js",
"lib/internal/readline/promises.js",
"lib/internal/readline/utils.js",
"lib/internal/repl.js",
"lib/internal/repl/await.js",
"lib/internal/repl/history.js",
"lib/internal/repl/utils.js",
"lib/internal/socket_list.js",
"lib/internal/socketaddress.js",
"lib/internal/source_map/prepare_stack_trace.js",
"lib/internal/source_map/source_map.js",
"lib/internal/source_map/source_map_cache.js",
"lib/internal/stream_base_commons.js",
"lib/internal/streams/add-abort-signal.js",
"lib/internal/streams/buffer_list.js",
"lib/internal/streams/compose.js",
"lib/internal/streams/destroy.js",
"lib/internal/streams/duplex.js",
"lib/internal/streams/duplexify.js",
"lib/internal/streams/end-of-stream.js",
"lib/internal/streams/from.js",
"lib/internal/streams/lazy_transform.js",
"lib/internal/streams/legacy.js",
"lib/internal/streams/operators.js",
"lib/internal/streams/passthrough.js",
"lib/internal/streams/pipeline.js",
"lib/internal/streams/readable.js",
"lib/internal/streams/state.js",
"lib/internal/streams/transform.js",
"lib/internal/streams/utils.js",
"lib/internal/streams/writable.js",
"lib/internal/structured_clone.js",
"lib/internal/test/binding.js",
"lib/internal/test/transfer.js",
"lib/internal/test_runner/harness.js",
"lib/internal/test_runner/runner.js",
"lib/internal/test_runner/tap_stream.js",
"lib/internal/test_runner/test.js",
"lib/internal/test_runner/utils.js",
"lib/internal/timers.js",
"lib/internal/tls/secure-context.js",
"lib/internal/tls/secure-pair.js",
"lib/internal/trace_events_async_hooks.js",
"lib/internal/tty.js",
"lib/internal/url.js",
"lib/internal/util.js",
"lib/internal/util/colors.js",
"lib/internal/util/comparisons.js",
"lib/internal/util/debuglog.js",
"lib/internal/util/inspect.js",
"lib/internal/util/inspector.js",
"lib/internal/util/iterable_weak_map.js",
"lib/internal/util/parse_args/parse_args.js",
"lib/internal/util/parse_args/utils.js",
"lib/internal/util/types.js",
"lib/internal/v8/startup_snapshot.js",
"lib/internal/v8_prof_polyfill.js",
"lib/internal/v8_prof_processor.js",
"lib/internal/validators.js",
"lib/internal/vm/module.js",
"lib/internal/wasm_web_api.js",
"lib/internal/watch_mode/files_watcher.js",
"lib/internal/watchdog.js",
"lib/internal/webstreams/adapters.js",
"lib/internal/webstreams/compression.js",
"lib/internal/webstreams/encoding.js",
"lib/internal/webstreams/queuingstrategies.js",
"lib/internal/webstreams/readablestream.js",
"lib/internal/webstreams/transfer.js",
"lib/internal/webstreams/transformstream.js",
"lib/internal/webstreams/util.js",
"lib/internal/webstreams/writablestream.js",
"lib/internal/worker.js",
"lib/internal/worker/io.js",
"lib/internal/worker/js_transferable.js",
"lib/module.js",
"lib/net.js",
"lib/os.js",
"lib/path.js",
"lib/path/posix.js",
"lib/path/win32.js",
"lib/perf_hooks.js",
"lib/process.js",
"lib/punycode.js",
"lib/querystring.js",
"lib/readline.js",
"lib/readline/promises.js",
"lib/trace_events.js",
"lib/events.js",
"lib/repl.js",
"lib/util.js",
"lib/dgram.js",
"lib/vm.js",
"lib/stream.js",
"lib/child_process.js",
"lib/assert.js",
"lib/_tls_wrap.js",
"lib/http2.js",
"lib/inspector.js",
"lib/os.js",
"lib/_http_server.js",
"lib/console.js",
"lib/perf_hooks.js",
"lib/readline.js",
"lib/punycode.js",
"lib/_http_incoming.js",
"lib/https.js",
"lib/_stream_wrap.js",
"lib/domain.js",
"lib/dns.js",
"lib/_http_client.js",
"lib/diagnostics_channel.js",
"lib/tty.js",
"lib/_http_agent.js",
"lib/timers.js",
"lib/_http_outgoing.js",
"lib/querystring.js",
"lib/_tls_common.js",
"lib/module.js",
"lib/_stream_passthrough.js",
"lib/_stream_transform.js",
"lib/worker_threads.js",
"lib/sys.js",
"lib/_stream_duplex.js",
"lib/path.js",
"lib/_http_common.js",
"lib/string_decoder.js",
"lib/cluster.js",
"lib/v8.js",
"lib/crypto.js",
"lib/wasi.js",
"lib/_stream_readable.js",
"lib/zlib.js",
"lib/url.js",
"lib/tls.js",
"lib/_stream_writable.js",
"lib/async_hooks.js",
"lib/process.js",
"lib/http.js",
"lib/buffer.js",
"lib/fs.js",
"lib/util/types.js",
"lib/timers/promises.js",
"lib/path/win32.js",
"lib/path/posix.js",
"lib/stream/consumers.js",
"lib/stream/promises.js",
"lib/stream/web.js",
"lib/string_decoder.js",
"lib/sys.js",
"lib/test.js",
"lib/timers.js",
"lib/timers/promises.js",
"lib/tls.js",
"lib/trace_events.js",
"lib/tty.js",
"lib/url.js",
"lib/util.js",
"lib/util/types.js",
"lib/v8.js",
"lib/vm.js",
"lib/wasi.js",
"lib/worker_threads.js",
"lib/zlib.js"
"lib/internal/constants.js",
"lib/internal/abort_controller.js",
"lib/internal/net.js",
"lib/internal/v8_prof_processor.js",
"lib/internal/event_target.js",
"lib/internal/inspector_async_hook.js",
"lib/internal/validators.js",
"lib/internal/linkedlist.js",
"lib/internal/cli_table.js",
"lib/internal/repl.js",
"lib/internal/util.js",
"lib/internal/histogram.js",
"lib/internal/error_serdes.js",
"lib/internal/dgram.js",
"lib/internal/child_process.js",
"lib/internal/assert.js",
"lib/internal/fixed_queue.js",
"lib/internal/blocklist.js",
"lib/internal/v8_prof_polyfill.js",
"lib/internal/options.js",
"lib/internal/worker.js",
"lib/internal/dtrace.js",
"lib/internal/idna.js",
"lib/internal/watchdog.js",
"lib/internal/encoding.js",
"lib/internal/tty.js",
"lib/internal/freeze_intrinsics.js",
"lib/internal/timers.js",
"lib/internal/heap_utils.js",
"lib/internal/querystring.js",
"lib/internal/js_stream_socket.js",
"lib/internal/errors.js",
"lib/internal/priority_queue.js",
"lib/internal/freelist.js",
"lib/internal/blob.js",
"lib/internal/socket_list.js",
"lib/internal/socketaddress.js",
"lib/internal/promise_hooks.js",
"lib/internal/stream_base_commons.js",
"lib/internal/url.js",
"lib/internal/async_hooks.js",
"lib/internal/http.js",
"lib/internal/buffer.js",
"lib/internal/trace_events_async_hooks.js",
"lib/internal/crypto/sig.js",
"lib/internal/crypto/rsa.js",
"lib/internal/crypto/aes.js",
"lib/internal/crypto/util.js",
"lib/internal/crypto/scrypt.js",
"lib/internal/crypto/random.js",
"lib/internal/crypto/keys.js",
"lib/internal/crypto/x509.js",
"lib/internal/crypto/certificate.js",
"lib/internal/crypto/ec.js",
"lib/internal/crypto/keygen.js",
"lib/internal/crypto/mac.js",
"lib/internal/crypto/diffiehellman.js",
"lib/internal/crypto/hkdf.js",
"lib/internal/crypto/cipher.js",
"lib/internal/crypto/hash.js",
"lib/internal/crypto/pbkdf2.js",
"lib/internal/crypto/webcrypto.js",
"lib/internal/crypto/dsa.js",
"lib/internal/crypto/hashnames.js",
"lib/internal/cluster/shared_handle.js",
"lib/internal/cluster/round_robin_handle.js",
"lib/internal/cluster/worker.js",
"lib/internal/cluster/primary.js",
"lib/internal/cluster/utils.js",
"lib/internal/cluster/child.js",
"lib/internal/webstreams/compression.js",
"lib/internal/webstreams/util.js",
"lib/internal/webstreams/writablestream.js",
"lib/internal/webstreams/readablestream.js",
"lib/internal/webstreams/queuingstrategies.js",
"lib/internal/webstreams/encoding.js",
"lib/internal/webstreams/transformstream.js",
"lib/internal/webstreams/adapters.js",
"lib/internal/webstreams/transfer.js",
"lib/internal/bootstrap/loaders.js",
"lib/internal/bootstrap/pre_execution.js",
"lib/internal/bootstrap/node.js",
"lib/internal/bootstrap/environment.js",
"lib/internal/bootstrap/switches/does_not_own_process_state.js",
"lib/internal/bootstrap/switches/is_not_main_thread.js",
"lib/internal/bootstrap/switches/does_own_process_state.js",
"lib/internal/bootstrap/switches/is_main_thread.js",
"lib/internal/test/binding.js",
"lib/internal/test/transfer.js",
"lib/internal/util/types.js",
"lib/internal/util/inspector.js",
"lib/internal/util/comparisons.js",
"lib/internal/util/debuglog.js",
"lib/internal/util/inspect.js",
"lib/internal/util/iterable_weak_map.js",
"lib/internal/streams/add-abort-signal.js",
"lib/internal/streams/compose.js",
"lib/internal/streams/duplexify.js",
"lib/internal/streams/destroy.js",
"lib/internal/streams/legacy.js",
"lib/internal/streams/passthrough.js",
"lib/internal/streams/operators.js",
"lib/internal/streams/readable.js",
"lib/internal/streams/from.js",
"lib/internal/streams/writable.js",
"lib/internal/streams/state.js",
"lib/internal/streams/buffer_list.js",
"lib/internal/streams/end-of-stream.js",
"lib/internal/streams/utils.js",
"lib/internal/streams/transform.js",
"lib/internal/streams/lazy_transform.js",
"lib/internal/streams/duplex.js",
"lib/internal/streams/pipeline.js",
"lib/internal/readline/interface.js",
"lib/internal/readline/utils.js",
"lib/internal/readline/emitKeypressEvents.js",
"lib/internal/readline/callbacks.js",
"lib/internal/repl/history.js",
"lib/internal/repl/utils.js",
"lib/internal/repl/await.js",
"lib/internal/legacy/processbinding.js",
"lib/internal/assert/calltracker.js",
"lib/internal/assert/assertion_error.js",
"lib/internal/http2/util.js",
"lib/internal/http2/core.js",
"lib/internal/http2/compat.js",
"lib/internal/per_context/messageport.js",
"lib/internal/per_context/primordials.js",
"lib/internal/per_context/domexception.js",
"lib/internal/vm/module.js",
"lib/internal/tls/secure-pair.js",
"lib/internal/tls/parse-cert-string.js",
"lib/internal/tls/secure-context.js",
"lib/internal/child_process/serialization.js",
"lib/internal/debugger/inspect_repl.js",
"lib/internal/debugger/inspect_client.js",
"lib/internal/debugger/inspect.js",
"lib/internal/worker/io.js",
"lib/internal/worker/js_transferable.js",
"lib/internal/main/repl.js",
"lib/internal/main/print_help.js",
"lib/internal/main/eval_string.js",
"lib/internal/main/check_syntax.js",
"lib/internal/main/prof_process.js",
"lib/internal/main/worker_thread.js",
"lib/internal/main/inspect.js",
"lib/internal/main/eval_stdin.js",
"lib/internal/main/run_main_module.js",
"lib/internal/modules/run_main.js",
"lib/internal/modules/package_json_reader.js",
"lib/internal/modules/esm/module_job.js",
"lib/internal/modules/esm/assert.js",
"lib/internal/modules/esm/fetch_module.js",
"lib/internal/modules/esm/get_source.js",
"lib/internal/modules/esm/translators.js",
"lib/internal/modules/esm/resolve.js",
"lib/internal/modules/esm/create_dynamic_module.js",
"lib/internal/modules/esm/load.js",
"lib/internal/modules/esm/handle_process_exit.js",
"lib/internal/modules/esm/initialize_import_meta.js",
"lib/internal/modules/esm/module_map.js",
"lib/internal/modules/esm/get_format.js",
"lib/internal/modules/esm/formats.js",
"lib/internal/modules/esm/loader.js",
"lib/internal/modules/cjs/helpers.js",
"lib/internal/modules/cjs/loader.js",
"lib/internal/source_map/source_map.js",
"lib/internal/source_map/prepare_stack_trace.js",
"lib/internal/source_map/source_map_cache.js",
"lib/internal/dns/promises.js",
"lib/internal/dns/utils.js",
"lib/internal/fs/watchers.js",
"lib/internal/fs/promises.js",
"lib/internal/fs/read_file_context.js",
"lib/internal/fs/rimraf.js",
"lib/internal/fs/sync_write_stream.js",
"lib/internal/fs/dir.js",
"lib/internal/fs/streams.js",
"lib/internal/fs/utils.js",
"lib/internal/fs/cp/cp.js",
"lib/internal/fs/cp/cp-sync.js",
"lib/internal/perf/nodetiming.js",
"lib/internal/perf/usertiming.js",
"lib/internal/perf/performance_entry.js",
"lib/internal/perf/performance.js",
"lib/internal/perf/timerify.js",
"lib/internal/perf/utils.js",
"lib/internal/perf/observe.js",
"lib/internal/perf/event_loop_delay.js",
"lib/internal/perf/event_loop_utilization.js",
"lib/internal/policy/manifest.js",
"lib/internal/policy/sri.js",
"lib/internal/process/task_queues.js",
"lib/internal/process/per_thread.js",
"lib/internal/process/warning.js",
"lib/internal/process/policy.js",
"lib/internal/process/promises.js",
"lib/internal/process/signal.js",
"lib/internal/process/execution.js",
"lib/internal/process/esm_loader.js",
"lib/internal/process/report.js",
"lib/internal/process/worker_thread_only.js",
"lib/internal/console/constructor.js",
"lib/internal/console/global.js",
"lib/assert/strict.js",
"lib/dns/promises.js",
"lib/fs/promises.js"
],
"node_module_version": 108,
"node_module_version": 93,
"node_no_browser_globals": "false",
"node_prefix": "/",
"node_release_urlbase": "https://nodejs.org/download/release/",
@@ -353,22 +330,20 @@
"node_use_v8_platform": "true",
"node_with_ltcg": "false",
"node_without_node_options": "false",
"openssl_fips": "",
"openssl_is_fips": "false",
"openssl_quic": "true",
"ossfuzz": "false",
"shlib_suffix": "108.dylib",
"shlib_suffix": "93.dylib",
"target_arch": "x64",
"v8_enable_31bit_smis_on_64bit_arch": 0,
"v8_enable_gdbjit": 0,
"v8_enable_hugepage": 0,
"v8_enable_i18n_support": 1,
"v8_enable_inspector": 1,
"v8_enable_javascript_promise_hooks": 1,
"v8_enable_lite_mode": 0,
"v8_enable_object_print": 1,
"v8_enable_pointer_compression": 0,
"v8_enable_shared_ro_heap": 1,
"v8_enable_short_builtin_calls": 1,
"v8_enable_webassembly": 1,
"v8_no_strict_aliasing": 1,
"v8_optimized_debug": 1,
@@ -378,8 +353,8 @@
"v8_use_siphash": 1,
"want_separate_host_toolset": 0,
"xcode_version": "11.0",
"nodedir": "/Users/karolsojko/Library/Caches/node-gyp/18.12.1",
"nodedir": "/Users/karolsojko/Library/Caches/node-gyp/16.15.1",
"standalone_static_library": 1,
"user_agent": "yarn/4.0.0-rc.25 npm/? node/v18.12.1 darwin x64"
"user_agent": "yarn/3.2.1 npm/? node/v16.15.1 darwin x64"
}
}

View File

@@ -25,7 +25,7 @@ DEFS_Debug := \
CFLAGS_Debug := \
-O0 \
-gdwarf-2 \
-mmacosx-version-min=10.15 \
-mmacosx-version-min=10.13 \
-arch x86_64 \
-Wall \
-Wendif-labels \
@@ -38,7 +38,7 @@ CFLAGS_C_Debug := \
# Flags passed to only C++ files.
CFLAGS_CC_Debug := \
-std=gnu++17 \
-std=gnu++14 \
-stdlib=libc++ \
-fno-rtti \
-fno-exceptions \
@@ -51,13 +51,13 @@ CFLAGS_OBJC_Debug :=
CFLAGS_OBJCC_Debug :=
INCS_Debug := \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/include/node \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/src \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/openssl/config \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/openssl/openssl/include \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/uv/include \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/zlib \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/v8/include \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/src \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/config \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/openssl/include \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/uv/include \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/zlib \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/v8/include \
-I$(srcdir)/src \
-I$(srcdir)/../../../../nan-npm-2.16.0-cac314a230/node_modules/nan
@@ -81,7 +81,7 @@ DEFS_Release := \
CFLAGS_Release := \
-O3 \
-gdwarf-2 \
-mmacosx-version-min=10.15 \
-mmacosx-version-min=10.13 \
-arch x86_64 \
-Wall \
-Wendif-labels \
@@ -94,7 +94,7 @@ CFLAGS_C_Release := \
# Flags passed to only C++ files.
CFLAGS_CC_Release := \
-std=gnu++17 \
-std=gnu++14 \
-stdlib=libc++ \
-fno-rtti \
-fno-exceptions \
@@ -107,13 +107,13 @@ CFLAGS_OBJC_Release :=
CFLAGS_OBJCC_Release :=
INCS_Release := \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/include/node \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/src \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/openssl/config \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/openssl/openssl/include \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/uv/include \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/zlib \
-I/Users/karolsojko/Library/Caches/node-gyp/18.12.1/deps/v8/include \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/include/node \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/src \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/config \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/openssl/openssl/include \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/uv/include \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/zlib \
-I/Users/karolsojko/Library/Caches/node-gyp/16.15.1/deps/v8/include \
-I$(srcdir)/src \
-I$(srcdir)/../../../../nan-npm-2.16.0-cac314a230/node_modules/nan
@@ -151,7 +151,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
LDFLAGS_Debug := \
-undefined dynamic_lookup \
-Wl,-search_paths_first \
-mmacosx-version-min=10.15 \
-mmacosx-version-min=10.13 \
-arch x86_64 \
-L$(builddir) \
-stdlib=libc++
@@ -163,7 +163,7 @@ LIBTOOLFLAGS_Debug := \
LDFLAGS_Release := \
-undefined dynamic_lookup \
-Wl,-search_paths_first \
-mmacosx-version-min=10.15 \
-mmacosx-version-min=10.13 \
-arch x86_64 \
-L$(builddir) \
-stdlib=libc++

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 Sentry
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,73 +0,0 @@
<p align="center">
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
</a>
</p>
# Official Sentry Profiling SDK for NodeJS (alpha ⚠️)
[![npm version](https://img.shields.io/npm/v/@sentry/profiling-node.svg)](https://www.npmjs.com/package/@sentry/profiling-node)
[![npm dm](https://img.shields.io/npm/dm/@sentry/profiling-node.svg)](https://www.npmjs.com/package/@sentry/profiling-node)
[![npm dt](https://img.shields.io/npm/dt/@sentry/profiling-node.svg)](https://www.npmjs.com/package/@sentry/profiling-node)
## Usage 🔥
```javascript
import * as Sentry from '@sentry/node';
import '@sentry/tracing';
import { ProfilingIntegration } from '@sentry/profiling-node';
Sentry.init({
dsn: 'https://7fa19397baaf433f919fbe02228d5470@o1137848.ingest.sentry.io/6625302',
debug: true,
tracesSampleRate: 1,
profilesSampleRate: 1, // Set profiling sampling rate.
integrations: [new ProfilingIntegration()]
});
```
Sentry SDK will now automatically profile all transactions, even the ones which may be started as a result of using an automatic instrumentation integration.
```javascript
const transaction = Sentry.startTransaction({ name: 'I will do some work' });
// The code between startTransaction and transaction.finish will be profiled
transaction.finish();
```
### Environment flags flags
The default mode of the v8 CpuProfiler is kLazyLogging which disables logging when no profiles are active - this is good because it does not add any overhead to the runtime, but the tradeoff is that it results in slow calls to startProfiling (this can exceed couple hundred ms from our tests). You can switch to eager logging which decreases the startup cost for the tradeoff of CPU overhead. You can do so by defining a `SENTRY_PROFILER_LOGGING_MODE` environment variable `eager|lazy` before running your script.
Example of starting a server with eager logging mode.
```javascript
SENTRY_PROFILER_LOGGING_MODE=eager node server.js
```
## FAQ 💭
### When should I not use this package
The package is still in alpha stage and we discourage using it in production systems while extensive testing is done. There is a possibility that adding this package may crash your entire node process (even when imported only in worker threads). We would also advise caution if you want to profile high throughput operations as starting the profiler adds some performance overhead and while we do have micro benchmarks to measure overhead, we have yet to properly test this on production system.
### Can the profiler leak PII to Sentry?
The profiler does not collect function arguments so leaking any PII is unlikely unless. We only collect a subset of the values which may identify the device and os that the profiler is running on - this is a smaller subset of the values already collected by the @sentry/node SDK.
The only way to leak PII would be if you are executing code like
```js
eval('function scriptFor${CUSTOMER_NAME}....');
```
In that case it is possible that the function name may end up being reported to Sentry.
### Will starting the profiler on main thread automatically profile worker threads too?
No. All instances of the profiler are scoped per thread (v8 isolate). In practice, this means that starting a transaction on thread A and delegating work to thread B will only result in sample stacks being collected from thread A. That said, nothing should prevent you from starting a transaction on thread B concurrently which will result in two independant profiles being sent to the Sentry backend. We currently do not do any correlation between such transactions, but we would be open to exploring the possibilities. Please file an issue if you have suggestions or specific use-cases in mind.
### How much overhead will this profiler add?
From our initial benchmark, it seems that most of the overhead is incurred from a call to startProfiling when no profiles are currently started - this is likely due to the fact that we use [kLazyLogging](https://v8docs.nodesource.com/node-18.2/d2/dc3/namespacev8.html#a7d16026419ddeaa475afc767a935c4cc) as the default option when we initialize the CpuProfiler. In our initial tests when benchmarking a simple express server, profiled requests would incur a performance penalty in the range of ~10ms. It is important to note that while the overhead is added, the majority of it is spent in startProfiling call and it seems that very little of it is actually added to the code executed between start and stop profiling calls.

View File

@@ -1,12 +0,0 @@
{
"targets": [
{
"target_name": "sentry_cpu_profiler",
"sources": [ "bindings/cpu_profiler.cc" ],
"defines": ["PROFILER_FORMAT=FORMAT_SAMPLED"],
'include_dirs': [
'<!(node -e "require(\'nan\')")'
]
},
]
}

View File

@@ -1,326 +0,0 @@
#include <unordered_map>
#include "nan.h"
#include "node.h"
#include "v8-profiler.h"
#define FORMAT_SAMPLED 2
#define FORMAT_RAW 1
#ifndef PROFILER_FORMAT
#define PROFILER_FORMAT FORMAT_SAMPLED
#endif
#ifndef FORMAT_BENCHMARK
#define FORMAT_BENCHMARK 0
#endif
// Isolate represents an instance of the v8 engine and can be entered at most by 1 thread at a
// given time. The Profiler is a context aware class that is bound to an isolate.
static const uint8_t MAX_STACK_DEPTH = 128;
static const float SAMPLING_FREQUENCY = 99.0; // 99 to avoid lockstep sampling
static const float SAMPLING_HZ = 1 / SAMPLING_FREQUENCY;
static const int SAMPLING_INTERVAL_US = static_cast<int>(SAMPLING_HZ * 1e6);
static const v8::CpuProfilingNamingMode NAMING_MODE = v8::CpuProfilingNamingMode::kDebugNaming;
v8::CpuProfilingLoggingMode LOGGING_MODE = v8::CpuProfilingLoggingMode::kLazyLogging;
// Allow users to override the default logging mode via env variable. This is useful
// because sometimes the flow of the profiled program can be to execute many sequential
// transaction - in that case, it may be preferable to set eager logging to avoid paying the
// high cost of profiling for each individual transaction (one example for this are jest
// tests when run with --runInBand option).
v8::CpuProfilingLoggingMode getLoggingMode(){
char* logging_mode = getenv("SENTRY_PROFILER_LOGGING_MODE");
if(logging_mode){
if(std::strcmp(logging_mode, "eager") == 0) {
return v8::CpuProfilingLoggingMode::kEagerLogging;
} if(std::strcmp(logging_mode, "lazy") == 0) {
return v8::CpuProfilingLoggingMode::kLazyLogging;
}
}
return LOGGING_MODE;
}
class Profiler {
public:
explicit Profiler(v8::Isolate* isolate):
cpu_profiler(
v8::CpuProfiler::New(isolate, NAMING_MODE, getLoggingMode())) {
node::AddEnvironmentCleanupHook(isolate, DeleteInstance, this);
}
v8::CpuProfiler* cpu_profiler;
static void DeleteInstance(void* data) {
Profiler* profiler = static_cast<Profiler*>(data);
profiler->cpu_profiler->Dispose();
delete profiler;
}
};
#if PROFILER_FORMAT == FORMAT_RAW || FORMAT_BENCHMARK == 1
v8::Local<v8::Object> CreateFrameGraphNode(
v8::Local<v8::String> name, v8::Local<v8::String> scriptName,
v8::Local<v8::Integer> scriptId, v8::Local<v8::Integer> lineNumber,
v8::Local<v8::Integer> columnNumber, v8::Local<v8::Integer> hitCount,
v8::Local<v8::Array> children) {
v8::Local<v8::Object> js_node = Nan::New<v8::Object>();
Nan::Set(js_node, Nan::New<v8::String>("name").ToLocalChecked(), name);
Nan::Set(js_node, Nan::New<v8::String>("file").ToLocalChecked(), scriptName);
Nan::Set(js_node, Nan::New<v8::String>("script_id").ToLocalChecked(), scriptId);
Nan::Set(js_node, Nan::New<v8::String>("line_number").ToLocalChecked(), lineNumber);
Nan::Set(js_node, Nan::New<v8::String>("column_number").ToLocalChecked(), columnNumber);
Nan::Set(js_node, Nan::New<v8::String>("hit_count").ToLocalChecked(), hitCount);
Nan::Set(js_node, Nan::New<v8::String>("children").ToLocalChecked(), children);
return js_node;
};
v8::Local<v8::Value> CreateFrameGraph(const CpuProfileNode* node) {
int32_t count = node->GetChildrenCount();
v8::Local<v8::Array> children = Nan::New<v8::Array>(count);
for (int32_t i = 0; i < count; i++) {
Nan::Set(children, i, CreateFrameGraph(node->GetChild(i)));
}
return CreateFrameGraphNode(
node->GetFunctionName(),
node->GetScriptResourceName(),
Nan::New<Integer>(node->GetScriptId()),
Nan::New<Integer>(node->GetLineNumber()),
Nan::New<Integer>(node->GetColumnNumber()),
Nan::New<Integer>(node->GetHitCount()),
children
);
};
#endif
#if PROFILER_FORMAT == FORMAT_SAMPLED || FORMAT_BENCHMARK == 1
v8::Local<v8::Object> CreateFrameNode(
v8::Local<v8::String> name, v8::Local<v8::String> scriptName, v8::Local<v8::Integer> line,
v8::Local<v8::Integer> column, std::vector<v8::CpuProfileDeoptInfo> deoptInfos) {
v8::Local<v8::Object> js_node = Nan::New<v8::Object>();
Nan::Set(js_node, Nan::New<v8::String>("name").ToLocalChecked(), name);
Nan::Set(js_node, Nan::New<v8::String>("file").ToLocalChecked(), scriptName);
Nan::Set(js_node, Nan::New<v8::String>("line").ToLocalChecked(), line);
Nan::Set(js_node, Nan::New<v8::String>("column").ToLocalChecked(), column);
// @TODO Deopt info needs to be added to backend
// size_t size = deoptInfos.size();
// if(size > 0) {
// v8::Local<v8::Array> deoptReasons = Nan::New<v8::Array>(size);
// for(size_t i = 0; i < size; i++) {
// Nan::Set(deoptReasons, i, Nan::New<v8::String>(deoptInfos[i].deopt_reason).ToLocalChecked());
// }
// Nan::Set(js_node, Nan::New<v8::String>("deopt_reasons").ToLocalChecked(), deoptReasons);
// };
return js_node;
};
v8::Local<v8::Object> CreateSample(uint32_t stack_id, int64_t sample_timestamp_us, uint32_t thread_id) {
v8::Local<v8::Object> js_node = Nan::New<v8::Object>();
Nan::Set(js_node, Nan::New<v8::String>("stack_id").ToLocalChecked(), Nan::New<v8::Number>(stack_id));
Nan::Set(js_node, Nan::New<v8::String>("thread_id").ToLocalChecked(), Nan::New<v8::String>(std::to_string(thread_id)).ToLocalChecked());
Nan::Set(js_node, Nan::New<v8::String>("elapsed_since_start_ns").ToLocalChecked(), Nan::New<v8::Number>(sample_timestamp_us * 1000));
return js_node;
};
std::string hashCpuProfilerNodeByPath(const v8::CpuProfileNode* node) {
std::string path = std::string();
std::string delimiter = std::string(";");
while (node != nullptr) {
path += std::to_string(node->GetNodeId());
path += delimiter;
node = node->GetParent();
}
return path;
}
std::tuple <v8::Local<v8::Value>, v8::Local<v8::Value>, v8::Local<v8::Value>> GetSamples(const v8::CpuProfile* profile, uint32_t thread_id) {
const int64_t profile_start_time_us = profile->GetStartTime();
const int sampleCount = profile->GetSamplesCount();
uint32_t unique_stack_id = 0;
uint32_t unique_frame_id = 0;
// Initialize the lookup tables for stacks and frames, both of these are indexed
// in the sample format we are using to optimize for size.
std::unordered_map<uint32_t, uint32_t> frame_lookup_table;
std::unordered_map<std::string, int> stack_lookup_table;
v8::Local<v8::Array> samples = Nan::New<v8::Array>(sampleCount);
v8::Local<v8::Array> stacks = Nan::New<v8::Array>();
v8::Local<v8::Array> frames = Nan::New<v8::Array>();
for (int i = 0; i < sampleCount; i++) {
uint32_t stack_index = unique_stack_id;
const v8::CpuProfileNode* node = profile->GetSample(i);
// If a node was only on top of the stack once, then it will only ever
// be inserted once and there is no need for hashing.
if (node->GetHitCount() > 1) {
std::string node_hash = hashCpuProfilerNodeByPath(node);
std::unordered_map<std::string, int>::iterator stack_index_cache_hit = stack_lookup_table.find(node_hash);
// If we have a hit, update the stack index, otherwise
// insert it into the hash table and continue.
if (stack_index_cache_hit != stack_lookup_table.end()) {
stack_index = stack_index_cache_hit->second;
}
else {
stack_lookup_table.insert({ node_hash, stack_index });
}
}
const v8::Local<v8::Value> sample = CreateSample(stack_index, profile->GetSampleTimestamp(i) - profile_start_time_us, thread_id);
// If stack index differs from the sample index that means the stack had been indexed.
if (stack_index != unique_stack_id) {
Nan::Set(samples, i, sample);
continue;
}
// A stack is a list of frames ordered from outermost (top) to innermost frame (bottom)
v8::Local<v8::Array> stack = Nan::New<v8::Array>();
uint32_t stack_depth = 0;
while (node != nullptr && stack_depth < MAX_STACK_DEPTH) {
const uint32_t nodeId = node->GetNodeId();
auto frame_index = frame_lookup_table.find(nodeId);
// If the frame does not exist in the index
if (frame_index == frame_lookup_table.end()) {
frame_lookup_table.insert({ nodeId, unique_frame_id });
Nan::Set(stack, stack_depth, Nan::New<v8::Number>(unique_frame_id));
Nan::Set(frames, unique_frame_id, CreateFrameNode(
node->GetFunctionName(),
node->GetScriptResourceName(),
Nan::New<v8::Integer>(node->GetLineNumber()),
Nan::New<v8::Integer>(node->GetColumnNumber()),
node->GetDeoptInfos()
));
unique_frame_id++;
}
else {
// If it was already indexed, just add it's id to the stack
Nan::Set(stack, stack_depth, Nan::New<v8::Number>(frame_index->second));
};
// Continue walking down the stack
node = node->GetParent();
stack_depth++;
}
Nan::Set(stacks, stack_index, stack);
Nan::Set(samples, i, sample);
unique_stack_id++;
};
return std::make_tuple(stacks, samples, frames);
};
#endif
v8::Local<v8::Value> CreateProfile(const v8::CpuProfile* profile, uint32_t thread_id) {
v8::Local<v8::Object> js_profile = Nan::New<v8::Object>();
Nan::Set(js_profile, Nan::New<v8::String>("profile_relative_started_at_ns").ToLocalChecked(), Nan::New<v8::Number>(profile->GetStartTime() * 1000));
Nan::Set(js_profile, Nan::New<v8::String>("profile_relative_ended_at_ns").ToLocalChecked(), Nan::New<v8::Number>(profile->GetEndTime() * 1000));
Nan::Set(js_profile, Nan::New<v8::String>("profiler_logging_mode").ToLocalChecked(), Nan::New<v8::String>(getLoggingMode() == v8::CpuProfilingLoggingMode::kEagerLogging ? "eager" : "lazy").ToLocalChecked());
#if PROFILER_FORMAT == FORMAT_SAMPLED || FORMAT_BENCHMARK == 1
std::tuple<v8::Local<v8::Value>, v8::Local<v8::Value>, v8::Local<v8::Value>> samples = GetSamples(profile, thread_id);
Nan::Set(js_profile, Nan::New<v8::String>("stacks").ToLocalChecked(), std::get<0>(samples));
Nan::Set(js_profile, Nan::New<v8::String>("samples").ToLocalChecked(), std::get<1>(samples));
Nan::Set(js_profile, Nan::New<v8::String>("frames").ToLocalChecked(), std::get<2>(samples));
#endif
#if PROFILER_FORMAT == FORMAT_RAW || FORMAT_BENCHMARK == 1
Nan::Set(js_profile, Nan::New<v8::String>("top_down_root").ToLocalChecked(), CreateFrameGraph(profile->GetTopDownRoot()));
#endif
return js_profile;
};
// StartProfiling(string title)
// https://v8docs.nodesource.com/node-18.2/d2/d34/classv8_1_1_cpu_profiler.html#aedf6a5ca49432ab665bc3a1ccf46cca4
static void StartProfiling(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args[0].IsEmpty()) {
return Nan::ThrowError("StartProfiling expects a string as first argument.");
};
if (!args[0]->IsString()) {
return Nan::ThrowError("StartProfiling requires a string as the first argument.");
};
v8::Local<v8::String> title = Nan::To<v8::String>(args[0]).ToLocalChecked();
v8::CpuProfilingOptions options = v8::CpuProfilingOptions{
v8::CpuProfilingMode::kCallerLineNumbers, v8::CpuProfilingOptions::kNoSampleLimit,
SAMPLING_INTERVAL_US };
Profiler* profiler = reinterpret_cast<Profiler*>(args.Data().As<v8::External>()->Value());
profiler->cpu_profiler->StartProfiling(title, options);
};
// StopProfiling(string title)
// https://v8docs.nodesource.com/node-18.2/d2/d34/classv8_1_1_cpu_profiler.html#a40ca4c8a8aa4c9233aa2a2706457cc80
static void StopProfiling(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args[0].IsEmpty()) {
return Nan::ThrowError("StopProfiling expects a string as first argument.");
};
if (!args[0]->IsString()) {
return Nan::ThrowError("StopProfiling expects a string as first argument.");
};
if (args[1].IsEmpty()) {
return Nan::ThrowError("StopProfiling expects a number as second argument.");
};
if (!args[1]->IsNumber()) {
return Nan::ThrowError("StopProfiling expects a thread_id of type number as second argument.");
};
Profiler* profiler = reinterpret_cast<Profiler*>(args.Data().As<v8::External>()->Value());
v8::CpuProfile* profile = profiler->cpu_profiler->StopProfiling(Nan::To<v8::String>(args[0]).ToLocalChecked());
// If for some reason stopProfiling was called with an invalid profile title or
// if that title had somehow been stopped already, profile will be null.
if (profile == nullptr) {
args.GetReturnValue().Set(Nan::Null());
return;
};
args.GetReturnValue().Set(CreateProfile(profile, Nan::To<uint32_t>(args[1]).FromJust()));
profile->Delete();
};
NODE_MODULE_INIT(/* exports, module, context */) {
v8::Isolate* isolate = context->GetIsolate();
Profiler* profiler = new Profiler(isolate);
v8::Local<v8::External> external = v8::External::New(isolate, profiler);
exports->Set(context,
Nan::New<v8::String>("startProfiling").ToLocalChecked(),
v8::FunctionTemplate::New(isolate, StartProfiling, external)->GetFunction(context).ToLocalChecked()).FromJust();
exports->Set(context,
Nan::New<v8::String>("stopProfiling").ToLocalChecked(),
v8::FunctionTemplate::New(isolate, StopProfiling, external)->GetFunction(context).ToLocalChecked()).FromJust();
}

View File

@@ -1,43 +0,0 @@
export declare function importCppBindingsModule(): PrivateV8CpuProfilerBindings;
interface Sample {
stack_id: number;
thread_id: string;
elapsed_since_start_ns: string;
}
declare type Stack = number[];
declare type Frame = {
function: string;
file: string;
line: number;
column: number;
};
export interface RawThreadCpuProfile {
stacks: Stack[];
samples: Sample[];
frames: Frame[];
profile_relative_started_at_ns: number;
profile_relative_ended_at_ns: number;
profiler_logging_mode: 'eager' | 'lazy';
}
export interface ThreadCpuProfile {
samples: Sample[];
stacks: Stack[];
frames: Frame[];
thread_metadata: Record<string, {
name?: string;
priority?: number;
}>;
queue_metadata?: Record<string, {
label: string;
}>;
}
interface PrivateV8CpuProfilerBindings {
startProfiling(name: string): void;
stopProfiling(name: string, threadId: number): RawThreadCpuProfile | null;
}
interface V8CpuProfilerBindings {
startProfiling(name: string): void;
stopProfiling(name: string): RawThreadCpuProfile | null;
}
declare const CpuProfilerBindings: V8CpuProfilerBindings;
export { CpuProfilerBindings };

View File

@@ -1,25 +0,0 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CpuProfilerBindings = exports.importCppBindingsModule = void 0;
const os_1 = __importDefault(require("os"));
const path_1 = __importDefault(require("path"));
const node_abi_1 = __importDefault(require("node-abi"));
const worker_threads_1 = require("worker_threads");
function importCppBindingsModule() {
const name = `sentry_cpu_profiler-v${node_abi_1.default.getAbi(process.versions.node, 'node')}-${os_1.default.platform()}-${os_1.default.arch()}.node`;
return require(path_1.default.join(__dirname, '..', 'binaries', name));
}
exports.importCppBindingsModule = importCppBindingsModule;
const privateBindings = importCppBindingsModule();
const CpuProfilerBindings = {
startProfiling(name) {
return privateBindings.startProfiling(name);
},
stopProfiling(name) {
return privateBindings.stopProfiling(name, worker_threads_1.threadId);
}
};
exports.CpuProfilerBindings = CpuProfilerBindings;

View File

@@ -1,6 +0,0 @@
/**
* Figures out if we're building with debug functionality.
*
* @returns true if this is a debug build
*/
export declare function isDebugBuild(): boolean;

View File

@@ -1,20 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isDebugBuild = void 0;
/**
* This module exists for optimizations in the build process through rollup and terser. We define some global
* constants, which can be overridden during build. By guarding certain pieces of code with functions that return these
* constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will
* never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to
* `logger` and preventing node-related code from appearing in browser bundles.
*/
const __SENTRY_DEBUG__ = true;
/**
* Figures out if we're building with debug functionality.
*
* @returns true if this is a debug build
*/
function isDebugBuild() {
return __SENTRY_DEBUG__;
}
exports.isDebugBuild = isDebugBuild;

View File

@@ -1,8 +0,0 @@
import type { Hub, TransactionContext, CustomSamplingContext, Transaction } from '@sentry/types';
declare type StartTransaction = (this: Hub, transactionContext: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
export declare function __PRIVATE__wrapStartTransactionWithProfiling(startTransaction: StartTransaction): StartTransaction;
/**
* This patches the global object and injects the Profiling extensions methods
*/
export declare function addExtensionMethods(): void;
export {};

View File

@@ -1,126 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addExtensionMethods = exports.__PRIVATE__wrapStartTransactionWithProfiling = void 0;
const hub_1 = require("@sentry/hub");
const utils_1 = require("@sentry/utils");
const env_1 = require("./env");
const cpu_profiler_1 = require("./cpu_profiler");
const MAX_PROFILE_DURATION_MS = 30 * 1000;
// Wraps startTransaction and stopTransaction with profiling related logic.
// startProfiling is called after the call to startTransaction in order to avoid our own code from
// being profiled. Because of that same reason, stopProfiling is called before the call to stopTransaction.
function __PRIVATE__wrapStartTransactionWithProfiling(startTransaction) {
return function wrappedStartTransaction(transactionContext, customSamplingContext) {
var _a;
const client = this.getClient();
// @ts-expect-error profilesSampleRate is not part of the options type yet
const profilesSampleRate = (_a = client === null || client === void 0 ? void 0 : client.getOptions().profilesSampleRate) !== null && _a !== void 0 ? _a : undefined;
const transaction = startTransaction.call(this, transactionContext, customSamplingContext);
// We create "unique" transaction names to avoid concurrent transactions with same names
// from being ignored by the profiler. From here on, only this transaction name should be used when
// calling the profiler methods. Note: we log the original name to the user to avoid confusion.
const uniqueTransactionName = `${transactionContext.name} ${(0, utils_1.uuid4)()}`;
if (profilesSampleRate === undefined) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] Profiling disabled, enable it by setting `profilesSampleRate` option to SDK init call.');
}
return transaction;
}
if (Math.random() > profilesSampleRate) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] Skip profiling transaction due to sampling.');
}
return transaction;
}
// We need to reference the original finish call to avoid creating an infinite loop
const originalFinish = transaction.finish.bind(transaction);
cpu_profiler_1.CpuProfilerBindings.startProfiling(uniqueTransactionName);
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] started profiling transaction: ' + transactionContext.name);
}
// A couple of important things to note here:
// `CpuProfilerBindings.stopProfiling` will be scheduled to run in 30seconds in order to exceed max profile duration.
// Whichever of the two (transaction.finish/timeout) is first to run, the profiling will be stopped and the gathered profile
// will be processed when the original transaction is finished. Since onProfileHandler can be invoked multiple times in the
// event of an error or user mistake (calling transaction.finish multiple times), it is important that the behavior of onProfileHandler
// is idempotent as we do not want any timings or profiles to be overriden by the last call to onProfileHandler.
// After the original finish method is called, the event will be reported through the integration and delegated to transport.
let profile = null;
function onProfileHandler() {
// Check if the profile exists and return it the behavior has to be idempotent as users may call transaction.finish multiple times.
if (profile) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] profile for:', transactionContext.name, 'already exists, returning early');
}
return profile;
}
profile = cpu_profiler_1.CpuProfilerBindings.stopProfiling(uniqueTransactionName);
if (maxDurationTimeoutID) {
global.clearTimeout(maxDurationTimeoutID);
maxDurationTimeoutID = undefined;
}
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] stopped profiling of transaction: ' + transactionContext.name);
}
// In case of an overlapping transaction, stopProfiling may return null and silently ignore the overlapping profile.
if (!profile) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] profiler returned null profile for: ' + transactionContext.name, 'this may indicate an overlapping transaction or a call to stopProfiling with a profile title that was never started');
}
return null;
}
return profile;
}
// Enqueue a timeout to prevent profiles from running over max duration.
let maxDurationTimeoutID = global.setTimeout(() => {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] max profile duration elapsed, stopping profiling for:', transactionContext.name);
}
onProfileHandler();
}, MAX_PROFILE_DURATION_MS);
function profilingWrappedTransactionFinish() {
// onProfileHandler should always return the same profile even if this is called multiple times.
// Always call onProfileHandler to ensure stopProfiling is called and the timeout is cleared.
const profile = onProfileHandler();
// @ts-expect-error profile is not a part of sdk metadata so we expect error until it becomes part of the official SDK.
transaction.setMetadata({ profile });
return originalFinish();
}
transaction.finish = profilingWrappedTransactionFinish;
return transaction;
};
}
exports.__PRIVATE__wrapStartTransactionWithProfiling = __PRIVATE__wrapStartTransactionWithProfiling;
/**
* Patches startTransaction and stopTransaction with profiling logic.
* @private
*/
function _addProfilingExtensionMethods() {
const carrier = (0, hub_1.getMainCarrier)();
if (!carrier.__SENTRY__) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log("[Profiling] Can't find main carrier, profiling won't work.");
}
return;
}
carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};
if (!carrier.__SENTRY__.extensions['startTransaction']) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] startTransaction does not exists, profiling will not work. Make sure you import @sentry/tracing package before @sentry/profiling-node as import order matters.');
}
return;
}
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] startTransaction exists, patching it with profiling functionality...');
}
carrier.__SENTRY__.extensions['startTransaction'] = __PRIVATE__wrapStartTransactionWithProfiling(
// This is already patched by sentry/tracing, we are going to re-patch it...
carrier.__SENTRY__.extensions['startTransaction']);
}
/**
* This patches the global object and injects the Profiling extensions methods
*/
function addExtensionMethods() {
_addProfilingExtensionMethods();
}
exports.addExtensionMethods = addExtensionMethods;

View File

@@ -1,2 +0,0 @@
import { ProfilingIntegration } from './integration';
export { ProfilingIntegration };

View File

@@ -1,10 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfilingIntegration = void 0;
const hubextensions_1 = require("./hubextensions");
const integration_1 = require("./integration");
Object.defineProperty(exports, "ProfilingIntegration", { enumerable: true, get: function () { return integration_1.ProfilingIntegration; } });
// Guard for tree
if (typeof __SENTRY_PROFILING === 'undefined' || __SENTRY_PROFILING) {
(0, hubextensions_1.addExtensionMethods)();
}

View File

@@ -1,7 +0,0 @@
import type { Integration, EventProcessor, Hub, Event } from '@sentry/types';
export declare class ProfilingIntegration implements Integration {
name: string;
getCurrentHub?: () => Hub;
setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
handleGlobalEvent(event: Event): Event;
}

View File

@@ -1,60 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfilingIntegration = void 0;
const utils_1 = require("@sentry/utils");
const env_1 = require("./env");
const utils_2 = require("./utils");
// We need this integration in order to actually send data to Sentry. We hook into the event processor
// and inspect each event to see if it is a transaction event and if that transaction event
// contains a profile on it's metadata. If that is the case, we create a profiling event envelope
// and delete the profile from the transaction metadata.
class ProfilingIntegration {
constructor() {
this.name = 'ProfilingIntegration';
this.getCurrentHub = undefined;
}
setupOnce(addGlobalEventProcessor, getCurrentHub) {
this.getCurrentHub = getCurrentHub;
addGlobalEventProcessor(this.handleGlobalEvent.bind(this));
}
handleGlobalEvent(event) {
if (this.getCurrentHub === undefined) {
return (0, utils_2.maybeRemoveProfileFromSdkMetadata)(event);
}
if ((0, utils_2.isProfiledTransactionEvent)(event)) {
// Client, Dsn and Transport are all required to be able to send the profiling event to Sentry.
// If either of them is not available, we remove the profile from the transaction event.
// and forward it to the next event processor.
const hub = this.getCurrentHub();
const client = hub.getClient();
if (!client) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] getClient did not return a Client, removing profile from event and forwarding to next event processors.');
}
return (0, utils_2.maybeRemoveProfileFromSdkMetadata)(event);
}
const dsn = client.getDsn();
if (!dsn) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] getDsn did not return a Dsn, removing profile from event and forwarding to next event processors.');
}
return (0, utils_2.maybeRemoveProfileFromSdkMetadata)(event);
}
const transport = client.getTransport();
if (!transport) {
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] getTransport did not return a Transport, removing profile from event and forwarding to next event processors.');
}
return (0, utils_2.maybeRemoveProfileFromSdkMetadata)(event);
}
// If all required components are available, we construct a profiling event envelope and send it to Sentry.
if ((0, env_1.isDebugBuild)()) {
utils_1.logger.log('[Profiling] Preparing envelope and sending a profiling event.');
}
transport.send((0, utils_2.createProfilingEventEnvelope)(event, dsn, client.getOptions()._metadata));
}
// Ensure sdkProcessingMetadata["profile"] is removed from the event before forwarding it to the next event processor.
return (0, utils_2.maybeRemoveProfileFromSdkMetadata)(event);
}
}
exports.ProfilingIntegration = ProfilingIntegration;

View File

@@ -1,53 +0,0 @@
import type { SdkMetadata, DsnComponents, Event, EventEnvelope } from '@sentry/types';
import type { ThreadCpuProfile, RawThreadCpuProfile } from './cpu_profiler';
export interface Profile {
event_id: string;
version: string;
os: {
name: string;
version: string;
build_number: string;
};
runtime: {
name: string;
version: string;
};
device: {
architecture: string;
is_emulator: boolean;
locale: string;
manufacturer: string;
model: string;
};
timestamp: string;
release: string;
platform: string;
profile: ThreadCpuProfile;
debug_meta?: {
images: {
debug_id: string;
image_addr: string;
code_file: string;
type: string;
image_size: number;
image_vmaddr: string;
}[];
};
transactions: {
name: string;
trace_id: string;
id: string;
active_thread_id: string;
relative_start_ns: string;
relative_end_ns: string;
}[];
}
export declare function enrichWithThreadInformation(profile: ThreadCpuProfile | RawThreadCpuProfile): ThreadCpuProfile;
export interface ProfiledEvent extends Event {
sdkProcessingMetadata: {
profile?: RawThreadCpuProfile;
};
}
export declare function createProfilingEventEnvelope(event: ProfiledEvent, dsn: DsnComponents, metadata?: SdkMetadata, tunnel?: string): EventEnvelope;
export declare function isProfiledTransactionEvent(event: Event): event is ProfiledEvent;
export declare function maybeRemoveProfileFromSdkMetadata(event: Event | ProfiledEvent): Event;

View File

@@ -1,146 +0,0 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.maybeRemoveProfileFromSdkMetadata = exports.isProfiledTransactionEvent = exports.createProfilingEventEnvelope = exports.enrichWithThreadInformation = void 0;
const os_1 = __importDefault(require("os"));
const worker_threads_1 = require("worker_threads");
const utils_1 = require("@sentry/utils");
const THREAD_ID_STRING = String(worker_threads_1.threadId);
const THREAD_NAME = worker_threads_1.isMainThread ? 'main' : 'worker';
// Machine properties (eval only once)
const PLATFORM = os_1.default.platform();
const RELEASE = os_1.default.release();
const VERSION = os_1.default.version();
const TYPE = os_1.default.type();
const MODEL = os_1.default.machine ? os_1.default.machine() : os_1.default.arch();
const ARCH = os_1.default.arch();
function isRawThreadCpuProfile(profile) {
return !('thread_metadata' in profile);
}
// Enriches the profile with threadId of the current thread.
// This is done in node as we seem to not be able to get the info from C native code.
function enrichWithThreadInformation(profile) {
if (!isRawThreadCpuProfile(profile)) {
return profile;
}
return {
samples: profile.samples,
frames: profile.frames,
stacks: profile.stacks,
thread_metadata: {
[THREAD_ID_STRING]: {
name: THREAD_NAME
}
}
};
}
exports.enrichWithThreadInformation = enrichWithThreadInformation;
/** Extract sdk info from from the API metadata */
function getSdkMetadataForEnvelopeHeader(metadata) {
if (!metadata || !metadata.sdk) {
return undefined;
}
return { name: metadata.sdk.name, version: metadata.sdk.version };
}
/**
* Apply SdkInfo (name, version, packages, integrations) to the corresponding event key.
* Merge with existing data if any.
**/
function enhanceEventWithSdkInfo(event, sdkInfo) {
var _a, _b;
if (!sdkInfo) {
return event;
}
event.sdk = event.sdk || {};
event.sdk.name = (_a = (event.sdk.name || sdkInfo.name)) !== null && _a !== void 0 ? _a : 'unknown sdk';
event.sdk.version = (_b = (event.sdk.version || sdkInfo.version)) !== null && _b !== void 0 ? _b : 'unknown sdk version';
event.sdk.integrations = [...(event.sdk.integrations || []), ...(sdkInfo.integrations || [])];
event.sdk.packages = [...(event.sdk.packages || []), ...(sdkInfo.packages || [])];
return event;
}
function createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn) {
const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata['dynamicSamplingContext'];
return Object.assign(Object.assign(Object.assign({ event_id: event.event_id, sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!tunnel && { dsn: (0, utils_1.dsnToString)(dsn) })), (event.type === 'transaction' &&
dynamicSamplingContext && {
trace: (0, utils_1.dropUndefinedKeys)(Object.assign({}, dynamicSamplingContext))
}));
}
function createProfilingEventEnvelope(event, dsn, metadata, tunnel) {
var _a, _b, _c, _d, _e;
const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
const rawProfile = event.sdkProcessingMetadata['profile'];
if (event.type !== 'transaction') {
// createProfilingEventEnvelope should only be called for transactions,
// we type guard this behavior with isProfiledTransactionEvent.
throw new TypeError('Profiling events may only be attached to transactions, this should never occur.');
}
if (rawProfile === undefined || rawProfile === null) {
throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${rawProfile} instead.`);
}
enhanceEventWithSdkInfo(event, metadata && metadata.sdk);
const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn);
const enrichedThreadProfile = enrichWithThreadInformation(rawProfile);
const transactionStartMs = typeof event.start_timestamp === 'number' ? event.start_timestamp * 1000 : Date.now();
const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : Date.now();
const profile = {
event_id: (0, utils_1.uuid4)(),
timestamp: new Date(transactionStartMs).toISOString(),
platform: 'node',
version: '1',
release: ((_a = event.sdk) === null || _a === void 0 ? void 0 : _a.version) || 'unknown',
runtime: {
name: 'node',
version: process.versions.node || 'unknown'
},
os: {
name: PLATFORM,
version: RELEASE,
build_number: VERSION
},
device: {
locale: (_b = (process.env['LC_ALL'] || process.env['LC_MESSAGES'] || process.env['LANG'] || process.env['LANGUAGE'])) !== null && _b !== void 0 ? _b : 'unknown locale',
model: MODEL,
manufacturer: TYPE,
architecture: ARCH,
is_emulator: false
},
profile: enrichedThreadProfile,
transactions: [
{
name: event.transaction || '',
id: event.event_id || (0, utils_1.uuid4)(),
trace_id: (_e = (_d = (_c = event === null || event === void 0 ? void 0 : event.contexts) === null || _c === void 0 ? void 0 : _c['trace']) === null || _d === void 0 ? void 0 : _d['trace_id']) !== null && _e !== void 0 ? _e : '',
active_thread_id: THREAD_ID_STRING,
relative_start_ns: '0',
relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0)
}
]
};
const envelopeItem = [
{
// @ts-expect-error profile is not yet a type in @sentry/types
type: 'profile'
},
// @ts-expect-error profile is not yet a type in @sentry/types
profile
];
return (0, utils_1.createEnvelope)(envelopeHeaders, [envelopeItem]);
}
exports.createProfilingEventEnvelope = createProfilingEventEnvelope;
function isProfiledTransactionEvent(event) {
return !!(event.sdkProcessingMetadata && event.sdkProcessingMetadata['profile']);
}
exports.isProfiledTransactionEvent = isProfiledTransactionEvent;
// Due to how profiles are attached to event metadata, we may sometimes want to remove them to ensure
// they are not processed by other Sentry integrations. This can be the case when we cannot construct a valid
// profile from the data we have or some of the mechanisms to send the event (Hub, Transport etc) are not available to us.
function maybeRemoveProfileFromSdkMetadata(event) {
if (!isProfiledTransactionEvent(event)) {
return event;
}
delete event.sdkProcessingMetadata['profile'];
return event;
}
exports.maybeRemoveProfileFromSdkMetadata = maybeRemoveProfileFromSdkMetadata;

View File

@@ -1,90 +0,0 @@
{
"name": "@sentry/profiling-node",
"version": "0.0.12",
"description": "Sampling based nodejs profiler.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/getsentry/profiling-node.git"
},
"engines": {
"node": ">=12.0.0"
},
"files": [
"lib",
"bindings",
"binding.gyp",
"LICENSE",
"README.md",
"package.json",
"package-lock.json",
"binaries",
"scripts/binaries.js",
"scripts/check-build.js",
"scripts/copy-target.js",
"scripts/empty.js"
],
"scripts": {
"install": "node scripts/empty.js",
"postinstall": "node scripts/check-build.js",
"clean": "rm -rf ./lib && rm -rf build",
"lint": "eslint ./src --ext .ts",
"build": "npm run build:bindings && npm run build:lib",
"build:lib": "tsc",
"build:configure": "node-gyp configure",
"build:bindings": "node-gyp build",
"build:benchmark:format": "node-gyp -DFORMAT_BENCHMARK=1 build",
"benchmark": "npm run benchmark:methods && npm run benchmark:profiler && npm run benchmark:server && npm run benchmark:format",
"benchmark:methods": "node benchmarks/cpu/benchmark.methods.js",
"benchmark:profiler": "node benchmarks/cpu/benchmark.profiler.js",
"benchmark:server": "node benchmarks/cpu/benchmark.server.js",
"benchmark:format": "node benchmarks/format/benchmark.format.js",
"benchmark:integration": "node benchmarks/cpu/benchmark.integration.base.js && node benchmarks/cpu/benchmark.integration.disabled.js && node benchmarks/cpu/benchmark.integration.js",
"test:watch": "jest --watch",
"test": "jest --config jest.config.ts",
"prettier": "prettier --config ./.prettierrc --write"
},
"keywords": [
"profiling",
"monitoring",
"cpu",
"node",
"performance"
],
"author": "jonas.badalic@sentry.io",
"license": "MIT",
"dependencies": {
"@sentry/hub": "^7.16.0",
"@sentry/node": "^7.16.0",
"@sentry/tracing": "^7.16.0",
"@sentry/types": "^7.16.0",
"@sentry/utils": "^7.16.0",
"nan": "^2.17.0",
"node-abi": "^3.28.0",
"node-gyp": "^9.3.0"
},
"devDependencies": {
"@types/express": "^4.17.14",
"@types/jest": "^29.0.0",
"@types/node": "^18.0.2",
"@types/node-abi": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"autocannon": "^7.9.0",
"benchmark": "^2.1.4",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"express": "^4.18.1",
"jest": "^28.1.3",
"prettier": "2.7.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"simple-zstd": "^1.4.0",
"sqlite3": "^5.0.8",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"typescript": "^4.8.3"
}
}

Some files were not shown because too many files have changed in this diff Show More