Skip to content

Commit 3ab16f2

Browse files
committed
Adding sentry error rates on our openshot.org version request... so we can adjust them dynamically (stable vs unstable versions).
1 parent 7c83cf0 commit 3ab16f2

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

src/classes/info.py

+11
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@
103103
CURRENT_LANGUAGE = 'en_US'
104104
SUPPORTED_LANGUAGES = ['en_US']
105105

106+
# Sentry.io error reporting rate (0.0 TO 1.0)
107+
# 0.0 = no error reporting to Sentry
108+
# 0.5 = 1/2 of errors reported to Sentry
109+
# 1.0 = all errors reporting to Sentry
110+
# STABLE: If this version matches the current version (reported on openshot.org)
111+
# UNSTABLE: If this version does not match the current version (reported on openshot.org)
112+
# STABLE_VERSION: This is the current stable release reported by openshot.org
113+
ERROR_REPORT_RATE_STABLE = 0.0
114+
ERROR_REPORT_RATE_UNSTABLE = 0.0
115+
ERROR_REPORT_STABLE_VERSION = None
116+
106117
try:
107118
from language import openshot_lang
108119
language_path = ":/locale/"

src/classes/sentry.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import platform
3030

31+
from classes.logger import log
3132
from classes import info
3233

3334
try:
@@ -47,12 +48,16 @@ def init_tracing():
4748
return
4849

4950
# Determine sample rate for exceptions
50-
traces_sample_rate = 0.1
51-
environment = "production"
52-
if "-dev" in info.VERSION:
53-
# Dev mode, trace all exceptions
54-
traces_sample_rate = 1.0
55-
environment = "development"
51+
traces_sample_rate = 0.0
52+
if info.VERSION == info.ERROR_REPORT_STABLE_VERSION:
53+
traces_sample_rate = info.ERROR_REPORT_RATE_STABLE
54+
environment = "production"
55+
else:
56+
traces_sample_rate = info.ERROR_REPORT_RATE_UNSTABLE
57+
environment = "unstable"
58+
59+
if info.ERROR_REPORT_STABLE_VERSION:
60+
log.info("Sentry initialized with %s error reporting rate (%s)" % (traces_sample_rate, environment))
5661

5762
# Initialize sentry exception tracing
5863
sdk.init(

src/classes/version.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from classes.app import get_app
3131
from classes import info
3232
from classes.logger import log
33-
import json
33+
3434

3535
def get_current_Version():
3636
"""Get the current version """
@@ -46,10 +46,13 @@ def get_version_from_http():
4646
# Send metric HTTP data
4747
try:
4848
r = requests.get(url, headers={"user-agent": "openshot-qt-%s" % info.VERSION}, verify=False)
49-
log.info("Found current version: %s" % r.text)
49+
log.info("Found current version: %s" % r.json())
5050

5151
# Parse version
52-
openshot_version = r.json()["openshot_version"]
52+
openshot_version = r.json().get("openshot_version")
53+
info.ERROR_REPORT_STABLE_VERSION = r.json().get("openshot_version")
54+
info.ERROR_REPORT_RATE_STABLE = r.json().get("error_rate_stable")
55+
info.ERROR_REPORT_RATE_UNSTABLE = r.json().get("error_rate_unstable")
5356

5457
# Emit signal for the UI
5558
get_app().window.FoundVersionSignal.emit(openshot_version)

0 commit comments

Comments
 (0)