[[["易于理解","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-08-04。"],[],[],null,["# Microservices observability overview\n\nMicroservices observability tools provide you with the ability to instrument your\napplications to collect and present telemetry data in\n[Cloud Monitoring](/monitoring/docs/monitoring-overview), [Cloud Logging](/logging/docs/overview),\nand [Cloud Trace](/trace/docs/overview) from\n[gRPC](https://grpc.io/) workloads deployed on Google Cloud\nand elsewhere.\n\nThis documentation is intended for gRPC service owners, site reliability\nengineers, and anyone who uses telemetry data for troubleshooting and optimizing\ngRPC workloads.\n\nObservability wraps the [OpenCensus](https://opencensus.io/) plugins for\nmetrics, traces, and gRPC logging into a single unified plugin, without exposing\nany dependencies. Microservices observability uses observability data that's\nintegrated with Cloud Monitoring, Cloud Logging, and\nCloud Trace. The documentation provides instructions for incorporating\nobservability plugins into your gRPC applications.\n\nTo help you collect information and debug your applications, Microservices\nobservability includes the following features:\n\n- Transport-level RPC events logging generation.\n- Distributed tracing support.\n- Cloud Monitoring support, including predefined dashboards.\n- Cloud Logging suggested queries.\n- Resource labels and custom labels.\n\nFeatures\n--------\n\nThis section describes Microservices observability features.\n\n### Telemetry Integration\n\nThe observability plugin packages for each gRPC language (C++, Go, and Java) are\nintegrated with Google Cloud Observability by default. With minimal configuration, the plugin\nretrieves metadata about your project and deployment, and configures the default\nquantities of tracing, metrics, and logging data generation.\n\n### Inspect RPC transport-level events\n\nThe lifecycle of a remote procedure call (RPC) can contain metadata events,\nincluding headers and trailers; message events; and status events, including OK\nstatus and error status, and finishing events. When you use Microservices\nobservability, you can inspect the details for each type of event. You can\ninspect serialized message length, authority, client/server addresses, and\nwhether the client or the server canceled the RPC.\n\nWith explicit settings, Microservices observability can enable payload logging\nfor messages or headers. You can set size limits for the payload logs, control\nmessage, or header payload logs separately. You can also specify the target\ngroup of methods with or without wildcards.\n\n### Distributed tracing support for RPCs\n\nServer architecture can allow an RPC to fan out into multiple calls or separate\nrequests that flow through components. Microservices observability uses\ndistributed tracing to make it easier to analyze and troubleshoot complex\nsystems. The Microservices observability product provides built-in support for\ngRPC applications to start traces, generate\n[spans](https://opencensus.io/tracing/span/#span), and propagate the tracing\ncontext.\n\n### Capture measurements for metrics monitoring\n\nThe plugin provides first-party support for a wide range of measures at message-\nlevel, RPC-level, or method-level, from message counts and message sizes to\nlatencies. The measurements are uploaded to Cloud Monitoring. You can explore\nthe collected metrics using the Cloud Monitoring\n[Metrics Explorer](/monitoring/charts/metrics-explorer), which\nhas a dashboard with a set of pre-existing charts. You can also present the\nmetrics in your own custom dashboards.\n\n### Traces and logs correlation\n\nTraces help you identify errors and issues in your systems, while log entries\nhelp you identify the details of any errors and issues. Taken together, traces\nand logs provide you with an in-depth picture of the errors or issues, giving\nyou a more complete understanding of RPCs that span different systems.\nMicroservices observability automatically correlates logs with traces, which\nare sampled based on upstream sampling decisions or user-defined sampling\nrates.\n\n### Resource labels and custom labels\n\nTo make it more effective for you to explore observability data, Microservices\nobservability provides resource labels by default and allows your application\nto define custom labels. Resource labels are deployment-specific key-value\npairs that annotate the location of the workload, for example, the Compute Engine\nnode name or the Google Kubernetes Engine namespace.\n\nCustom labels provide a mechanism for attaching customized information as\nfollows:\n\n- As span labels to tracing data.\n- As metric labels to metrics data.\n- As log entry labels to logging data.\n\nCustom labels are helpful when you want to include source versions or canonical\nservice names. You can use them to add user-specific information, which helps\nto identify specific observability data in your logs, metrics, and traces.\n\n### Suggested queries\n\nMicroservices observability automatically provides several suggested queries\nin Cloud Logging. For complete information, see\n[Suggested queries](/stackdriver/docs/solutions/grpc/set-up-observability#suggested-queries).\n\nArchitecture\n------------\n\nThe following diagram illustrates how Microservices observability collects and\nserves observability data:\n[](/static/stackdriver/docs/solutions/grpc/images/observability-flow.svg) Microservices observability data collection and serving (click to enlarge)\n\nFirst, you specify observability configuration to your gRPC workload. The\nobservability configuration consists of fields that you set in an environment\nvariable. The configuration defines the following:\n\n- Trace spans that are exported to Cloud Trace.\n- Metrics data that is exported to Cloud Monitoring.\n- RPC events that are exported to Cloud Logging.\n\nYou can then view this information on custom dashboards in Cloud Monitoring\nand obtain suggested queries in Cloud Logging. You can also export\ninformation from Cloud Trace, Cloud Monitoring, and\nCloud Logging to third-party platforms of your choice.\n\nPricing\n-------\n\nMicroservices observability pricing is the same as Google Cloud Observability pricing.\nThere are no separate charges for using Cloud Trace, Cloud Logging, and\nCloud Monitoring with the Microservices observability plugins. For more\ninformation, see [Google Cloud Observability pricing](https://cloud.google.com/stackdriver/pricing).\n\nWhat's next\n-----------\n\n- For information about setting up Microservices observability, see\n [Set up Microservices observability](/stackdriver/docs/solutions/grpc/set-up-observability).\n\n- For detailed information about configuration data, trace definitions, metrics\n definitions, and log definitions, see [Microservices observability reference](/stackdriver/docs/solutions/grpc/observability-reference)."]]