Skip to content

Prerequisites

Prerequisites in Data Aggregator Guide.

6 min read Updated SS MR

Prerequisites#

Follow the prerequisites to be met: 

1. Ensure that the HTTP URL is included in the transaction payload. 

2. Use the JIM ingest pipeline v29 to enable support for the HTTP URL pattern. 

Verify that the pipeline configuration is updated as follows:

curl -ku healadmin:<password> -XPUT "https://localhost:9200/_ingest/pipeline/jim-ingest-pipeline" -H 'Content-Type: application/json' -d'
{"description":"Jim Entry/Exit Time Calc Pipeline. In V7 added processors for IIB MessageFlow Trace data. In V8 Added processors for Nodejs instrumentation.V9 Bug Fix for Nodejs. In V10 Added Support for Dotnet via SignalFX, In V11 Added span status for http calls captured by JIM, In V12 Renamed span status of http calls to trace status.V17 onwards optimized java code and removed support for dotnet and nodejs.V19 Added support for dotnet and nodejs.V20 bug fix for dotnet telemetry_sdk_language extraction.V21 added dotnet error message and staktrace extraction and in ver22 is customer-specific which we have added customerId, exception_type, exception_stacktrace, exception_message. In v23 we add http.target as http_url because in new agent incoming call as http.target and outgoing call as http.url. In v24 for Example Example, we are extracting the environment.name field from process.tags to root level. V25 Added logic to remove the command-line#.v26 updated span status threshold to 2000000.V27 added fields http_response_header_errormessage and http_response_header_errorcode.v28 extracted http_response_header_errordetails and http_response_header_message. In version 29 extracted domain name and journey details from http_url","version":29,"processors":[{"script":{"lang":"painless","ignore_failure":true,"source":"\n ctx.redirect_link=1;\n if (ctx.tags != null) {\n def tags = ctx.tags.stream().collect(Collectors.toMap(tag -> tag.key, tag -> tag.value));\n\n if (tags.containsKey(\"otel.status_code\")) {\n ctx.status_code = tags.get(\"otel.status_code\");\n }\n\n if (tags.containsKey(\"telemetry.sdk.language\")) {\n ctx.telemetry_sdk_language = tags.get(\"telemetry.sdk.language\");\n }\n\n if (tags.containsKey(\"signalfx.tracing.library\")) {\n ctx.telemetry_sdk_language = tags.get(\"signalfx.tracing.library\");\n }\n \n if (tags.containsKey(\"sfx.error.stack\")) {\n ctx.exception_stacktrace = tags.get(\"sfx.error.stack\");\n }\n\n if (tags.containsKey(\"sfx.error.kind\")) {\n ctx.exception_type = tags.get(\"sfx.error.kind\");\n }\n\n if (tags.containsKey(\"sfx.error.message\")) {\n ctx.exception_message = tags.get(\"sfx.error.message\");\n }\n\n if (tags.containsKey(\"error\")) {\n ctx.error = tags.get(\"error\");\n }\n \n if (tags.containsKey(\"otel.status_description\")) {\n ctx.status_description = tags.get(\"otel.status_description\");\n }\n \n if (tags.containsKey(\"method.name\")) {\n ctx.method_name = tags.get(\"method.name\");\n }\n \n if (tags.containsKey(\"span.kind\")) {\n ctx.span_kind = tags.get(\"span.kind\");\n }\n \n if (tags.containsKey(\"http.request.header.channelid\")) {\n ctx.channelName = tags.get(\"http.request.header.channelid\");\n }\n \n if (tags.containsKey(\"http.request.header.channelkey\")) {\n ctx.channelName = tags.get(\"http.request.header.channelkey\");\n }\n \n \n // convert the values to long if they are not null\n ctx.thread_cpu_time_entry = tags.containsKey(\"thread.cpu.time.entry\") ? Long.parseLong(tags.get(\"thread.cpu.time.entry\")) : null;\n ctx.thread_cpu_time_exit = tags.containsKey(\"thread.cpu.time.exit\") ? Long.parseLong(tags.get(\"thread.cpu.time.exit\")) : null;\n ctx.system_time_millis_entry = tags.containsKey(\"sys.time.millis.entry\") ? Long.parseLong(tags.get(\"sys.time.millis.entry\")) : null;\n ctx.system_time_millis_exit = tags.containsKey(\"sys.time.millis.exit\") ? Long.parseLong(tags.get(\"sys.time.millis.exit\")) : null; \n\n // calculate the values if they are not null\n if (ctx.thread_cpu_time_exit != null && ctx.thread_cpu_time_entry != null) {\n ctx.thread_cpu_time = ctx.thread_cpu_time_exit - ctx.thread_cpu_time_entry;\n }\n\n if (ctx.system_time_millis_exit != null && ctx.system_time_millis_entry != null) {\n ctx.system_time_millis = ctx.system_time_millis_exit - ctx.system_time_millis_entry;\n }\n\n // DB related fields\n if (tags.containsKey(\"db.statement\")) { \n ctx.db_statement = tags.get(\"db.statement\");\n\n if (tags.containsKey(\"db.operation\")) {\n ctx.db_operation = tags.get(\"db.operation\");\n }\n\n if (tags.containsKey(\"db.system\")) {\n ctx.db_system = tags.get(\"db.system\");\n }\n \n if (tags.containsKey(\"db.user\")) {\n ctx.db_user = tags.get(\"db.user\");\n }\n \n if (tags.containsKey(\"db.name\")) {\n ctx.db_name = tags.get(\"db.name\");\n }\n }\n \n // HTTP Calls related fields\n if ((tags.containsKey(\"http.url\") || tags.containsKey(\"http.route\")) || tags.containsKey(\"http.target\")) {\n\n if (tags.get(\"http.url\") != null) {\n ctx.http_url = tags.get(\"http.url\");\n \n String u = ctx.http_url;\n int schemeIdx = u.indexOf(\"://\");\n if (schemeIdx >= 0) {\n int afterScheme = schemeIdx + 3;\n int firstSlash = u.indexOf('\''/'\'', afterScheme);\n if (firstSlash >= 0) {\n ctx.http_path = u.substring(firstSlash);\n } else {\n ctx.http_path = ctx.operationName;\n }\n }\n } else {\n\n if (tags.containsKey(\"http.target\")) {\n \n ctx.http_path = tags.get(\"http.target\");\n\n if (tags.get(\"http.scheme\") != null && tags.get(\"net.host.name\") != null && tags.get(\"net.host.port\") != null) {\n ctx.http_url = tags.get(\"http.scheme\") + '\''://'\'' + tags.get(\"net.host.name\") + '\'':'\'' + tags.get(\"net.host.port\") + tags.get(\"http.target\"); \n } else if(tags.get(\"http.scheme\") != null && tags.get(\"net.host.name\") != null && tags.get(\"net.host.port\") == null) {\n ctx.http_url = tags.get(\"http.scheme\") + '\''://'\'' + tags.get(\"net.host.name\") + tags.get(\"http.target\");\n } else if(tags.get(\"http.scheme\") == null && tags.get(\"net.host.name\") != null && tags.get(\"net.host.port\") != null) {\n ctx.http_url = tags.get(\"net.host.name\") + '\'':'\'' + tags.get(\"net.host.port\") + tags.get(\"http.target\");\n } else if(tags.get(\"http.scheme\") == null && tags.get(\"net.host.name\") != null && tags.get(\"net.host.port\") == null) {\n ctx.http_url = tags.get(\"net.host.name\") + tags.get(\"http.target\");\n } else if(tags.get(\"net.host.name\") == null) {\n ctx.http_url = tags.get(\"http.target\");\n }\n\n } else {\n ctx.http_url = tags.get(\"http.route\");\n }\n \n }\n \n if (tags.containsKey(\"http.request.header.isMicroserviceCall\") ||\n (ctx.http_path != null && ctx.http_path.contains(\"/APIServices/\"))) {\n ctx.call_type = \"internal\";\n } else {\n ctx.call_type = \"external\";\n }\n\n\n if (tags.containsKey(\"http.request.header.customerid\")) {\n ctx.custiomerid = tags.get(\"http.request.header.customerid\");\n }\n \n if (tags.containsKey(\"http.response.header.errormessage\")) {\n ctx.http_response_header_errormessage = tags.get(\"http.response.header.errormessage\");\n }\n \n if (tags.containsKey(\"http.response.header.errorcode\")) {\n ctx.http_response_header_errorcode = tags.get(\"http.response.header.errorcode\");\n }\n \n if (tags.containsKey(\"http.response.header.errordetails\")) {\n ctx.http_response_header_errordetails = tags.get(\"http.response.header.errordetails\");\n }\n \n if (tags.containsKey(\"http.response.header.message\")) {\n ctx.http_response_header_message = tags.get(\"http.response.header.message\");\n }\n \n if (tags.containsKey(\"http.user_agent\")) {\n ctx.http_user_agent = tags.get(\"http.user_agent\");\n }\n\n if (tags.containsKey(\"http.status_code\")) {\n ctx.http_status_code = Integer.parseInt(tags.get(\"http.status_code\"));\n }\n\n if (tags.containsKey(\"http.method\")) {\n ctx.http_method = tags.get(\"http.method\");\n }\n\n if (tags.containsKey(\"http.host\")) {\n ctx.http_host = tags.get(\"http.host\");\n }\n }\n }\n \n \n if (ctx.process.tags != null) {\n \n for (int i = 0; i < ctx.process.tags.length; i++) {\n if (ctx.process.tags[i].key == '\''process.command_line'\'') {\n ctx.process.tags[i].value = '\'''\''; // Set the value to an empty string\n break;\n }\n }\n \n def processTags = ctx.process.tags.stream().collect(Collectors.toMap(processTag -> processTag.key, processTag -> processTag.value));\n // common fields\n if (processTags.containsKey(\"instance.uid\")) {\n ctx.instance_uid = processTags.get(\"instance.uid\");\n }\n \n if (processTags.containsKey(\"agent.uid\")) {\n ctx.agent_uid = processTags.get(\"agent.uid\");\n }\n \n if (processTags.containsKey(\"telemetry.sdk.language\")) {\n ctx.telemetry_sdk_language = processTags.get(\"telemetry.sdk.language\");\n }\n \n if (processTags.containsKey(\"environment.name\")) {\n ctx.environment_name = processTags.get(\"environment.name\");\n }\n }\n\n if (ctx.references.length != 0) {\n ctx.parent_spanID = ctx.references[0].spanID;\n }\n\n // common keys in the log field\n if (ctx.logs != null && !ctx.logs.isEmpty()) {\n def logFields = ctx.logs[0].fields.stream().collect(Collectors.toMap(logFields -> logFields.key, logFields -> logFields.value));\n\n if (logFields.containsKey(\"exception.message\")) {\n ctx.exception_message = logFields.get(\"exception.message\");\n }\n\n if (logFields.containsKey(\"exception.type\")) {\n ctx.exception_type = logFields.get(\"exception.type\");\n }\n\n if (logFields.containsKey(\"exception.stacktrace\")) {\n ctx.exception_stacktrace = logFields.get(\"exception.stacktrace\");\n }\n }\n\n "}},{"gsub":{"if":"ctx?.telemetry_sdk_language == '\''dotnet-tracing'\''","field":"telemetry_sdk_language","pattern":"-tracing","replacement":"","ignore_failure":true}},{"grok":{"if":"ctx?.db_operation == null && ctx?.db_statement != null","ignore_failure":true,"field":"db_statement","patterns":["%{WORD:db_operation}"]}},{"uppercase":{"if":"ctx?.db_operation != null && ctx?.db_statement != null","ignore_failure":true,"field":"db_operation"}},{"script":{"lang":"painless","ignore_failure":true,"source":"\n if (ctx.containsKey('\''http_url'\'') && ctx.http_url != null) {\n def url = ctx.http_url;\n def parts = url.splitOnToken('\''/'\'');\n \n // Defensive: ignore empty or malformed\n if (parts.length > 0) {\n // Store each segment if exists\n if (parts.length > 3) ctx.msName_from_url = parts[3]; \n if (parts.length > 4) ctx.apiName_from_url = parts[4]; \n if (parts.length > 5) ctx.domainName_from_url = parts[5]; \n // Only set journeyName_from_url if conditions match\n if (\n ctx.msName_from_url != null && \n ctx.apiName_from_url != null &&\n ctx.msName_from_url == '\''Gateway'\'' &&\n ctx.apiName_from_url == '\''API'\'' &&\n parts.length > 6\n ) {\n ctx.journeyName_from_url = parts[6];\n }\n }\n }\n "}},{"script":{"lang":"painless","ignore_failure":true,"source":"\n if (ctx?.duration != null) {\n if (ctx?.http_status_code != null) {\n if (ctx?.http_status_code >= 200 && ctx?.http_status_code < 400) {\n if (ctx?.duration > 0 && ctx?.duration <= 2000000) {\n ctx.span_status = \"OK\";\n if (ctx?.references.length == 0) {\n ctx.trace_status = \"OK\";\n }\n } else if (ctx?.duration > 2000001) {\n ctx.span_status = \"SLOW\";\n if (ctx?.references.length == 0) {\n ctx.trace_status = \"SLOW\";\n }\n }\n } else if (ctx?.http_status_code >= 400 && ctx?.http_status_code < 600) {\n ctx.span_status = \"ERROR\";\n if (ctx?.references.length == 0) {\n ctx.trace_status = \"ERROR\";\n }\n } \n } else if (ctx?.error != null && ctx?.error == \"true\") {\n ctx.span_status = \"ERROR\";\n if (ctx?.references.length == 0) {\n ctx.trace_status = \"ERROR\";\n }\n } else {\n if (ctx?.duration > 0 && ctx?.duration <= 2000000) {\n ctx.span_status = \"OK\";\n if (ctx?.references.length == 0) {\n ctx.trace_status = \"OK\";\n }\n } else if (ctx?.duration > 2000001) {\n ctx.span_status = \"SLOW\";\n if (ctx?.references.length == 0) {\n ctx.trace_status = \"SLOW\";\n }\n }\n }\n }\n "}},{"remove":{"ignore_failure":true,"field":["thread_cpu_time_exit","thread_cpu_time_entry","system_time_millis_exit","system_time_millis_entry","exception_type_str"]}}]}'