Hi Bill,
Patch 1: Add the environment variable "ARM_CORRELATOR" with the
current stringified correlator to the "subprocess_env" table
And the last one, adding the environemtn variable
Besides the added environment variable: I moved the addition of
variables to any tables to the place where the stop_transaction is
registered, i.e. the environment variable and the other variables are
only "activated" in case the start_transaction was successfull.
The applying of patches shopuld work in any order (as far as I know
patch can handle this), but the order of the pacthes is
1. configure structure
2. arm_destroy_app
3. added metric
4. ARM_CORRELATOR environment
Uff
Hope it works
Greetings
Kai
Now a beer :-)
diff -Naur -x .svn -x CVS mod_arm4_svn_20050825_changed3/mod_arm4.c
mod_arm4_svn_20050825_changed4/mod_arm4.c
--- mod_arm4_svn_20050825_changed3/mod_arm4.c 2005-09-22 21:31:35.000000000
+0200
+++ mod_arm4_svn_20050825_changed4/mod_arm4.c 2005-09-22 21:39:15.000000000
+0200
@@ -124,6 +124,10 @@
} request_config_t;
static int module_is_disabled = 0;
+/**
+ * The correlator environment variable is created by the process with his pid.
+ */
+static const char *correlator_env_name = "ARM_CORRELATOR";
/*
* Convert binary data into a hex string.
@@ -897,8 +901,8 @@
/* Check for an ARM_CORRELATOR header field on the inbound request, set the
* parent_correlator.
*/
- parent_correlator = NULL;
- stringified_parent_correlator = apr_table_get(r->headers_in,
"ARM_CORRELATOR");
+ parent_correlator = ARM_CORR_NONE;
+ stringified_parent_correlator = apr_table_get(r->headers_in,
correlator_env_name);
if (stringified_parent_correlator) {
int len;
@@ -952,6 +956,25 @@
apr_pool_cleanup_null);
stringified_correlator = (unsigned char *) apr_pcalloc(r->pool,
(2*ARM_CORR_MAX_LENGTH+1));
stringify_Correlator(correlator, stringified_correlator);
+ /**
+ * update the environment with the currently running transaction
correlator
+ */
+ /* TODO: Develop config driven or huristic for when to add the
ARM_CORRELATOR.
+ * For now, always add the correlator.
+ * KE, 09/2005:
+ * The ARM_CORRELATOR variable name is changed to HTTP_ARM_CORRELATOR
within cgi scripts.
+ * I am adding the same variable to subprocess_env so that cgi scripts
will be
+ * able to use it as ARM_CORRELATOR
+ */
+ apr_table_set(r->headers_in,
+ correlator_env_name,
+ (char*) stringified_correlator);
+ apr_table_set(r->err_headers_out,
+ correlator_env_name,
+ (char*) stringified_correlator); /* Is this necessary? */
+ apr_table_set(r->subprocess_env,
+ correlator_env_name,
+ (char*) stringified_correlator);
}
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
@@ -980,12 +1003,6 @@
attribvalues[7],
attribvalues[8]);
- /* TODO: Develop config driven or huristic for when to add the
ARM_CORRELATOR.
- * For now, always add the correlator.
- */
- apr_table_set(r->headers_in, "ARM_CORRELATOR", (char*)
stringified_correlator);
- apr_table_set(r->err_headers_out, "ARM_CORRELATOR", (char*)
stringified_correlator); /* Is this necessary? */
-
/* Poor man's way to bracket the call to the handler with
* arm_block_transaction()/arm_unblock_transaction() calls. The
* arm_unblock_transaction() is called in the logging phase. If you