Skip to content

Commit

Permalink
data point seen not logical
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvin Lasogga committed Aug 14, 2022
1 parent 6ba2462 commit bcb4e6c
Showing 1 changed file with 6 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
# pylint:disable=unused-argument
# pylint:disable=no-self-use

from ftplib import error_perm
import logging
import threading
from concurrent import futures

import grpc

from opentelemetry import trace, metrics
from opentelemetry import trace
import opentelemetry.instrumentation.grpc
from opentelemetry.instrumentation.grpc import GrpcInstrumentorServer, server_interceptor
from opentelemetry.sdk.metrics.export import Histogram, HistogramDataPoint
Expand Down Expand Up @@ -370,9 +368,6 @@ def SimpleMethod(self, request, context):
{}
)

logging.error("%r", self.memory_metrics_reader)
logging.error("%r", self.memory_metrics_reader.get_metrics_data())

def test_create_span_streaming(self):
"""Check that the interceptor wraps calls with spans server-side, on a
streaming call."""
Expand Down Expand Up @@ -1514,7 +1509,6 @@ def test_metrics(self):
server.stop(None)

metrics_list = self.memory_metrics_reader.get_metrics_data()
data_point_seen = True

self.assertNotEqual(len(metrics_list.resource_metrics), 0)
for resource_metric in metrics_list.resource_metrics:
Expand Down Expand Up @@ -1581,10 +1575,6 @@ def test_metrics(self):
},
)

data_point_seen &= True

self.assertTrue(data_point_seen)

def test_metrics_error(self):

error_message = "error"
Expand Down Expand Up @@ -1614,7 +1604,6 @@ def test_metrics_error(self):
server.stop(None)

metrics_list = self.memory_metrics_reader.get_metrics_data()
data_point_seen = True

self.assertNotEqual(len(metrics_list.resource_metrics), 0)
for resource_metric in metrics_list.resource_metrics:
Expand Down Expand Up @@ -1682,9 +1671,6 @@ def test_metrics_error(self):
]
},
)
data_point_seen &= True

self.assertTrue(data_point_seen)

def test_metrics_three_calls(self):
no_calls = 3
Expand Down Expand Up @@ -1714,7 +1700,6 @@ def test_metrics_three_calls(self):
server.stop(None)

metrics_list = self.memory_metrics_reader.get_metrics_data()
data_point_seen = True

self.assertNotEqual(len(metrics_list.resource_metrics), 0)
for resource_metric in metrics_list.resource_metrics:
Expand Down Expand Up @@ -1784,9 +1769,6 @@ def test_metrics_three_calls(self):
grpc.StatusCode.OK.value[0]
},
)
data_point_seen &= True

self.assertTrue(data_point_seen)

def test_metrics_client_streaming(self):

Expand Down Expand Up @@ -1815,7 +1797,6 @@ def test_metrics_client_streaming(self):
server.stop(None)

metrics_list = self.memory_metrics_reader.get_metrics_data()
data_point_seen = True

self.assertNotEqual(len(metrics_list.resource_metrics), 0)
for resource_metric in metrics_list.resource_metrics:
Expand Down Expand Up @@ -1888,9 +1869,6 @@ def test_metrics_client_streaming(self):
grpc.StatusCode.OK.value[0]
},
)
data_point_seen &= True

self.assertTrue(data_point_seen)

def test_metrics_client_streaming_abort(self):

Expand Down Expand Up @@ -1922,7 +1900,6 @@ def test_metrics_client_streaming_abort(self):
server.stop(None)

metrics_list = self.memory_metrics_reader.get_metrics_data()
data_point_seen = True

self.assertNotEqual(len(metrics_list.resource_metrics), 0)
for resource_metric in metrics_list.resource_metrics:
Expand Down Expand Up @@ -1961,19 +1938,17 @@ def test_metrics_client_streaming_abort(self):
self.assertEqual(point.count, 1)
self.assertGreaterEqual(point.sum, 0)
elif metric.name == "rpc.server.request.size":
self.assertEqual(point.count, len(requests))
self.assertEqual(
point.sum, sum(map(len, requests))
)
self.assertEqual(point.count, 1)
self.assertEqual(point.sum, len(requests[0]))
elif metric.name == "rpc.server.response.size":
self.assertEqual(point.count, 0)
# self.assertEqual(point.sum, 0)
self.assertEqual(point.sum, 0)
elif metric.name == "rpc.server.requests_per_rpc":
self.assertEqual(point.count, 1)
self.assertEqual(point.sum, len(requests))
self.assertEqual(point.sum, 1)
elif metric.name == "rpc.server.responses_per_rpc":
self.assertEqual(point.count, 0)
# self.assertEqual(point.sum, 1)
self.assertEqual(point.sum, 0)

self.assertMetricDataPointHasAttributes(
point,
Expand All @@ -1997,9 +1972,6 @@ def test_metrics_client_streaming_abort(self):
]
},
)
data_point_seen &= True

self.assertTrue(data_point_seen)

def test_metrics_server_streaming(self):

Expand Down Expand Up @@ -2028,7 +2000,6 @@ def test_metrics_server_streaming(self):
server.stop(None)

metrics_list = self.memory_metrics_reader.get_metrics_data()
data_point_seen = True

self.assertNotEqual(len(metrics_list.resource_metrics), 0)
for resource_metric in metrics_list.resource_metrics:
Expand Down Expand Up @@ -2101,9 +2072,6 @@ def test_metrics_server_streaming(self):
grpc.StatusCode.OK.value[0]
},
)
data_point_seen &= True

self.assertTrue(data_point_seen)

def test_metrics_bidirectional_streaming(self):

Expand Down Expand Up @@ -2134,7 +2102,6 @@ def test_metrics_bidirectional_streaming(self):
server.stop(None)

metrics_list = self.memory_metrics_reader.get_metrics_data()
data_point_seen = True

self.assertNotEqual(len(metrics_list.resource_metrics), 0)
for resource_metric in metrics_list.resource_metrics:
Expand Down Expand Up @@ -2209,9 +2176,6 @@ def test_metrics_bidirectional_streaming(self):
grpc.StatusCode.OK.value[0]
},
)
data_point_seen &= True

self.assertTrue(data_point_seen)


def get_latch(num):
Expand Down

0 comments on commit bcb4e6c

Please sign in to comment.