diff --git a/include/zbxcacheconfig.h b/include/zbxcacheconfig.h
index f97e465e1b8..f61777868b4 100644
--- a/include/zbxcacheconfig.h
+++ b/include/zbxcacheconfig.h
@@ -93,6 +93,9 @@ typedef struct
 }
 zbx_dc_interface2_t;
 
+#define ZBX_ITEM_REQUIRES_PREPROCESSING_NO	0
+#define ZBX_ITEM_REQUIRES_PREPROCESSING_YES	1
+
 typedef struct
 {
 	zbx_uint64_t		itemid;
@@ -106,6 +109,7 @@ typedef struct
 	int			ret;
 	int			version;
 	AGENT_RESULT		result;
+	unsigned char		preprocessing;
 }
 zbx_dc_item_context_t;
 
@@ -202,6 +206,7 @@ typedef struct
 	char			*error;
 	unsigned char		*formula_bin;
 	int			snmp_max_repetitions;
+	unsigned char		preprocessing;
 }
 zbx_dc_item_t;
 
@@ -279,6 +284,7 @@ typedef struct
 	char			key_orig[ZBX_ITEM_KEY_LEN * ZBX_MAX_BYTES_IN_UTF8_CHAR + 1], *key;
 	char			trapper_hosts[ZBX_ITEM_TRAPPER_HOSTS_LEN_MAX];
 	char			logtimefmt[ZBX_ITEM_LOGTIMEFMT_LEN_MAX];
+	unsigned char		preprocessing;
 }
 zbx_history_recv_item_t;
 
diff --git a/include/zbxdbwrap.h b/include/zbxdbwrap.h
index 7b0b111fb5a..1ffaaff9bbc 100644
--- a/include/zbxdbwrap.h
+++ b/include/zbxdbwrap.h
@@ -39,8 +39,8 @@ typedef int (*zbx_trigger_func_t)(zbx_variant_t *, const zbx_dc_evaluate_item_t
 typedef void (*zbx_lld_process_agent_result_func_t)(zbx_uint64_t itemid, zbx_uint64_t hostid, AGENT_RESULT *result,
 		zbx_timespec_t *ts, char *error);
 typedef void (*zbx_preprocess_item_value_func_t)(zbx_uint64_t itemid, zbx_uint64_t hostid,
-		unsigned char item_value_type, unsigned char item_flags, AGENT_RESULT *result, zbx_timespec_t *ts,
-		unsigned char state, char *error);
+		unsigned char item_value_type, unsigned char item_flags, unsigned char preprocessing,
+		AGENT_RESULT *result, zbx_timespec_t *ts, unsigned char state, char *error);
 typedef void (*zbx_preprocessor_flush_func_t)(void);
 
 void	zbx_init_library_dbwrap(zbx_lld_process_agent_result_func_t lld_process_agent_result_func,
diff --git a/include/zbxpreproc.h b/include/zbxpreproc.h
index 18b20f9e2e6..84723b342e7 100644
--- a/include/zbxpreproc.h
+++ b/include/zbxpreproc.h
@@ -114,7 +114,8 @@ zbx_uint64_t	zbx_preprocessor_get_queue_size(void);
 void	zbx_preprocessor_get_size(struct zbx_json *json);
 void	zbx_preprocessor_get_worker_info(zbx_process_info_t *info);
 void	zbx_preprocess_item_value(zbx_uint64_t itemid, zbx_uint64_t hostid, unsigned char item_value_type,
-		unsigned char item_flags, AGENT_RESULT *result, zbx_timespec_t *ts, unsigned char state, char *error);
+		unsigned char item_flags, unsigned char preprocessing, AGENT_RESULT *result,
+		zbx_timespec_t *ts, unsigned char state, char *error);
 void	zbx_preprocessor_flush(void);
 int	zbx_preprocessor_get_diag_stats(zbx_uint64_t *preproc_num, zbx_uint64_t *pending_num,
 		zbx_uint64_t *finished_num, zbx_uint64_t *sequences_num, zbx_uint64_t *queued_num,
diff --git a/src/libs/zbxcacheconfig/dbconfig.c b/src/libs/zbxcacheconfig/dbconfig.c
index bcb04b114a9..5f849f1b75f 100644
--- a/src/libs/zbxcacheconfig/dbconfig.c
+++ b/src/libs/zbxcacheconfig/dbconfig.c
@@ -9648,6 +9648,7 @@ static void	DCget_item(zbx_dc_item_t *dst_item, const ZBX_DC_ITEM *src_item)
 	const ZBX_DC_INTERFACE		*dc_interface;
 	int				i;
 
+	dst_item->preprocessing = zbx_dc_item_requires_preprocessing(src_item);
 	dst_item->type = src_item->type;
 	dst_item->value_type = src_item->value_type;
 
@@ -10314,6 +10315,14 @@ static int	dc_preproc_item_changed(ZBX_DC_ITEM *dc_item, zbx_pp_item_t *pp_item)
 	return FAIL;
 }
 
+unsigned char	zbx_dc_item_requires_preprocessing(const ZBX_DC_ITEM *dc_item)
+{
+	if (NULL == dc_item->preproc_item && NULL == dc_item->master_item && ZBX_FLAG_DISCOVERY_RULE != dc_item->flags)
+		return ZBX_ITEM_REQUIRES_PREPROCESSING_NO;
+
+	return ZBX_ITEM_REQUIRES_PREPROCESSING_YES;
+}
+
 /******************************************************************************
  *                                                                            *
  * Purpose: get preprocessable items:                                         *
@@ -10359,12 +10368,8 @@ void	zbx_dc_config_get_preprocessable_items(zbx_hashset_t *items, zbx_dc_um_shar
 			if (ITEM_STATUS_ACTIVE != dc_item->status || ITEM_TYPE_DEPENDENT == dc_item->type)
 				continue;
 
-			if (NULL == dc_item->preproc_item && NULL == dc_item->master_item &&
-					ITEM_TYPE_INTERNAL != dc_item->type &&
-					ZBX_FLAG_DISCOVERY_RULE != dc_item->flags)
-			{
+			if (ZBX_ITEM_REQUIRES_PREPROCESSING_NO == zbx_dc_item_requires_preprocessing(dc_item))
 				continue;
-			}
 
 			if (HOST_MONITORED_BY_SERVER == dc_host->monitored_by ||
 					SUCCEED == zbx_is_item_processed_by_server(dc_item->type, dc_item->key) ||
diff --git a/src/libs/zbxcacheconfig/dbconfig.h b/src/libs/zbxcacheconfig/dbconfig.h
index c9a4c3e67bd..e4ebff8cd92 100644
--- a/src/libs/zbxcacheconfig/dbconfig.h
+++ b/src/libs/zbxcacheconfig/dbconfig.h
@@ -1131,6 +1131,7 @@ void		DCget_function(zbx_dc_function_t *dst_function, const ZBX_DC_FUNCTION *src
 void		DCget_trigger(zbx_dc_trigger_t *dst_trigger, const ZBX_DC_TRIGGER *src_trigger, unsigned int flags);
 int		DCitem_nextcheck_update(ZBX_DC_ITEM *item, const ZBX_DC_INTERFACE *interface, int flags, int now,
 			char **error);
+unsigned char	zbx_dc_item_requires_preprocessing(const ZBX_DC_ITEM *src_item);
 
 #define ZBX_TRIGGER_TIMER_NONE			0x0000
 #define ZBX_TRIGGER_TIMER_TRIGGER		0x0001
diff --git a/src/libs/zbxcacheconfig/dbhistoryconfig.c b/src/libs/zbxcacheconfig/dbhistoryconfig.c
index 46d74ff6ea1..29c86e77615 100644
--- a/src/libs/zbxcacheconfig/dbhistoryconfig.c
+++ b/src/libs/zbxcacheconfig/dbhistoryconfig.c
@@ -559,6 +559,8 @@ static void	dc_get_history_recv_item(zbx_history_recv_item_t *dst_item, const ZB
 	const ZBX_DC_TRAPITEM	*trapitem;
 	const ZBX_DC_HTTPITEM	*httpitem;
 
+	dst_item->preprocessing = zbx_dc_item_requires_preprocessing(src_item);
+
 	dst_item->type = src_item->type;
 	dst_item->value_type = src_item->value_type;
 	dst_item->state = ITEM_STATE_NORMAL;
diff --git a/src/libs/zbxdbwrap/proxy.c b/src/libs/zbxdbwrap/proxy.c
index 24bf954df92..d3c917ad460 100644
--- a/src/libs/zbxdbwrap/proxy.c
+++ b/src/libs/zbxdbwrap/proxy.c
@@ -611,8 +611,8 @@ static void	process_item_value(const zbx_history_recv_item_t *item, AGENT_RESULT
 {
 	if (HOST_MONITORED_BY_SERVER == item->host.monitored_by)
 	{
-		preprocess_item_value_cb(item->itemid, item->host.hostid, item->value_type, item->flags, result, ts,
-				item->state, error);
+		preprocess_item_value_cb(item->itemid, item->host.hostid, item->value_type, item->flags,
+				item->preprocessing, result, ts, item->state, error);
 		*h_num = 0;
 	}
 	else
diff --git a/src/libs/zbxhttppoller/httptest.c b/src/libs/zbxhttppoller/httptest.c
index 36419eecd37..e03735f068d 100644
--- a/src/libs/zbxhttppoller/httptest.c
+++ b/src/libs/zbxhttppoller/httptest.c
@@ -152,8 +152,8 @@ static void	process_test_data(zbx_uint64_t httptestid, int lastfailedstep, doubl
 			}
 
 			items[i].state = ITEM_STATE_NORMAL;
-			zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type, 0, &value,
-					ts, items[i].state, NULL);
+			zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type, 0,
+					items[i].preprocessing, &value, ts, items[i].state, NULL);
 
 			zbx_free_agent_result(&value);
 		}
@@ -285,8 +285,8 @@ static void	process_step_data(zbx_uint64_t httpstepid, zbx_httpstat_t *stat, zbx
 			}
 
 			items[i].state = ITEM_STATE_NORMAL;
-			zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type, 0, &value,
-					ts, items[i].state, NULL);
+			zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type, 0,
+					items[i].preprocessing, &value, ts, items[i].state, NULL);
 
 			zbx_free_agent_result(&value);
 		}
diff --git a/src/libs/zbxipmi/ipmi_manager.c b/src/libs/zbxipmi/ipmi_manager.c
index 75bc4c84934..7532cc48688 100644
--- a/src/libs/zbxipmi/ipmi_manager.c
+++ b/src/libs/zbxipmi/ipmi_manager.c
@@ -697,7 +697,7 @@ static int	ipmi_manager_schedule_requests(zbx_ipmi_manager_t *manager, int now,
 
 			zbx_timespec(&ts);
 			zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type,
-					items[i].flags, NULL, &ts, state, error);
+					items[i].flags, items[i].preprocessing, NULL, &ts, state, error);
 			zbx_dc_requeue_items(&items[i].itemid, &ts.sec, &errcode, 1);
 			zbx_free(error);
 			continue;
@@ -851,7 +851,7 @@ static void	ipmi_manager_process_value_result(zbx_ipmi_manager_t *manager, zbx_i
 				SET_TEXT_RESULT(&result, value);
 				value = NULL;
 				zbx_preprocess_item_value(itemid, poller->request->hostid, ITEM_VALUE_TYPE_TEXT, flags,
-						&result, &ts, state, NULL);
+						ZBX_ITEM_REQUIRES_PREPROCESSING_YES, &result, &ts, state, NULL);
 				zbx_free_agent_result(&result);
 			}
 			break;
@@ -860,8 +860,8 @@ static void	ipmi_manager_process_value_result(zbx_ipmi_manager_t *manager, zbx_i
 		case AGENT_ERROR:
 		case CONFIG_ERROR:
 			state = ITEM_STATE_NOTSUPPORTED;
-			zbx_preprocess_item_value(itemid, poller->request->hostid, ITEM_VALUE_TYPE_TEXT, flags, NULL,
-					&ts, state, value);
+			zbx_preprocess_item_value(itemid, poller->request->hostid, ITEM_VALUE_TYPE_TEXT, flags,
+					ZBX_ITEM_REQUIRES_PREPROCESSING_YES, NULL, &ts, state, value);
 			break;
 		default:
 			/* don't change item's state when network related error occurs */
