Skip to content

feat(logs): Forward extra from logger as attributes #4374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 9, 2025

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad self-assigned this May 8, 2025
Copy link

codecov bot commented May 8, 2025

❌ 6 Tests Failed:

Tests completed Failed Passed Skipped
1979 6 1973 15
View the top 3 failed test(s) by shortest run time
tests.integrations.redis.cluster.test_redis_cluster::test_rediscluster_pipeline[False-expected_first_ten0]
Stack Traces | 0.087s run time
.../redis/cluster/test_redis_cluster.py:121: in test_rediscluster_pipeline
    pipeline = rc.pipeline()
.../redis/cluster/test_redis_cluster.py:16: in <lambda>
    redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(None, None)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/utils.py:188: in wrapper
    return func(*args, **kwargs)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/cluster.py:2125: in __init__
    retries=self.cluster_error_retry_attempts,
E   AttributeError: 'ClusterPipeline' object has no attribute 'cluster_error_retry_attempts'
tests.integrations.redis.cluster.test_redis_cluster::test_rediscluster_pipeline[True-expected_first_ten1]
Stack Traces | 0.088s run time
.../redis/cluster/test_redis_cluster.py:121: in test_rediscluster_pipeline
    pipeline = rc.pipeline()
.../redis/cluster/test_redis_cluster.py:16: in <lambda>
    redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(None, None)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/utils.py:188: in wrapper
    return func(*args, **kwargs)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/cluster.py:2125: in __init__
    retries=self.cluster_error_retry_attempts,
E   AttributeError: 'ClusterPipeline' object has no attribute 'cluster_error_retry_attempts'
tests.integrations.redis.cluster.test_redis_cluster::test_rediscluster_span_origin
Stack Traces | 0.09s run time
.../redis/cluster/test_redis_cluster.py:162: in test_rediscluster_span_origin
    pipeline = rc.pipeline(transaction=False)
.../redis/cluster/test_redis_cluster.py:16: in <lambda>
    redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(None, None)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/utils.py:188: in wrapper
    return func(*args, **kwargs)
.tox/py3.12-redis-latest/lib/python3.12.../site-packages/redis/cluster.py:2125: in __init__
    retries=self.cluster_error_retry_attempts,
E   AttributeError: 'ClusterPipeline' object has no attribute 'cluster_error_retry_attempts'

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@AbhiPrasad AbhiPrasad force-pushed the abhi-python-logger-extra branch from 6cf2671 to 4cee7d1 Compare May 8, 2025 18:26
@AbhiPrasad AbhiPrasad marked this pull request as ready for review May 8, 2025 18:26
@AbhiPrasad AbhiPrasad requested a review from a team as a code owner May 8, 2025 18:26
@AbhiPrasad AbhiPrasad requested a review from colin-sentry May 8, 2025 18:26
logs = envelopes_to_logs(envelopes)
assert logs[0]["attributes"]["foo"] == "bar"
assert logs[0]["attributes"]["numeric"] == 42
assert logs[0]["attributes"]["more_complex"] == '{"nested": "data"}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you assert the attributes is equal to something, to make sure we aren't adding garbage default attributes from the record?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with 1b73d4c

Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok

@antonpirker antonpirker merged commit de6856f into master May 9, 2025
145 of 150 checks passed
@antonpirker antonpirker deleted the abhi-python-logger-extra branch May 9, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants