Back to Google Cloud Node

Custom Metric Exporter

handwritten/spanner/src/metrics/README.md

0.57.01.4 KB
Original Source

Custom Metric Exporter

The custom metric exporter, as defined in spanner-metrics-exporter.ts, is designed to work in conjunction with OpenTelemetry and the Spanner client. It converts data into its protobuf equivalent and sends it to Google Cloud Monitoring.

Filtering Criteria

The exporter filters metrics based on the following conditions, utilizing values defined in constants.ts:

  • Metrics with a scope set to spanner-nodejs.
  • Metrics with one of the following predefined names:
    • attempt_latencies
    • attempt_count
    • operation_latencies
    • operation_count
    • gfe_latencies
    • gfe_connectivity_error_count
    • afe_latencies
    • afe_connectivity_error_count

Service Endpoint

The exporter sends metrics to the Google Cloud Monitoring service endpoint, distinct from the regular client endpoint. This service endpoint operates under a different quota limit than the user endpoint and features an additional server-side filter that only permits a predefined set of metrics to pass through.

When introducing new service metrics, it is essential to ensure they are allowed through by the server-side filter as well.