[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-10。"],[[["\u003cp\u003eCloud Run functions automatically generate basic trace data for inbound requests to measure timing and identify latency issues.\u003c/p\u003e\n"],["\u003cp\u003eAdding instrumentation to your Cloud Run function allows for detailed tracing of sub-operations like database queries and API requests.\u003c/p\u003e\n"],["\u003cp\u003eCloud Run traces at a maximum rate of one request per ten seconds per function instance, with the ability to force tracing on specific requests.\u003c/p\u003e\n"],["\u003cp\u003eAutomatically generated traces do not incur billing charges, but custom spans created with Cloud Trace libraries do.\u003c/p\u003e\n"],["\u003cp\u003eInstrumentation is necessary to create custom trace spans and propagate trace context across multiple services, in order to monitor different service operations.\u003c/p\u003e\n"]]],[],null,["# Use distributed tracing\n=======================\n\nAll inbound requests to a Cloud Run function automatically\ngenerate a basic set of *trace data* to help you measure timing and\nidentify causes of latency in your function.\n\nFor more detailed tracing, you can add [additional instrumentation](/trace/docs/setup#instrumenting_tracing_for_applications) to your\nCloud Run function. This lets you measure the time it takes for\nthe request to complete different sub-operations within your\nfunction, such as database queries, API requests, or complex business\nlogic. Each of these layer-specific time measurements is a called a *span*.\n\nYou can view an analysis of your traces with [Cloud Trace](/trace/docs/overview).\n\nTrace sampling rate\n-------------------\n\nCloud Run functions performs tracing at a maximum rate of one request per\nten second interval for each Cloud Run function instance. You can also\n[force a particular request to be traced](/trace/docs/setup#force-trace).\n\nBilling charges\n---------------\n\nAutomatically generated traces, whether sampled or forced, don't cause billing\ncharges. However, if you use Cloud Trace libraries and\nadd your own spans by correlating them to Cloud Run functions provided spans,\nyou are charged by [Cloud Trace](/stackdriver/pricing#trace-costs).\n\nWhen to add instrumentation\n---------------------------\n\nIf you need more trace information than the automatically-generated trace data,\nyou must add instrumentation code to your service to enable additional tracing.\nFor example, you need to add instrumentation to:\n\n- Create custom trace spans, such as monitoring how long it takes your service to get results back from API requests.\n- Propagate trace context so Cloud Trace shows the request flow across multiple services as a single request.\n\nTo add instrumentation, refer to [Instrumenting tracing for applications](/trace/docs/setup#instrumenting_tracing_for_applications).\n| **Note:** If you add custom tracing, [adding labels to your spans](/trace/docs/trace-labels) makes it easier to filter for them in the Cloud Trace UI.\n\nView your traces\n----------------\n\nTo view an analysis of your trace data, see [viewing traces](/trace/docs/finding-traces)."]]