elastic / elastic/apm-agent-python

Flaky kafka-newest test on 3.14

Open
#2,630 6 comments 0 reactions 0 assignees View on GitHub
agent-python
Dominant language
Python
Stars
431
Forks
239
Avg merge
5d 10h
Merged PRs (30d)
7

Description

```
____________________ test_kafka_consume_ongoing_transaction ____________________

instrument = None
elasticapm_client =
producer =
consumer =
topics = ['test', 'foo', 'bar']

def test_kafka_consume_ongoing_transaction(instrument, elasticapm_client, producer, consumer, topics):
def delayed_send():
time.sleep(0.2)
elasticapm_client.begin_transaction("foo")
producer.send("test", key=b"foo", value=b"bar")
producer.send("test", key=b"baz", value=b"bazzinga")
producer.flush()
elasticapm_client.end_transaction("foo")

thread = threading.Thread(target=delayed_send)
thread.start()
transaction = elasticapm_client.begin_transaction("foo")
for item in consumer:
pass
thread.join()
elasticapm_client.end_transaction("foo")
transactions = elasticapm_client.events[TRANSACTION]
assert len(transactions) == 2
external_spans = elasticapm_client.spans_for_transaction(transactions[0])
spans = elasticapm_client.spans_for_transaction(transactions[1])
assert len(external_spans) == 2
> assert len(spans) == 2
E assert 0 == 2
E + where 0 = len([])

consumer =
delayed_send = .delayed_send at 0x7f408c16c1a0>
elasticapm_client =
external_spans = [{'action': 'send', 'context': {'destination': {'address': 'kafka', 'port': 9092, 'service': {'name': 'kafka', 'resour...vice': {'target': {'name': 'test', 'type': 'kafka'}}}, 'duration': 0.48899999999999993, 'id': 'f964a73fb9260ef4', ...}]
instrument = None
producer =
spans = []
thread =
topics = ['test', 'foo', 'bar']
transaction =
transactions = [{'context': {'tags': {}}, 'duration': 12.602, 'id': '0a2d2ff318df135c', 'name': 'foo', ...}, {'context': {'tags': {}}, 'duration': 502.87899999999996, 'id': '60f261ba230a8914', 'name': 'foo', ...}]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.