AppDynamics C/C++ SDK  21.3
Reference documentation for the C/C++ SDK.
appd::sdk::BT Class Reference

#include <appdynamics.h>

Inheritance diagram for appd::sdk::BT:
appd::sdk::HandleWrapper< appd_bt_handle >

Public Member Functions

 BT (const char *name, const char *correlation_header=NULL)
 
 BT (const std::string &name)
 
 BT (const std::string &name, const std::string &correlation_header)
 
 BT (appd_bt_handle bt)
 
 ~BT ()
 
void store (const char *guid)
 
void store (const std::string &guid)
 
bool is_snapshotting () const
 
bool enable_snapshot () const
 
virtual void add_error (enum appd_error_level level, const char *message, bool mark_bt_as_error=true)
 
void add_user_data (const char *key, const char *value)
 
void add_user_data (const std::string &key, const std::string &value)
 
void set_url (const char *url)
 
void set_url (const std::string &url)
 
- Public Member Functions inherited from appd::sdk::HandleWrapper< appd_bt_handle >
 HandleWrapper ()
 
 HandleWrapper (appd_bt_handle handle)
 
virtual ~HandleWrapper ()=default
 
appd_bt_handle handle ()
 
const appd_bt_handle handle () const
 
void add_error (enum appd_error_level level, const std::string &message, bool mark_bt_as_error=true)
 

Protected Member Functions

void init (const char *name, const char *correlation_header=NULL)
 

Private Member Functions

 BT ()
 

Additional Inherited Members

- Protected Attributes inherited from appd::sdk::HandleWrapper< appd_bt_handle >
appd_bt_handle m_handle
 
bool m_borrowed_handle
 

Detailed Description

Represents an AppDynamics business transaction for C++ applications.

An instance of this class begins a business transaction (similar to calling appd_bt_begin) upon construction and ends the business transaction upon destruction. You can match a business transaction's lifetime to a scope:

{
    appd::sdk::BT bt("compute");

    // all code in this scope is part of the "compute" BT
    // `bt` is automatically ended when it goes out of scope
}

When a BT has a lifetime that depends on the nondeterministic lifetimes of other objects, you can use a shared pointer to a BT to keep the BT alive for the lifetimes of its dependencies:

auto bt = std::make_shared<appd::sdk::BT>("compute");
auto prod = createProducer(bt);
auto consumers = createConsumers(bt, NUM_WORKERS);

In this example, the BT ends when the last reference to it ends.

You cannot copy a business transaction.

Constructor & Destructor Documentation

◆ BT() [1/5]

appd::sdk::BT::BT ( const char *  name,
const char *  correlation_header = NULL 
)
inline

Construct a business transaction object with the given name.

If a valid AppDynamics correlation_header is passed (generated by the SDK or another agent), the business transaction is marked to continue the transaction described in the header.

Parameters
nameThe name of the Business Transaction.
correlation_headerAn AppDynamics correlation header or NULL.

◆ BT() [2/5]

appd::sdk::BT::BT ( const std::string &  name)
inlineexplicit

Construct a BT object with the given name.

This name will be used if there is no correlation string available (for continuing BTs from an upstream tier) or if the Controller has not yet initialized the agent configuration.

Parameters
nameThe name of the Business Transaction.

◆ BT() [3/5]

appd::sdk::BT::BT ( const std::string &  name,
const std::string &  correlation_header 
)
inline

Construct a continuing business transaction object with the given name and correlation header.

The name is used only if the correlation header is empty or otherwise invalid, in which case this BT will be reported as an originating BT with the specified name.

Parameters
nameThe name of the Business Transaction if the correlation header is invalid.
correlation_headerAn AppDynamics correlation header.

◆ BT() [4/5]

appd::sdk::BT::BT ( appd_bt_handle  bt)
inline

Wrap an appd_bt_handle in a BT object. The BT object does not own the wrapped handle: destructing this object will not end the wrapped BT.

Parameters
btThe handle of a BT, as returned by appd_bt_begin or appd_bt_get.

◆ ~BT()

appd::sdk::BT::~BT ( )
inline

◆ BT() [5/5]

appd::sdk::BT::BT ( )
private

Member Function Documentation

◆ add_error()

virtual void appd::sdk::BT::add_error ( enum appd_error_level  level,
const char *  message,
bool  mark_bt_as_error = true 
)
inlinevirtual

Calls appd_bt_add_error on this BT with the given error information.

Implements appd::sdk::HandleWrapper< appd_bt_handle >.

◆ add_user_data() [1/2]

void appd::sdk::BT::add_user_data ( const char *  key,
const char *  value 
)
inline

Calls appd_bt_add_user_data on this business transaction with the given key and value.

◆ add_user_data() [2/2]

void appd::sdk::BT::add_user_data ( const std::string &  key,
const std::string &  value 
)
inline

Calls appd_bt_add_user_data on this business transaction with the given key and value.

◆ enable_snapshot()

bool appd::sdk::BT::enable_snapshot ( ) const
inline

Calls appd_bt_enable_snapshot on this BT.

◆ init()

void appd::sdk::BT::init ( const char *  name,
const char *  correlation_header = NULL 
)
inlineprotected

◆ is_snapshotting()

bool appd::sdk::BT::is_snapshotting ( ) const
inline

Calls appd_bt_is_snapshotting on this BT.

◆ set_url() [1/2]

void appd::sdk::BT::set_url ( const char *  url)
inline

Calls appd_bt_set_url on this business transaction with the given URL.

◆ set_url() [2/2]

void appd::sdk::BT::set_url ( const std::string &  url)
inline

Calls appd_bt_set_url on this business transaction with the given URL.

◆ store() [1/2]

void appd::sdk::BT::store ( const char *  guid)
inline

Calls appd_bt_store on this BT with the given GUID.

◆ store() [2/2]

void appd::sdk::BT::store ( const std::string &  guid)
inline

Calls appd_bt_store on this BT with the given GUID.


The documentation for this class was generated from the following file: