Resolver problemas de uma assinatura com transformações de mensagem única (SMTs)
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Esta página oferece algumas dicas comuns de solução de problemas para as assinaturas com SMTs.
Monitorar SMTs
Para entender a performance e o impacto dos SMTs em uma assinatura,
use as seguintes métricas de monitoramento:
A métrica subscription/message_transform_latencies
mede quanto tempo leva para as SMTs serem aplicadas a uma mensagem. A métrica
mede apenas a latência do SMT e não inclui outras partes do
tempo de entrega da mensagem.
A métrica fornece dois rótulos principais:
status: informa se a transformação foi bem-sucedida ou encontrou um problema.
filtered: indica se o SMT causou a filtragem da mensagem.
Quando um SMT filtra uma mensagem em uma assinatura, o Pub/Sub
a confirma, e a mensagem nunca é enviada aos assinantes. Esse
rótulo filtered é verdadeiro apenas quando um SMT executa a filtragem. As mensagens
filtradas usando os recursos de filtragem integrados do Pub/Sub
não são refletidas nessa métrica específica.
A métrica subscription/byte_cost é usada para identificar mensagens filtradas por SMTs ou em que as SMTs falharam. Procure estes valores específicos:
Quando um SMT filtra uma mensagem, o operation_type é smt_subscribe_filter_drop.
Se uma SMT não conseguir transformar uma mensagem, você verá uma response_code que não é OK.
Para resolver problemas de erros de INVALID_ARGUMENT, adicione um
tópico de mensagens inativas à
assinatura de interesse. O tópico de mensagens inativas captura mensagens que não
foram entregues aos assinantes, junto com um atributo chamado
CloudPubSubDeadLetterSourceSMTErrorMessage que explica o motivo da falha.
A seguir
Se você ainda tiver problemas com as SMTs de assinatura, consulte
Como receber suporte.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-17 UTC."],[],[],null,["# Troubleshooting a subscription with Single Message Transforms (SMTs)\n\nThis page provides some common troubleshooting tips for [subscriptions with SMTs](/pubsub/docs/smts/create-subscription-smt).\n\nMonitor SMTs\n------------\n\nTo understand the performance and impact of SMTs on a subscription,\nuse the following monitoring metrics:\n\nThe [subscription/message_transform_latencies](/monitoring/api/metrics_gcp_p_z#pubsub/subscription/message_transform_latencies)\nmetric measures how long it takes for SMTs to be applied to a message. The\nmetric measures only the SMT latency and does not include other parts of the\nmessage delivery time.\n\nThe metric provides two key labels:\n\n- `status`: reports whether the transformation is successful or encountered\n an issue.\n\n- `filtered`: indicates if the SMT caused the message to be filtered out.\n When an SMT filters a message on a subscription, Pub/Sub\n acknowledges it, and the message is never sent to subscribers. This\n `filtered` label is true only when an SMT performs the filtering. Messages\n filtered using Pub/Sub's [built-in filtering capabilities](/pubsub/docs/subscription-message-filter)\n are not reflected in this specific metric.\n\nThe [subscription/byte_cost](/monitoring/api/metrics_gcp_p_z#pubsub/subscription/byte_cost) metric\nis used to identify messages that are filtered by SMTs or where SMTs\nfailed. Look for these specific values:\n\n- When an SMT filters a message, the operation_type is `smt_subscribe_filter_drop`.\n\n- If an SMT fails to transform a message, you see a `response_code` that is not `OK`.\n\nA backlog is building up\n------------------------\n\nIf you see a backlog of messages building up in the subscription check for\n`INVALID_ARGUMENT` errors reported in\n[`subscription/message_transform_latencies`](/monitoring/api/metrics_gcp_p_z#pubsub/subscription/message_transform_latencies).\n\nTo troubleshoot `INVALID_ARGUMENT` errors, add a\n[dead-letter topic](/pubsub/docs/handling-failures#dead_letter_topic) to the\nsubscription of interest. The dead letter topic captures messages that couldn't\nbe delivered to subscribers, along with an attribute called\n`CloudPubSubDeadLetterSourceSMTErrorMessage` that explains the failure reason.\n\nWhat's next\n-----------\n\n- If you still have issues with your subscription SMTs, see [Getting support](/pubsub/docs/getting-support)."]]