def test_should_change_signature_when_metric_values_are_added(self):
     without_mvs = check_request.sign(self.test_check_request)
     self.test_op.metricValueSets = [
         messages.MetricValueSet(metricName='a_float',
                                 metricValues=[
                                     metric_value.create(
                                         labels={
                                             'key1': 'value1',
                                             'key2': 'value2'
                                         },
                                         doubleValue=1.1,
                                     ),
                                 ])
     ]
     with_mvs = check_request.sign(self.test_check_request)
     expect(with_mvs).not_to(equal(without_mvs))
                      api_key_valid=True),
  messages.Operation(
      importance=messages.Operation.ImportanceValueValuesEnum.LOW,
      logEntries=[],
      labels=encoding.PyValueToMessage(
          messages.Operation.LabelsValue, {
              'servicecontrol.googleapis.com/service_agent':
              _WANTED_SERVICE_AGENT,
              'servicecontrol.googleapis.com/user_agent':
              _WANTED_USER_AGENT,
              'servicecontrol.googleapis.com/platform': _WANTED_PLATFORM,
          }),
      metricValueSets=[
          messages.MetricValueSet(
              metricName=_EXPECTED_OK_METRIC.metric_name,
              metricValues=[
                  metric_value.create(int64Value=1),
              ]),
      ],
      consumerId='api_key:' + _TEST_API_KEY,
      operationId='an_op_id',
      operationName='an_op_name',
      startTime=_START_OF_EPOCH_TIMESTAMP,
      endTime=_START_OF_EPOCH_TIMESTAMP)),
 (report_request.Info(response_code=404,
                      operation_id='an_op_id',
                      operation_name='an_op_name',
                      method='GET',
                      referer='a_referer',
                      backend_time=_TEST_LATENCY,
                      overhead_time=_TEST_LATENCY,
Пример #3
0
                           messages.LogEntry(textPayload='agg2')
                       ])
}, {
    'description':
    'combines the metric value using the default kind',
    'kinds':
    None,
    'initial':
    messages.Operation(
        startTime=_EARLY,
        endTime=_LATER,
        metricValueSets=[
            messages.MetricValueSet(metricName='some_floats',
                                    metricValues=[
                                        metric_value.create(
                                            labels=_TEST_LABELS,
                                            doubleValue=_A_FLOAT_VALUE,
                                            endTime=_EARLY),
                                    ]),
            messages.MetricValueSet(metricName='other_floats',
                                    metricValues=[
                                        metric_value.create(
                                            labels=_TEST_LABELS,
                                            doubleValue=_A_FLOAT_VALUE,
                                            endTime=_EARLY),
                                    ])
        ]),
    'ops': [
        messages.Operation(startTime=_EARLY,
                           endTime=_LATER,
                           metricValueSets=[