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

add performance monitoring #606

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
20 changes: 20 additions & 0 deletions android-json-form-wizard/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ android {
multiDexEnabled true
testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"

javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}

multiDexKeepProguard file('multidex-config.pro')
}

buildTypes {
Expand All @@ -57,6 +64,14 @@ android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
configurations.all {
resolutionStrategy.force 'com.android.support:design:28.0.0'
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}


Expand Down Expand Up @@ -136,6 +151,8 @@ dependencies {
implementation "org.greenrobot:eventbus:3.2.0"
implementation 'androidx.multidex:multidex:2.0.1'

api 'io.sentry:sentry-android:5.0.1'

// PowerMock
def powerMockVersion = '2.0.9'
testImplementation "org.powermock:powermock-module-junit4:$powerMockVersion"
Expand Down Expand Up @@ -209,3 +226,6 @@ task javadoc(type: Javadoc) {
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}



2 changes: 2 additions & 0 deletions android-json-form-wizard/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:theme="@style/NativeFormsAppTheme"
tools:replace="android:theme">

<meta-data android:name="io.sentry.auto-init" android:value="false" />
<activity
android:name=".activities.JsonFormBarcodeScanActivity"
android:configChanges="keyboardHidden|orientation"
Expand All @@ -36,5 +37,6 @@
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

</application>
</manifest>
2 changes: 2 additions & 0 deletions android-json-form-wizard/src/multidex-config.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-keep class io.sentry.android.core.SentryAndroidOptions
-keep class io.sentry.android.ndk.SentryNdk
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=3.1.1-SNAPSHOT
VERSION_NAME=3.1.2-SNAPSHOT
Copy link
Contributor

Choose a reason for hiding this comment

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

Increment MINOR version number since we are adding backward compatible functionality

VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Native Form Json Wizard
Expand Down
13 changes: 13 additions & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ android {
versionCode 1
versionName "1.0"
multiDexEnabled true

buildConfigField("String", "SENTRY_DSN", "\"" + getProps("sentry.dsn") + "\"")
}

buildTypes {
Expand Down Expand Up @@ -60,3 +62,14 @@ dependencies {

implementation 'org.smartregister:opensrp-client-utils:0.0.6-SNAPSHOT'
}

// get property from local.properties
def getProps(String propName) {
def propsFile = rootProject.file('local.properties')
if (propsFile.exists()) {
def props = new Properties()
props.load(new FileInputStream(propsFile))
return props[propName]
}
return "";
}
1 change: 1 addition & 0 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:name=".MainApplication"
android:theme="@style/NativeFormsAppTheme">
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import org.json.JSONArray;
import org.json.JSONObject;

import io.sentry.ITransaction;
import io.sentry.Sentry;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private static final int REQUEST_CODE_GET_JSON = 1234;
private static final String TAG = MainActivity.class.getCanonicalName();
Expand Down Expand Up @@ -97,6 +100,8 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {

public void startForm(int jsonFormActivityRequestCode, String formName, String entityId, boolean translate) throws Exception {

ITransaction transaction = Sentry.startTransaction("#startForm", String.format("formName: %s", formName.toUpperCase()));

final String STEP1 = "step1";
final String FIELDS = "fields";
final String KEY = "key";
Expand Down Expand Up @@ -255,7 +260,7 @@ public void startForm(int jsonFormActivityRequestCode, String formName, String e
break;
}
}

transaction.finish();
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.smartregister.nativeform;

import android.app.Application;

import io.sentry.android.core.SentryAndroid;

public class MainApplication extends Application {

@Override
public void onCreate() {
super.onCreate();

//noinspection ConstantConditions
if (!BuildConfig.SENTRY_DSN.trim().isEmpty()) {
SentryAndroid.init(this, options -> {
options.setEnvironment("opensrp-native-form-sample");
options.setDsn(BuildConfig.SENTRY_DSN.trim());
});
}

}
}