Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

CURA-11364 Add Sentry Support #1985

Merged
merged 22 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b932d37
Add sentry to CuraEngine
nallath Nov 20, 2023
7d6dc2c
Also add sentry to CMakeLists
nallath Nov 20, 2023
67b924d
Applied clang-format.
nallath Nov 20, 2023
5e22539
Correctly set the version number when sending to sentry
nallath Nov 20, 2023
10d66c5
Merge branch 'CURA-11364_add_sentry' of github.com:Ultimaker/CuraEngi…
nallath Nov 20, 2023
785490c
Applied clang-format.
nallath Nov 20, 2023
02cb17c
Store sentry logs in correct place
nallath Nov 21, 2023
b5d4754
Merge branch 'CURA-11364_add_sentry' of github.com:Ultimaker/CuraEngi…
nallath Nov 21, 2023
c6047b7
Add optional Sentry integration
jellespijker Nov 21, 2023
17466d0
Use format to create the versionstring
nallath Nov 21, 2023
adfa140
Applied clang-format.
nallath Nov 21, 2023
7af9a1a
Refactor sentry options and improve code readability
jellespijker Nov 21, 2023
2ad7536
Applied clang-format.
jellespijker Nov 21, 2023
7a6098c
Add instruction how to set sentry_url in the code
nallath Nov 21, 2023
14e8ec0
Only send sentry data if use_sentry env is set
nallath Nov 21, 2023
b9cbe33
Applied clang-format.
nallath Nov 21, 2023
c05b776
Refactor sentry config path generation
jellespijker Nov 21, 2023
f397fb5
Log Sentry URL and Path
jellespijker Nov 21, 2023
5ef89b5
Set sentry environment based on version
jellespijker Nov 21, 2023
d020d0f
Fix Sentry (crash logging) for Win64.
rburema Nov 22, 2023
67eb8e0
'Fix' weird Win64 issue with ranges-library.
rburema Nov 22, 2023
686df6a
Merge branch 'main' into CURA-11364_add_sentry
casperlamboo Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ find_package(fmt REQUIRED)
find_package(range-v3 REQUIRED)
find_package(scripta REQUIRED)
find_package(neargye-semver REQUIRED)
find_package(sentry REQUIRED)

if (ENABLE_TESTING)
find_package(GTest REQUIRED)
Expand All @@ -221,6 +222,7 @@ target_link_libraries(_CuraEngine
asio-grpc::asio-grpc
grpc::grpc
protobuf::libprotobuf
sentry::sentry
$<$<BOOL:${ENABLE_TESTING}>:GTest::gtest>)

if (NOT WIN32)
Expand Down
1 change: 1 addition & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def requirements(self):
self.requires("protobuf/3.21.9")
self.requires("zlib/1.2.12")
self.requires("openssl/1.1.1l")
self.requires("sentry-native/0.6.5")

def generate(self):
deps = CMakeDeps(self)
Expand Down
29 changes: 29 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include <sys/resource.h> //For setpriority.
#endif

#include <sentry.h>
#include <string>

#include <spdlog/spdlog.h>

#include "Application.h"
Expand Down Expand Up @@ -37,7 +40,33 @@ int main(int argc, char** argv)
#endif
std::cerr << std::boolalpha;

// Setup sentry error handling.
sentry_options_t* options = sentry_options_new();
// TODO: Right now we just hardcode the key. We should probably get that from some kind of secret for release builds
sentry_options_set_dsn(options, "https://[email protected]/4506257745510401");
// This is also the default-path. For further information and recommendations:
// https://docs.sentry.io/platforms/native/configuration/options/#database-path
std::string config_path = "";

#if defined(__linux__)
config_path += getenv("HOME");
config_path += "/.local/share/cura/";
#elif defined(__APPLE__) && defined(__MACH__)
config_path += getenv("HOME");
config_path += "/Library/Application Support/cura/";
#elif defined(_WIN64)
config_path = "%APPDATA%\\cura\\";
#endif
config_path += ".sentry-native";
sentry_options_set_database_path(options, config_path.c_str());
std::string version = "curaengine@";
version += std::string(CURA_ENGINE_VERSION);
nallath marked this conversation as resolved.
Show resolved Hide resolved
sentry_options_set_release(options, version.c_str());
sentry_init(options);

cura::Application::getInstance().run(argc, argv);

sentry_close();

return 0;
}
Loading