ElasticAPM4D
1.0.0
Il s'agit d'un agent pour Elastic-APM à Delphi de collecter des mesures logicielles.
Compatible avec Elastic-APM 7.11.1 (non testé sur d'autres).
Si vous souhaitez activer StackTrace (recommandé), vous devez installer Jedi-JCL et ajouter JCL dans les définions conditionnelles.
Prise en charge de Windows et Linux.
Pour définir les paramètres globaux, vous pouvez utiliser la classe TConfig. Exemple:
Uses
ElasticAPM4D.Config;
TConfig.SetAppName( ' My App ' ); // If not defined, it'll use the application.name
TConfig.SetAppVersion( ' V1.1.0 ' ) // If not defined, it'll get the application version (only windows)
TConfig.SetActive(False); // Always active, but you can inactivate de APM agent.
TConfig.SetUrlElasticAPM( ' http://192.168.1.1:8200/intake/v2/events ' ); // default is local (http://127.0.0.1:8200/intake/v2/events)
TConfig.SetSecret( ' ' ); // Set if you use secret token for authentication
TConfig.SetEnvironment( ' production ' ); // If not defined, it'll use 'staging'
TConfig.SetUserId( ' 123 ' );
TConfig.SetUserMail( ' [email protected] ' );
TConfig.SetUserName( ' user name ' ); // if not defined, it'll get windows userExemples de transactions:
Transaction simple
Uses
ElasticAPM4D;
TApm.StartTransaction( ' MyTransactionName ' , ' MyType ' );
try
try
TApm.StartSpan( ' Sleep1 ' );
Sleep( 500 );
TApm.EndSpan;
TApm.StartSpan( ' Sleep2 ' );
Sleep( 750 );
TApm.EndSpan;
Abort;
except
on E: exception do
TApm.AddError(E);
end ;
finally
TApm.EndTransaction;
end ;
Transaction de demande de repos (TresterRequest)
RESTRequest.Resource := ' api/v1/customers ' ;
TApm.StartTransactionRequest(RESTRequest.Resource);
try
try
RESTRequest.Execute;
except
on E: EHTTPProtocolException do
TApm.AddError(E);
on E: exception do
TApm.AddError(E);
end ;
finally
TApm.EndTransaction(RESTRequest.Response);
end ;