diff --git a/src/libs/zbxjson/jsonpath.c b/src/libs/zbxjson/jsonpath.c
index 399dfcf6f44..5fae72526ee 100644
--- a/src/libs/zbxjson/jsonpath.c
+++ b/src/libs/zbxjson/jsonpath.c
@@ -22,6 +22,7 @@
 #include "json_parser.h"
 #include "jsonobj.h"
 #include "zbxalgo.h"
+#define ZBX_VECTOR_ARRAY_RESERVE	3
 
 typedef struct
 {
@@ -113,6 +114,7 @@ static void	zbx_vector_jsonobj_ref_add_object(zbx_vector_jsonobj_ref_t *refs, co
 	ref.external = 1;
 
 	ref.value = value;
+	zbx_vector_jsonobj_ref_reserve(refs, ZBX_VECTOR_ARRAY_RESERVE);
 	zbx_vector_jsonobj_ref_append(refs, ref);
 }
 
@@ -140,6 +142,7 @@ static void	zbx_vector_jsonobj_ref_add_string(zbx_vector_jsonobj_ref_t *refs, co
 	jsonobj_init(ref.value, ZBX_JSON_TYPE_STRING);
 	jsonobj_set_string(ref.value, zbx_strdup(NULL, str));
 
+	zbx_vector_jsonobj_ref_reserve(refs, ZBX_VECTOR_ARRAY_RESERVE);
 	zbx_vector_jsonobj_ref_append(refs, ref);
 }
 
@@ -3020,6 +3023,8 @@ static void	jsonobj_index_add_element(zbx_hashset_t *index, const char *name, zb
 	ref.name = zbx_strdup(NULL, name);
 	ref.value = obj;
 	ref.external = 0;
+
+	zbx_vector_jsonobj_ref_reserve(&el->objects, ZBX_VECTOR_ARRAY_RESERVE);
 	zbx_vector_jsonobj_ref_append(&el->objects, ref);
 }
 
diff --git a/src/libs/zbxpinger/pinger.c b/src/libs/zbxpinger/pinger.c
index 7b05e5e7dba..2b3a71a8620 100644
--- a/src/libs/zbxpinger/pinger.c
+++ b/src/libs/zbxpinger/pinger.c
@@ -57,8 +57,8 @@ static void	process_value(zbx_uint64_t itemid, zbx_uint64_t *value_ui64, double
 	if (NOTSUPPORTED == ping_result)
 	{
 		item.state = ITEM_STATE_NOTSUPPORTED;
-		zbx_preprocess_item_value(item.itemid, item.host.hostid, item.value_type, item.flags, NULL, ts,
-				item.state, error);
+		zbx_preprocess_item_value(item.itemid, item.host.hostid, item.value_type, item.flags,
+			item.preprocessing, NULL, ts, item.state, error);
 	}
 	else
 	{
@@ -72,8 +72,8 @@ static void	process_value(zbx_uint64_t itemid, zbx_uint64_t *value_ui64, double
 			SET_DBL_RESULT(&value, *value_dbl);
 
 		item.state = ITEM_STATE_NORMAL;
-		zbx_preprocess_item_value(item.itemid, item.host.hostid, item.value_type, item.flags, &value, ts,
-				item.state, NULL);
+		zbx_preprocess_item_value(item.itemid, item.host.hostid, item.value_type, item.flags,
+				item.preprocessing, &value, ts, item.state, NULL);
 
 		zbx_free_agent_result(&value);
 	}
@@ -465,7 +465,7 @@ static void	get_pinger_hosts(icmpitem_t **icmp_items, int *icmp_items_alloc, int
 
 			items[i].state = ITEM_STATE_NOTSUPPORTED;
 			zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type,
-					items[i].flags, NULL, &ts, items[i].state, error);
+					items[i].flags, items[i].preprocessing, NULL, &ts, items[i].state, error);
 
 			zbx_dc_requeue_items(&items[i].itemid, &ts.sec, &errcode, 1);
 		}
diff --git a/src/libs/zbxpoller/async_agent.c b/src/libs/zbxpoller/async_agent.c
index c0bffe80190..9a3b82054b0 100644
--- a/src/libs/zbxpoller/async_agent.c
+++ b/src/libs/zbxpoller/async_agent.c
@@ -354,6 +354,7 @@ int	zbx_async_check_agent(zbx_dc_item_t *item, AGENT_RESULT *result,  zbx_async_
 	agent_context->item.interface.addr = (item->interface.addr == item->interface.dns_orig ?
 			agent_context->item.interface.dns_orig : agent_context->item.interface.ip_orig);
 	agent_context->item.key_orig = zbx_strdup(NULL, item->key_orig);
+	agent_context->item.preprocessing = item->preprocessing;
 
 	if (item->key != item->key_orig)
 	{
diff --git a/src/libs/zbxpoller/async_httpagent.c b/src/libs/zbxpoller/async_httpagent.c
index 1ce4439bf97..494fe609cdb 100644
--- a/src/libs/zbxpoller/async_httpagent.c
+++ b/src/libs/zbxpoller/async_httpagent.c
@@ -47,6 +47,7 @@ int	zbx_async_check_httpagent(zbx_dc_item_t *item, AGENT_RESULT *result, const c
 	item->posts = NULL;
 	httpagent_context->item_context.status_codes = item->status_codes;
 	item->status_codes = NULL;
+	httpagent_context->item_context.preprocessing = item->preprocessing;
 
 	if (SUCCEED != zbx_http_request_prepare(&httpagent_context->http_context, item->request_method,
 			item->url, item->query_fields, item->headers, httpagent_context->item_context.posts,
diff --git a/src/libs/zbxpoller/async_httpagent.h b/src/libs/zbxpoller/async_httpagent.h
index 42bdc97c3e8..ae11a47c1ce 100644
--- a/src/libs/zbxpoller/async_httpagent.h
+++ b/src/libs/zbxpoller/async_httpagent.h
@@ -28,6 +28,7 @@ typedef struct
 	unsigned char	state;
 	char		*posts;
 	char		*status_codes;
+	unsigned char	preprocessing;
 }
 zbx_dc_httpitem_context_t;
 
diff --git a/src/libs/zbxpoller/async_poller.c b/src/libs/zbxpoller/async_poller.c
index 8b0239a22b9..97320ddc084 100644
--- a/src/libs/zbxpoller/async_poller.c
+++ b/src/libs/zbxpoller/async_poller.c
@@ -86,9 +86,8 @@ static void	process_async_result(zbx_dc_item_context_t *item, zbx_poller_config_
 	{
 		if (ZBX_IS_RUNNING())
 		{
-			zbx_preprocess_item_value(item->itemid,
-				item->hostid,item->value_type,item->flags,
-				&item->result, &timespec, ITEM_STATE_NORMAL, NULL);
+			zbx_preprocess_item_value(item->itemid, item->hostid, item->value_type, item->flags,
+					item->preprocessing, &item->result, &timespec, ITEM_STATE_NORMAL, NULL);
 		}
 	}
 	else
@@ -97,8 +96,9 @@ static void	process_async_result(zbx_dc_item_context_t *item, zbx_poller_config_
 		{
 			if (NOTSUPPORTED == item->ret || AGENT_ERROR == item->ret || CONFIG_ERROR == item->ret)
 			{
-				zbx_preprocess_item_value(item->itemid, item->hostid, item->value_type,
-					item->flags, NULL, &timespec, ITEM_STATE_NOTSUPPORTED, item->result.msg);
+				zbx_preprocess_item_value(item->itemid, item->hostid, item->value_type, item->flags,
+					item->preprocessing, NULL, &timespec, ITEM_STATE_NOTSUPPORTED,
+					item->result.msg);
 			}
 		}
 
@@ -175,8 +175,9 @@ static void	process_httpagent_result(CURL *easy_handle, CURLcode err, void *arg)
 		out = NULL;
 		if (ZBX_IS_RUNNING())
 		{
-			zbx_preprocess_item_value(item_context->itemid, item_context->hostid,item_context->value_type,
-					item_context->flags, &result, &timespec, ITEM_STATE_NORMAL, NULL);
+			zbx_preprocess_item_value(item_context->itemid, item_context->hostid, item_context->value_type,
+					item_context->flags, item_context->preprocessing, &result,
+					&timespec, ITEM_STATE_NORMAL, NULL);
 		}
 	}
 	else
@@ -185,7 +186,8 @@ static void	process_httpagent_result(CURL *easy_handle, CURLcode err, void *arg)
 		if (ZBX_IS_RUNNING())
 		{
 			zbx_preprocess_item_value(item_context->itemid, item_context->hostid, item_context->value_type,
-					item_context->flags, NULL, &timespec, ITEM_STATE_NOTSUPPORTED, result.msg);
+					item_context->flags, item_context->preprocessing, NULL, &timespec,
+					ITEM_STATE_NOTSUPPORTED, result.msg);
 		}
 	}
 
@@ -317,8 +319,9 @@ static void	async_initiate_queued_checks(zbx_poller_config_t *poller_config, con
 			{
 				if (ZBX_IS_RUNNING())
 				{
-					zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid,
-							items[i].value_type, items[i].flags, NULL, &timespec,
+					zbx_preprocess_item_value(items[i].itemid,
+							items[i].host.hostid, items[i].value_type,
+							items[i].flags, items[i].preprocessing, NULL, &timespec,
 							ITEM_STATE_NOTSUPPORTED, results[i].msg);
 				}
 
diff --git a/src/libs/zbxpoller/checks_snmp.c b/src/libs/zbxpoller/checks_snmp.c
index d0a0a7b2bd3..8fd8061f95c 100644
--- a/src/libs/zbxpoller/checks_snmp.c
+++ b/src/libs/zbxpoller/checks_snmp.c
@@ -3445,6 +3445,7 @@ int	zbx_async_check_snmp(zbx_dc_item_t *item, AGENT_RESULT *result, zbx_async_ta
 	snmp_context->item.value_type = item->value_type;
 	snmp_context->item.flags = item->flags;
 	snmp_context->item.key_orig = zbx_strdup(NULL, item->key_orig);
+	snmp_context->item.preprocessing = item->preprocessing;
 
 	if (item->key != item->key_orig)
 	{
diff --git a/src/libs/zbxpoller/poller_thread.c b/src/libs/zbxpoller/poller_thread.c
index 5e31ab45471..2d2b96d9830 100644
--- a/src/libs/zbxpoller/poller_thread.c
+++ b/src/libs/zbxpoller/poller_thread.c
@@ -757,7 +757,8 @@ static int	get_values(unsigned char poller_type, int *nextcheck, const zbx_confi
 			{
 				items[i].state = ITEM_STATE_NORMAL;
 				zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type,
-						items[i].flags, &results[i], &timespec, items[i].state, NULL);
+						items[i].flags, items[i].preprocessing, &results[i], &timespec,
+						items[i].state, NULL);
 			}
 			else
 			{
@@ -773,15 +774,17 @@ static int	get_values(unsigned char poller_type, int *nextcheck, const zbx_confi
 					{
 						items[i].state = ITEM_STATE_NOTSUPPORTED;
 						zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid,
-						items[i].value_type, items[i].flags, NULL, &ts_tmp, items[i].state,
+								items[i].value_type, items[i].flags,
+								items[i].preprocessing, NULL, &ts_tmp, items[i].state,
 								add_result->msg);
 					}
 					else
 					{
 						items[i].state = ITEM_STATE_NORMAL;
 						zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid,
-								items[i].value_type, items[i].flags, add_result,
-								&ts_tmp, items[i].state, NULL);
+								items[i].value_type, items[i].flags,
+								items[i].preprocessing, add_result, &ts_tmp,
+								items[i].state, NULL);
 					}
 
 					/* ensure that every log item value timestamp is unique */
@@ -797,7 +800,8 @@ static int	get_values(unsigned char poller_type, int *nextcheck, const zbx_confi
 		{
 			items[i].state = ITEM_STATE_NOTSUPPORTED;
 			zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type,
-					items[i].flags, NULL, &timespec, items[i].state, results[i].msg);
+					items[i].flags, items[i].preprocessing, NULL, &timespec,
+					items[i].state, results[i].msg);
 		}
 
 		zbx_dc_poller_requeue_items(&items[i].itemid, &timespec.sec, &errcodes[i], 1, poller_type,
diff --git a/src/libs/zbxpreproc/pp_protocol.c b/src/libs/zbxpreproc/pp_protocol.c
index 27ba8ec6c78..d902af0ccbe 100644
--- a/src/libs/zbxpreproc/pp_protocol.c
+++ b/src/libs/zbxpreproc/pp_protocol.c
@@ -942,8 +942,9 @@ static void	preprocessor_send(zbx_uint32_t code, unsigned char *data, zbx_uint32
  *                               ITEM_STATE_NOTSUPPORTED                      *
  *                                                                            *
  ******************************************************************************/
-void	zbx_preprocess_item_value(zbx_uint64_t itemid, zbx_uint64_t hostid, unsigned char item_value_type,
-		unsigned char item_flags, AGENT_RESULT *result, zbx_timespec_t *ts, unsigned char state, char *error)
+void	zbx_preprocess_item_value(zbx_uint64_t itemid, zbx_uint64_t hostid,
+		unsigned char item_value_type, unsigned char item_flags, unsigned char preprocessing,
+		AGENT_RESULT *result, zbx_timespec_t *ts, unsigned char state, char *error)
 {
 	zbx_preproc_item_value_t	value = {.itemid = itemid, .hostid = hostid, .item_value_type = item_value_type,
 					.error = error, .item_flags = item_flags, .state = state, .ts = ts,
@@ -983,14 +984,23 @@ void	zbx_preprocess_item_value(zbx_uint64_t itemid, zbx_uint64_t hostid, unsigne
 		}
 	}
 
-	if (0 == preprocessor_pack_value(&cached_message, &value))
+	if (ZBX_ITEM_REQUIRES_PREPROCESSING_YES == preprocessing)
 	{
-		zbx_preprocessor_flush();
-		preprocessor_pack_value(&cached_message, &value);
-	}
+		if (0 == preprocessor_pack_value(&cached_message, &value))
+		{
+			zbx_preprocessor_flush();
+			preprocessor_pack_value(&cached_message, &value);
+		}
 
-	if (ZBX_PREPROCESSING_BATCH_SIZE < ++cached_values)
-		zbx_preprocessor_flush();
+		if (ZBX_PREPROCESSING_BATCH_SIZE < ++cached_values)
+			zbx_preprocessor_flush();
+
+	}
+	else
+	{
+		zbx_dc_add_history(value.itemid, value.item_value_type, value.item_flags, value.result, value.ts,
+				value.state, value.error);
+	}
 
 	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __func__);
 }
@@ -1010,6 +1020,8 @@ void	zbx_preprocessor_flush(void)
 		zbx_ipc_message_init(&cached_message);
 		cached_values = 0;
 	}
+
+	zbx_dc_flush_history();
 }
 
 /******************************************************************************
diff --git a/src/libs/zbxsnmptrapper/snmptrapper.c b/src/libs/zbxsnmptrapper/snmptrapper.c
index c7ed7c1ee19..c645647b974 100644
--- a/src/libs/zbxsnmptrapper/snmptrapper.c
+++ b/src/libs/zbxsnmptrapper/snmptrapper.c
@@ -166,7 +166,8 @@ next:
 
 				items[i].state = ITEM_STATE_NORMAL;
 				zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type,
-						items[i].flags, &results[i], ts, items[i].state, NULL);
+						items[i].flags, items[i].preprocessing, &results[i], ts,
+						items[i].state, NULL);
 
 				itemids[i] = items[i].itemid;
 				lastclocks[i] = ts->sec;
@@ -174,7 +175,8 @@ next:
 			case NOTSUPPORTED:
 				items[i].state = ITEM_STATE_NOTSUPPORTED;
 				zbx_preprocess_item_value(items[i].itemid, items[i].host.hostid, items[i].value_type,
-						items[i].flags, NULL, ts, items[i].state, results[i].msg);
+						items[i].flags, items[i].preprocessing, NULL, ts, items[i].state,
+						results[i].msg);
 
 				itemids[i] = items[i].itemid;
 				lastclocks[i] = ts->sec;
diff --git a/src/zabbix_server/trapper/trapper_history_push.c b/src/zabbix_server/trapper/trapper_history_push.c
index cc9527e50bb..dd088a2e2b4 100644
--- a/src/zabbix_server/trapper/trapper_history_push.c
+++ b/src/zabbix_server/trapper/trapper_history_push.c
@@ -353,8 +353,8 @@ static void	push_item_value_to_history(const zbx_history_recv_item_t *item, zbx_
 	SET_TEXT_RESULT(&result, value->value);
 	value->value = NULL;
 
-	zbx_preprocess_item_value(item->itemid, item->host.hostid, item->value_type, item->flags, &result, &value->ts,
-			ITEM_STATE_NORMAL, NULL);
+	zbx_preprocess_item_value(item->itemid, item->host.hostid, item->value_type, item->flags, item->preprocessing,
+			&result, &value->ts, ITEM_STATE_NORMAL, NULL);
 
 	zbx_free_agent_result(&result);
 }
