Members
MethodName
Represents the names of Bigtable methods. These are used as attributes for metrics, allowing for differentiation of performance by method.
RowStateEnum
Enum for chunk formatter Row state. NEW_ROW: initial state or state after commitRow or resetRow ROW_IN_PROGRESS: state after first valid chunk without commitRow or resetRow CELL_IN_PROGRESS: state when valueSize > 0(partial cell)
Methods
Int64()
Factory functions are provided instead of constants for all types for coherence and for extensibility (we need parameters at least for arrays, structs and maps)
createInstruments(exporter)
This method gets the open telemetry instruments that will store GCP metrics for a particular project.
Parameters:
| Name | Type | Description |
|---|---|---|
exporter |
The exporter the metrics will be sent to. |
createMetricsUnaryInterceptorProvider(gaxOptions, metricsCollector) → {CallOptions}
Attaches a metrics interceptor to unary calls for collecting client-side metrics.
This method modifies the given gaxOptions to include an interceptor that
will be triggered during the execution of a unary gRPC call. The interceptor
uses the provided OperationMetricsCollector to record various metrics
related to the call, such as latency, retries, and errors.
Parameters:
| Name | Type | Description |
|---|---|---|
gaxOptions |
CallOptions |
The existing GAX call options to modify. |
metricsCollector |
OperationMetricsCollector |
The metrics collector for the operation. |
Returns:
| Type | Description |
|---|---|
| CallOptions |
The modified |
createReadStreamInternal(table, metricsCollector, optsopt) → {stream}
Creates a readable stream of rows from a Bigtable table or authorized view.
This internal method handles the core logic for streaming rows from a Bigtable table. It supports various filtering, limiting, and retry mechanisms. It can be used to create a stream for either a whole table or an authorized view.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
table |
Table |
The Table instance to read rows from. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
metricsCollector |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
opts |
GetRowsOptions |
<optional> |
Optional configuration for the read operation. Properties
|
Returns:
| Type | Description |
|---|---|
| stream |
A readable stream of Row objects. |
generateClientUuid() → {string}
Generates a unique client identifier string.
This function creates a client identifier that incorporates the hostname, process ID, and a UUID to ensure uniqueness across different client instances and processes. The identifier follows the pattern:
node-<uuid>-<pid><hostname>
where:
<uuid>is a randomly generated UUID (version 4).<pid>is the process ID of the current Node.js process.<hostname>is the hostname of the machine.
Returns:
| Type | Description |
|---|---|
| string |
A unique client identifier string. |
getDistributionPoints(dataPoint)
This function gets the timeseries data points for metrics that are represented as distributions on the backend. These data points are part of a timeseries object that is recorded to Google Cloud Monitoring.
Parameters:
| Name | Type | Description |
|---|---|---|
dataPoint |
DataPoint |
The datapoint containing the data we wish to send to the Google Cloud Monitoring dashboard |
getDomain(prefixopt, optionsopt, gaxOptsopt) → {string}
Retrieves the domain to be used for the service path.
This function retrieves the domain from gax.ClientOptions passed in or via an environment variable. It defaults to 'googleapis.com' if none has been set.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix |
string |
<optional> |
The prefix for the domain. |
options |
BigtableOptions |
<optional> |
The options passed into the Bigtable client. |
gaxOpts |
gax.ClientOptions |
<optional> |
The gax client options. |
Returns:
| Type | Description |
|---|---|
| string |
The universe domain. |
getIntegerPoints(dataPoint)
This function gets the timeseries data points for metrics that are represented as integers on the backend. These data points are part of a timeseries object that is recorded to Google Cloud Monitoring.
Parameters:
| Name | Type | Description |
|---|---|---|
dataPoint |
DataPoint |
The datapoint containing the data we wish to send to the Google Cloud Monitoring dashboard |
getMetric(metricName, dataPoint)
getMetric gets the metric object which is used for building the timeseries object that will be sent to Google Cloud Monitoring dashboard
Parameters:
| Name | Type | Description |
|---|---|---|
metricName |
string |
The backend name of the metric that we want to record |
dataPoint |
DataPoint |
The datapoint containing the data we wish to send to the Google Cloud Monitoring dashboard |
getProperties(row)
getProperties returns the properties needed to make a request for a table.
Parameters:
| Name | Type | Description |
|---|---|---|
row |
Row |
The row to make a request for. |
getResource(projectId, dataPoint)
getResource gets the resource object which is used for building the timeseries object that will be sent to Google Cloud Monitoring dashboard
Parameters:
| Name | Type | Description |
|---|---|---|
projectId |
string |
The name of the project |
dataPoint |
DataPoint |
The datapoint containing the data we wish to send to the Google Cloud Monitoring dashboard |
getRowsInternal(table, metricsCollector, optionsOrCallbackopt, cb) → {Promise.<GetRowsResponse>|void}
Get Row objects for the rows currently in your table.
This method is not recommended for large datasets as it will buffer all rows before returning the results. Instead we recommend using the streaming API via Table#createReadStream.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
table |
TabularApiSurface |
The table instance to get rows from. |
|||||||||||||
metricsCollector |
|||||||||||||||
optionsOrCallback |
object |
<optional> |
Configuration object. See Table#createReadStream for a complete list of options. Properties
|
||||||||||||
cb |
function |
The callback function. Properties
|
Returns:
| Type | Description |
|---|---|
| Promise.<GetRowsResponse> | void |
Returns a promise that resolves with the rows if no callback is provided, otherwise calls the callback with the rows. |
getUniverseDomainOnly(options, gaxOptsopt) → {string|undefined}
Retrieves the universe domain, if configured.
This function checks for a universe domain in the following order:
- The
universeDomainproperty within the provided options. - The
universeDomainoruniverse_domainproperty within theoptsobject. - The
GOOGLE_CLOUD_UNIVERSE_DOMAINenvironment variable.
If a universe domain is found in any of these locations, it is returned.
Otherwise, the function returns undefined.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
BigtableOptions |
The Bigtable client options. |
|
gaxOpts |
gax.ClientOptions |
<optional> |
Optional gax client options. |
Returns:
| Type | Description |
|---|---|
| string | undefined |
The universe domain, or |
getUniverseDomainOptions(options, gaxOptsopt) → {Object|null}
Retrieves the universe domain options from the provided options.
This function examines the provided BigtableOptions and an optional
gax.ClientOptions object to determine the universe domain to be used.
It prioritizes the universeDomain property in the options, then checks
for universeDomain or universe_domain in the gax options, and finally
falls back to the GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable.
If a universe domain is found, it returns an object containing the
universeDomain property; otherwise, it returns null.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
BigtableOptions |
The Bigtable client options. |
|
gaxOpts |
gax.ClientOptions |
<optional> |
Optional gax client options. |
Returns:
| Type | Description |
|---|---|
| Object | null |
An object containing the |
isCancelError(error)
Checks if the error is a cancel error - caused by aborting the stream.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
isCounterValue()
Type guard function to determine if a given value is a counter value (a number).
This function checks if a value, which could be either a DistributionValue
object or a number, is specifically a number. This is used to differentiate
between counter metrics (which have numeric values) and distribution metrics
(which have more complex, object-based values).
isExpiredQueryError(error)
Checks if the error is an "expired query plan" error. For more info refer to the ExecuteQueryStateMachine
Parameters:
| Name | Type | Description |
|---|---|---|
error |
metricsToRequest(exportArgs)
Converts OpenTelemetry metrics data into a format suitable for the Google Cloud
Monitoring API's createTimeSeries method.
This function transforms the structured metrics data, including resource and metric attributes, data points, and aggregation information, into an object that conforms to the expected request format of the Cloud Monitoring API.
Parameters:
| Name | Type | Description |
|---|---|---|
exportArgs |
ResourceMetrics |
The OpenTelemetry metrics data to be converted. This object contains resource attributes, scope information, and a list of metrics with their associated data points. |
Returns:
| Type | Description |
|---|---|
|
An object representing a |
Throws:
Will throw an error if there are issues converting the data.
Example
const exportInput: ExportInput = { ... }; // Example ExportInput object
const monitoringRequest = metricsToRequest(exportInput);
// monitoringRequest can now be used in monitoringClient.createTimeSeries(monitoringRequest)
parseParameters(parameters, parameter_types)
Creates protobuf objects with explicit types from passed parameters. The protobuf Value objects have a field describing their type explicitly. For each param we create a Value object based on the provided type.
Parameters:
| Name | Type | Description |
|---|---|---|
parameters |
map from parameter name to parameter value |
|
parameter_types |
map from parameter name to parameter type |
Returns:
| Type | Description |
|---|---|
|
map from parameter name to a Value object |
Type Definitions
ClientConfig
Properties:
| Name | Type | Attributes | Default | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apiEndpoint |
string |
<optional> |
Override the default API endpoint used to reach Bigtable. This is useful for connecting to your local Bigtable emulator. |
|||||||||||||
projectId |
string |
<optional> |
The project ID from the Google Developer's
Console, e.g. 'grape-spaceship-123'. We will also check the environment
variable |
|||||||||||||
keyFilename |
string |
<optional> |
Full path to the a .json, .pem, or .p12 key
downloaded from the Google Developers Console. If you provide a path to a
JSON file, the |
|||||||||||||
appProfileId |
string |
<optional> |
An application profile ID, a configuration string value describing how Cloud Bigtable should treat traffic from a particular end user application. |
|||||||||||||
email |
string |
<optional> |
Account email address. Required when using a .pem or .p12 keyFilename. |
|||||||||||||
credentials |
object |
<optional> |
Credentials object. Properties
|
|||||||||||||
autoRetry |
boolean |
<optional> |
true |
Automatically retry requests if the response is related to rate limits or certain intermittent server errors. We will exponentially backoff subsequent requests by default. |
||||||||||||
maxRetries |
number |
<optional> |
3 |
Maximum number of automatic retries attempted before returning the error. |
GetInstancesCallback(errnullable, instances, locations, apiResponse)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
err |
Error |
<nullable> |
Request error, if any. |
instances |
Array.<Instance> |
Array of Instance instances. |
|
locations |
Array.<string> |
from which Instance information could not be retrieved |
|
apiResponse |
object |
The full API response.
Note: 'failedLocations' property may contain locations from which
Instance information could not be retrieved.
Values are of the form |
GetInstancesResponse
Properties:
| Name | Type | Description |
|---|---|---|
0 |
Array.<Instance> |
Array of Instance instances. |
1 |
Array.<string> |
locations from which Instance information could not be retrieved |
2 |
object |
The full API response.
Note: 'failedLocations' property may contain locations from which
Instance information could not be retrieved.
Values are of the form |