This download provides a C++ wrapper library that allows instrumenting VB6 applications using the dynaTrace ADK.
VB6 Instrumentation Wrapper
- VB6dTAgentTest.zip - Standalone, instrumented vb6 test project written w/ Visual Basic 2010 Express
- dtAgentWrapper2.zip - dtAgentWrapper c++ written w/ Visual C++ 2010 Express – this very simply wraps all ADK calls with the necessary declaration type __stdcall so that the calls will work within VB6. This library is needed along with the ADK in order for the instrumentation to work (see Release subdirectory where the library is already compiled (dtAgentWrapper.dll)). This library is referenced in the VB6dTAgentTest project.
- dynaTraceVBCodeInstrumentor.zip - instrumentor utility written in Java in Netbeans - the instrumentor utility is definitely not fool proof, but is a step in the right direction and can be a real time saver.
- VBTestProfile.dts – dT Session with the profile and results of the stand-alone VB6 test.
Assumptions/clarifications on the Instrumentor:
The Instrumentor is likely to be imperfect and need manual follow-up. The level of this effort depends upon conformity to the regex patterns. Instrumentation of Functions and Subs is only done for those that have declared variables (Dims/ReDims). The assumption is if there are no declared variables, the Function or Sub is insignificant. The Instrumentor does not provide any de-instrumentation or instrumentation refinement. If needed, this will need to be done manually.# The Instrumentor only operates against .CLS or .BAS files. Any other file types will need to be manually investigated/instrumented or added to the utility.
- Two hierarchical levels of instrumentation are provided … the Function or Sub Routine itself and any DB Connection Creations, SQL Executions, or Stored Procedure Executions within those. If Functions or Sub Routines call each other, this hierarchy is maintained by default (observed PoC behavior). If needed, other leveling will need to be done manually.
- The Instrumentor automatically inserts the following:
- Declarations for ADK wrapped calls
- Agent initialization inside Class_Initialize Sub
- Function and Sub instrumentation
- Parameter capture instrumentation for Public Functions and Subs
- Error capture instrumentation
- SQL Statement, Stored Procedure, and DB Connection instrumentation
- Purepath tagging plumbing
- The Instrumentor layers in code that expects the following environment variables to be declared:
- DT_VB6_AGENTNAME - Agent Name as declared to dynaTrace
- DT_VB6_AGENTLIB - dynaTrace library location – e.g. C:\Windows\SysWOW64\dtagent.dll
- DT_VB6_SERVER - dynaTrace Server IP Address or Name
- DT_VB6_DEBUGFLAGS - dynaTrace Agent debug flags – e.g. debugTaggingADKNative=true,debugPurePathADKNative=true
- DT_INSTRUMENTATION_LEVEL - instrumentation level 1, 2, or 3 where 3 is the deepest – e.g. 1
- DT_STRINGSIZE_LIMIT - string size capture limit for Function/Sub parameters – e.g. 100
- The Instrumentor adds instrumentation leveling. At runtime, the value of the DT_INSTRUMENTATION_LEVEL environment variable is evaluated and instrumentation depth is controlled by it. Here are the levels …
- DT_INSTRUMENTATION_LEVEL=1 – Functions, Subs, and Errors
- DT_INSTRUMENTATION_LEVEL=2 – Functions, Subs, Errors, DB Connections, SQL Statements, and Stored Procedures
- DT_INSTRUMENTATION_LEVEL=3 – Functions, Subs, Errors, DB Connections, SQL Statements, Stored Procedures, and Public Function/Sub Parameters
- Specific patterns are searched for SQL Statements, Stored Procedures, and DB Connections. There are regex’s for these in the code and they can be changed, but it is unclear how common these patterns are.
- Parameter variables for SQL Executions and Stored Procedures are assumed to be strings.
- Non string or integer parameters are ignored in Public Function/Sub parameter capture instrumentation.
- Purepath tagging mechanism is not thread safe and assumes COM entry call threading constraints.
If you have any questions, please don't hesitate to ask in our Plugins and Extension Forum.