Skip to content

Fix missing metrics attributes in console exporter #1558

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

Conversation

GrzegorzDrozd
Copy link
Contributor

This PR fixes a case that when using console exporter for metrics, attributes are not included in the export

Without fix:

{
                "name": "http.client.request.body.size",
                "description": null,
                "unit": "By",
                "data": {
                    "dataPoints": [
                        {
                            "count": 1,
                            "sum": 14,
                            "min": 14,
                            "max": 14,
                            "bucketCounts": [
                                0,
                                0,
                                0,
                                1,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ],
                            "explicitBounds": [
                                0,
                                5,
                                10,
                                25,
                                50,
                                75,
                                100,
                                250,
                                500,
                                1000
                            ],
                            "attributes": {},
                            "startTimestamp": 1744027586704128264,
                            "timestamp": 1744027586707302423,
                            "exemplars": [
                                {
                                    "value": 14,
                                    "timestamp": 1744027586707167890,
                                    "attributes": {},
                                    "traceId": "036ad4d4fb29b907001b2927da026772",
                                    "spanId": "bfb17e41639c4a12"
                                }
                            ]
                        }
                    ],
                    "temporality": "Delta"
                }
            }

with fix:

{
                "name": "http.client.request.body.size",
                "description": null,
                "unit": "By",
                "data": {
                    "dataPoints": [
                        {
                            "count": 1,
                            "sum": 14,
                            "min": 14,
                            "max": 14,
                            "bucketCounts": [
                                0,
                                0,
                                0,
                                1,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ],
                            "explicitBounds": [
                                0,
                                5,
                                10,
                                25,
                                50,
                                75,
                                100,
                                250,
                                500,
                                1000
                            ],
                            "attributes": {
                                "http.request.method": "POST",
                                "server.address": "localhost",
                                "server.port": 8080,
                                "url.scheme": "http",
                                "url.path": "\/test",
                                "url.query": "",
                                "url.full": "http:\/\/localhost:8080\/test",
                                "http.response.status_code": 200
                            },
                            "startTimestamp": 1744027551835022869,
                            "timestamp": 1744027551837611698,
                            "exemplars": [
                                {
                                    "value": 14,
                                    "timestamp": 1744027551837484198,
                                    "attributes": [],
                                    "traceId": "241dbf53bd65ab601f93378768683444",
                                    "spanId": "b282920d21f7859e"
                                }
                            ]
                        }
                    ],
                    "temporality": "Delta"
                }
            }

This PR fixes a case that when using console exporter for metrics, attributes are not included in the export.
@GrzegorzDrozd GrzegorzDrozd requested a review from a team as a code owner April 7, 2025 12:21
@brettmc
Copy link
Collaborator

brettmc commented Apr 7, 2025

linting issue to be fixed, otherwise LGTM

@GrzegorzDrozd
Copy link
Contributor Author

linting issue to be fixed, otherwise LGTM

Style issue fixed. Please check again.

Copy link

codecov bot commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 70.82%. Comparing base (1413c34) to head (2a60bbe).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/SDK/Common/Attribute/Attributes.php 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1558      +/-   ##
============================================
- Coverage     70.90%   70.82%   -0.08%     
- Complexity     2765     2766       +1     
============================================
  Files           408      408              
  Lines          8354     8356       +2     
============================================
- Hits           5923     5918       -5     
- Misses         2431     2438       +7     
Flag Coverage Δ
8.1 70.49% <0.00%> (-0.06%) ⬇️
8.2 70.73% <0.00%> (-0.03%) ⬇️
8.3 70.73% <0.00%> (-0.02%) ⬇️
8.4 70.70% <0.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/SDK/Common/Attribute/Attributes.php 90.47% <0.00%> (-9.53%) ⬇️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1413c34...2a60bbe. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@brettmc brettmc merged commit fadec4c into open-telemetry:main Apr 8, 2025
10 of 11 checks passed
@GrzegorzDrozd GrzegorzDrozd deleted the fix-missing-metric-attributes-in-console-exporter branch April 15, 2025 07:22
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