UNPKG

@google-cloud/spanner

Version:
106 lines 6.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.METRIC_VIEWS = exports.AFE_LATENCY_VIEW = exports.GFE_LATENCY_VIEW = exports.ATTEMPT_LATENCY_VIEW = exports.OPERATION_LATENCY_VIEW = exports.HISTOGRAM_BUCKET_BOUNDARIES = exports.UNKNOWN_ATTRIBUTE = exports.METRIC_NAMES = exports.METRIC_NAME_AFE_CONNECTIVITY_ERROR_COUNT = exports.METRIC_NAME_AFE_LATENCIES = exports.METRIC_NAME_GFE_CONNECTIVITY_ERROR_COUNT = exports.METRIC_NAME_GFE_LATENCIES = exports.METRIC_NAME_ATTEMPT_COUNT = exports.METRIC_NAME_OPERATION_COUNT = exports.METRIC_NAME_ATTEMPT_LATENCIES = exports.METRIC_NAME_OPERATION_LATENCIES = exports.METRIC_LABELS = exports.METRIC_LABEL_KEY_STATUS = exports.METRIC_LABEL_KEY_METHOD = exports.METRIC_LABEL_KEY_DATABASE = exports.METRIC_LABEL_KEY_CLIENT_NAME = exports.METRIC_LABEL_KEY_CLIENT_UID = exports.MONITORED_RESOURCE_LABELS = exports.MONITORED_RES_LABEL_KEY_CLIENT_HASH = exports.MONITORED_RES_LABEL_KEY_LOCATION = exports.MONITORED_RES_LABEL_KEY_INSTANCE_CONFIG = exports.MONITORED_RES_LABEL_KEY_INSTANCE = exports.MONITORED_RES_LABEL_KEY_PROJECT = exports.MIN_EXPORT_FREQUENCY_MS = exports.ATTR_CLOUD_REGION = exports.TRACER_CLEANUP_INTERVAL_MS = exports.TRACER_CLEANUP_THRESHOLD_MS = exports.SPANNER_RESOURCE_TYPE = exports.CLIENT_METRICS_PREFIX = exports.SPANNER_METER_NAME = void 0; // Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. const sdk_metrics_1 = require("@opentelemetry/sdk-metrics"); exports.SPANNER_METER_NAME = 'spanner-nodejs'; exports.CLIENT_METRICS_PREFIX = 'spanner.googleapis.com/internal/client'; exports.SPANNER_RESOURCE_TYPE = 'spanner_instance_client'; // Maximum time to keep MetricsTracers before considering them stale, and stop tracking them. exports.TRACER_CLEANUP_THRESHOLD_MS = 60 * 60 * 1000; // 60 minutes exports.TRACER_CLEANUP_INTERVAL_MS = 30 * 60 * 1000; // 30 Minutes // OTel semantic conventions // See https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv exports.ATTR_CLOUD_REGION = 'cloud.region'; // Minimum period that must past between metric exports exports.MIN_EXPORT_FREQUENCY_MS = 30 * 1000; // Monitored resource labels exports.MONITORED_RES_LABEL_KEY_PROJECT = 'project_id'; exports.MONITORED_RES_LABEL_KEY_INSTANCE = 'instance_id'; exports.MONITORED_RES_LABEL_KEY_INSTANCE_CONFIG = 'instance_config'; exports.MONITORED_RES_LABEL_KEY_LOCATION = 'location'; exports.MONITORED_RES_LABEL_KEY_CLIENT_HASH = 'client_hash'; exports.MONITORED_RESOURCE_LABELS = new Set([ exports.MONITORED_RES_LABEL_KEY_PROJECT, exports.MONITORED_RES_LABEL_KEY_INSTANCE, exports.MONITORED_RES_LABEL_KEY_INSTANCE_CONFIG, exports.MONITORED_RES_LABEL_KEY_LOCATION, exports.MONITORED_RES_LABEL_KEY_CLIENT_HASH, ]); // Metric labels exports.METRIC_LABEL_KEY_CLIENT_UID = 'client_uid'; exports.METRIC_LABEL_KEY_CLIENT_NAME = 'client_name'; exports.METRIC_LABEL_KEY_DATABASE = 'database'; exports.METRIC_LABEL_KEY_METHOD = 'method'; exports.METRIC_LABEL_KEY_STATUS = 'status'; exports.METRIC_LABELS = new Set([ exports.METRIC_LABEL_KEY_CLIENT_UID, exports.METRIC_LABEL_KEY_CLIENT_NAME, exports.METRIC_LABEL_KEY_DATABASE, exports.METRIC_LABEL_KEY_METHOD, exports.METRIC_LABEL_KEY_STATUS, ]); // Metric names exports.METRIC_NAME_OPERATION_LATENCIES = 'operation_latencies'; exports.METRIC_NAME_ATTEMPT_LATENCIES = 'attempt_latencies'; exports.METRIC_NAME_OPERATION_COUNT = 'operation_count'; exports.METRIC_NAME_ATTEMPT_COUNT = 'attempt_count'; exports.METRIC_NAME_GFE_LATENCIES = 'gfe_latencies'; exports.METRIC_NAME_GFE_CONNECTIVITY_ERROR_COUNT = 'gfe_connectivity_error_count'; exports.METRIC_NAME_AFE_LATENCIES = 'afe_latencies'; exports.METRIC_NAME_AFE_CONNECTIVITY_ERROR_COUNT = 'afe_connectivity_error_count'; exports.METRIC_NAMES = new Set([ exports.METRIC_NAME_OPERATION_LATENCIES, exports.METRIC_NAME_ATTEMPT_LATENCIES, exports.METRIC_NAME_GFE_LATENCIES, exports.METRIC_NAME_OPERATION_COUNT, exports.METRIC_NAME_ATTEMPT_COUNT, exports.METRIC_NAME_GFE_CONNECTIVITY_ERROR_COUNT, exports.METRIC_NAME_AFE_LATENCIES, exports.METRIC_NAME_AFE_CONNECTIVITY_ERROR_COUNT, ]); exports.UNKNOWN_ATTRIBUTE = 'unknown'; // Histogram Bucket boundaries exports.HISTOGRAM_BUCKET_BOUNDARIES = [ 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 25.0, 30.0, 40.0, 50.0, 65.0, 80.0, 100.0, 130.0, 160.0, 200.0, 250.0, 300.0, 400.0, 500.0, 650.0, 800.0, 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 50000.0, 100000.0, 200000.0, 400000.0, 800000.0, 1600000.0, 3200000.0, ]; // Defined Views for metric aggregation exports.OPERATION_LATENCY_VIEW = new sdk_metrics_1.View({ instrumentName: exports.METRIC_NAME_OPERATION_LATENCIES, aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(exports.HISTOGRAM_BUCKET_BOUNDARIES), }); exports.ATTEMPT_LATENCY_VIEW = new sdk_metrics_1.View({ instrumentName: exports.METRIC_NAME_ATTEMPT_LATENCIES, aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(exports.HISTOGRAM_BUCKET_BOUNDARIES), }); exports.GFE_LATENCY_VIEW = new sdk_metrics_1.View({ instrumentName: exports.METRIC_NAME_GFE_LATENCIES, aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(exports.HISTOGRAM_BUCKET_BOUNDARIES), }); exports.AFE_LATENCY_VIEW = new sdk_metrics_1.View({ instrumentName: exports.METRIC_NAME_AFE_LATENCIES, aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(exports.HISTOGRAM_BUCKET_BOUNDARIES), }); exports.METRIC_VIEWS = [ exports.OPERATION_LATENCY_VIEW, exports.ATTEMPT_LATENCY_VIEW, exports.GFE_LATENCY_VIEW, exports.AFE_LATENCY_VIEW, ]; //# sourceMappingURL=constants.js.map