Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Adjust ViewData end_time breaks Stackdriver stats export #584

@rsalmond

Description

@rsalmond

Getting this exception while trying to export metrics to stackdriver.

Traceback (most recent call last):
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/grpc/_channel.py", line 549, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/grpc/_channel.py", line 466, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Field timeSeries[0].points[0].interval.start had an invalid value of "2019-03-27T14:35:55.669958-07:00": The start time must be equal to the end time (2019-03-27T14:37:33.72174-07:00) for the gauge metric 'custom.googleapis.com/opencensus/rsatesting_agglast/request_count'."
        debug_error_string = "{"created":"@1553722655.800461000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1039,"grpc_message":"Field timeSeries[0].points[0].interval.start had an invalid value of "2019-03-27T14:35:55.669958-07:00": The start time must be equal to the end time (2019-03-27T14:37:33.72174-07:00) for the gauge metric 'custom.googleapis.com/opencensus/rsatesting_agglast/request_count'.","grpc_status":3}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "bunk.py", line 5, in <module>
    bunk.record(1, {'http_verb': 'GET', 'response_code': '200'})
  File "/Users/rsa/dev/metrics/metrics.py", line 114, in record
    mm.record(tagmap)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/opencensus/stats/measurement_map.py", line 118, in record
    attachments=self.attachments
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/opencensus/stats/measure_to_view_map.py", line 123, in record
    self.export(view_datas)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/opencensus/stats/measure_to_view_map.py", line 134, in export
    e.export(view_datas_copy)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/opencensus/ext/stackdriver/stats_exporter/__init__.py", line 158, in export
    self.transport.export(view_data)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/opencensus/common/transports/sync.py", line 23, in export
    self.exporter.emit(datas)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/opencensus/ext/stackdriver/stats_exporter/__init__.py", line 153, in emit
    self.handle_upload(view_data)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/opencensus/ext/stackdriver/stats_exporter/__init__.py", line 165, in handle_upload
    self.upload_stats(view_data)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/opencensus/ext/stackdriver/stats_exporter/__init__.py", line 177, in upload_stats
    time_series_batch)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/google/cloud/monitoring_v3/gapic/metric_service_client.py", line 897, in create_time_series
    request, retry=retry, timeout=timeout, metadata=metadata
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 143, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/google/api_core/retry.py", line 270, in retry_wrapped_func
    on_error=on_error,
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/google/api_core/retry.py", line 179, in retry_target
    return target()
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
    return func(*args, **kwargs)
  File "/Users/rsa/dev/metrics/.venv/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "<string>", line 3, in raise_from
google.api_core.exceptions.InvalidArgument: 400 Field timeSeries[0].points[0].interval.start had an invalid value of "2019-03-27T14:35:55.669958-07:00": The start time must be equal to the end time (2019-03-27T14:37:33.72174-07:00) for the gauge metric 'custom.googleapis.com/opencensus/rsatesting_agglast/request_count'.

I have tracked it down to the end method being called on the ViewData during this copy operation.

When I comment out the call to that method my metrics are emitted successfully.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions