-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add performance monitoring API (#470)
* Add tracing settings * Update tracing init for Apple * Add tracing init for Android * Replace switch in Apple tracing init * Add tracing init for desktop * Add placeholder classes for performance monitoring API * Update plugin snapshot * Add get/set methods for Span and Trancaction native impl * Add minimap API for starting/finishing transactions * Add basic spans implementation * Add missing implementation parts * Add performance test workflow to demo * Fix Android crash * Add transaction and span convertors for desktop * Add more performance monitoring API methods * Fix comment * Fix method signature * Add missing Android implmentations * Update sample * Remove transaction SetName implementation * Update settings order * Update changelog * Fix members init order * Add const specifier to IsFinished method * Add automation test for transaction and span * Update plugin-dev/Source/Sentry/Private/SentrySettings.cpp Co-authored-by: Stefan Jandl <[email protected]> * Add missing implementation for Android span * Add log messages about sampling functions not being implemented * Add log message about missing transaction SetName implementation for Apple --------- Co-authored-by: Stefan Jandl <[email protected]>
- Loading branch information
1 parent
fd5ed68
commit ae49e20
Showing
44 changed files
with
1,151 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
plugin-dev/Source/Sentry/Private/Android/SentrySpanAndroid.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2023 Sentry. All Rights Reserved. | ||
|
||
#include "SentrySpanAndroid.h" | ||
|
||
#include "Infrastructure/SentryConvertorsAndroid.h" | ||
#include "Infrastructure/SentryJavaClasses.h" | ||
|
||
SentrySpanAndroid::SentrySpanAndroid(jobject span) | ||
: FSentryJavaObjectWrapper(SentryJavaClasses::Span, span) | ||
{ | ||
SetupClassMethods(); | ||
} | ||
|
||
void SentrySpanAndroid::SetupClassMethods() | ||
{ | ||
FinishMethod = GetMethod("finish", "()V"); | ||
IsFinishedMethod = GetMethod("isFinished", "()Z"); | ||
SetTagMethod = GetMethod("setTag", "(Ljava/lang/String;Ljava/lang/String;)V"); | ||
SetDataMethod = GetMethod("setData", "(Ljava/lang/String;Ljava/lang/Object;)V"); | ||
} | ||
|
||
void SentrySpanAndroid::Finish() | ||
{ | ||
CallMethod<void>(FinishMethod); | ||
} | ||
|
||
bool SentrySpanAndroid::IsFinished() const | ||
{ | ||
return CallMethod<bool>(IsFinishedMethod);; | ||
} | ||
|
||
void SentrySpanAndroid::SetTag(const FString& key, const FString& value) | ||
{ | ||
CallMethod<void>(SetTagMethod, *GetJString(key), *GetJString(value)); | ||
} | ||
|
||
void SentrySpanAndroid::RemoveTag(const FString& key) | ||
{ | ||
SetTag(key, TEXT("")); | ||
} | ||
|
||
void SentrySpanAndroid::SetData(const FString& key, const TMap<FString, FString>& values) | ||
{ | ||
CallMethod<void>(SetDataMethod, *GetJString(key), SentryConvertorsAndroid::StringMapToNative(values)->GetJObject()); | ||
} | ||
|
||
void SentrySpanAndroid::RemoveData(const FString& key) | ||
{ | ||
SetData(key, TMap<FString, FString>()); | ||
} |
29 changes: 29 additions & 0 deletions
29
plugin-dev/Source/Sentry/Private/Android/SentrySpanAndroid.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2023 Sentry. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include "Interface/SentrySpanInterface.h" | ||
|
||
#include "Infrastructure/SentryJavaObjectWrapper.h" | ||
|
||
class SentrySpanAndroid : public ISentrySpan, public FSentryJavaObjectWrapper | ||
{ | ||
public: | ||
SentrySpanAndroid(jobject span); | ||
|
||
void SetupClassMethods(); | ||
|
||
virtual void Finish() override; | ||
virtual bool IsFinished() const override; | ||
virtual void SetTag(const FString& key, const FString& value) override; | ||
virtual void RemoveTag(const FString& key) override; | ||
virtual void SetData(const FString& key, const TMap<FString, FString>& values) override; | ||
virtual void RemoveData(const FString& key) override; | ||
|
||
|
||
private: | ||
FSentryJavaMethod FinishMethod; | ||
FSentryJavaMethod IsFinishedMethod; | ||
FSentryJavaMethod SetTagMethod; | ||
FSentryJavaMethod SetDataMethod; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) 2023 Sentry. All Rights Reserved. | ||
|
||
#include "SentryTransactionAndroid.h" | ||
|
||
#include "Infrastructure/SentryConvertorsAndroid.h" | ||
#include "Infrastructure/SentryJavaClasses.h" | ||
|
||
SentryTransactionAndroid::SentryTransactionAndroid(jobject transaction) | ||
: FSentryJavaObjectWrapper(SentryJavaClasses::Transaction, transaction) | ||
{ | ||
SetupClassMethods(); | ||
} | ||
|
||
void SentryTransactionAndroid::SetupClassMethods() | ||
{ | ||
StartChildMethod = GetMethod("startChild", "(Ljava/lang/String;Ljava/lang/String;)Lio/sentry/ISpan;"); | ||
FinishMethod = GetMethod("finish", "()V"); | ||
IsFinishedMethod = GetMethod("isFinished", "()Z"); | ||
SetNameMethod = GetMethod("setName", "(Ljava/lang/String;)V"); | ||
SetTagMethod = GetMethod("setTag", "(Ljava/lang/String;Ljava/lang/String;)V"); | ||
SetDataMethod = GetMethod("setData", "(Ljava/lang/String;Ljava/lang/Object;)V"); | ||
} | ||
|
||
USentrySpan* SentryTransactionAndroid::StartChild(const FString& operation, const FString& desctiption) | ||
{ | ||
auto span = CallObjectMethod<jobject>(StartChildMethod, *GetJString(operation), *GetJString(desctiption)); | ||
return SentryConvertorsAndroid::SentrySpanToUnreal(*span); | ||
} | ||
|
||
void SentryTransactionAndroid::Finish() | ||
{ | ||
CallMethod<void>(FinishMethod); | ||
} | ||
|
||
bool SentryTransactionAndroid::IsFinished() const | ||
{ | ||
return CallMethod<bool>(IsFinishedMethod);; | ||
} | ||
|
||
void SentryTransactionAndroid::SetName(const FString& name) | ||
{ | ||
CallMethod<void>(SetNameMethod, *GetJString(name)); | ||
} | ||
|
||
void SentryTransactionAndroid::SetTag(const FString& key, const FString& value) | ||
{ | ||
CallMethod<void>(SetTagMethod, *GetJString(key), *GetJString(value)); | ||
} | ||
|
||
void SentryTransactionAndroid::RemoveTag(const FString& key) | ||
{ | ||
SetTag(key, TEXT("")); | ||
} | ||
|
||
void SentryTransactionAndroid::SetData(const FString& key, const TMap<FString, FString>& values) | ||
{ | ||
CallMethod<void>(SetDataMethod, *GetJString(key), SentryConvertorsAndroid::StringMapToNative(values)->GetJObject()); | ||
} | ||
|
||
void SentryTransactionAndroid::RemoveData(const FString& key) | ||
{ | ||
SetData(key, TMap<FString, FString>()); | ||
} |
32 changes: 32 additions & 0 deletions
32
plugin-dev/Source/Sentry/Private/Android/SentryTransactionAndroid.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2023 Sentry. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include "Interface/SentryTransactionInterface.h" | ||
|
||
#include "Infrastructure/SentryJavaObjectWrapper.h" | ||
|
||
class SentryTransactionAndroid : public ISentryTransaction, public FSentryJavaObjectWrapper | ||
{ | ||
public: | ||
SentryTransactionAndroid(jobject transaction); | ||
|
||
void SetupClassMethods(); | ||
|
||
virtual USentrySpan* StartChild(const FString& operation, const FString& desctiption) override; | ||
virtual void Finish() override; | ||
virtual bool IsFinished() const override; | ||
virtual void SetName(const FString& name) override; | ||
virtual void SetTag(const FString& key, const FString& value) override; | ||
virtual void RemoveTag(const FString& key) override; | ||
virtual void SetData(const FString& key, const TMap<FString, FString>& values) override; | ||
virtual void RemoveData(const FString& key) override; | ||
|
||
private: | ||
FSentryJavaMethod StartChildMethod; | ||
FSentryJavaMethod FinishMethod; | ||
FSentryJavaMethod IsFinishedMethod; | ||
FSentryJavaMethod SetNameMethod; | ||
FSentryJavaMethod SetTagMethod; | ||
FSentryJavaMethod SetDataMethod; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.