Skip to content

fix(instrumentation-http): report error.type metrics attribute#5647

Merged
pichlermarc merged 3 commits intoopen-telemetry:mainfrom
raphael-theriault-swi:http-metrics-error-type
Aug 6, 2025
Merged

fix(instrumentation-http): report error.type metrics attribute#5647
pichlermarc merged 3 commits intoopen-telemetry:mainfrom
raphael-theriault-swi:http-metrics-error-type

Conversation

@raphael-theriault-swi
Copy link
Copy Markdown
Member

@raphael-theriault-swi raphael-theriault-swi commented May 5, 2025

Which problem is this PR solving?

This reports the error.type attribute on HTTP metrics wherever it is already reported on HTTP spans as required by the spec.

Fixes #5627

Short description of the changes

Updates the metrics attributes from the _on***Error helpers and uses those wherever appropriate.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I added a test for client metrics but couldn't figure out a way to test server metrics since it involves throwing within the server request handler which is an uncaught exception.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added

@raphael-theriault-swi raphael-theriault-swi requested a review from a team as a code owner May 5, 2025 20:17
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.01%. Comparing base (cb42f7d) to head (279727e).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5647   +/-   ##
=======================================
  Coverage   95.01%   95.01%           
=======================================
  Files         303      303           
  Lines        7946     7946           
  Branches     1607     1607           
=======================================
  Hits         7550     7550           
  Misses        396      396           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread experimental/packages/opentelemetry-instrumentation-http/src/http.ts Outdated
Copy link
Copy Markdown
Member

@hectorhdzg hectorhdzg left a comment

Choose a reason for hiding this comment

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

LGTM, just nit comment about method name

@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions Bot added the stale label Jul 14, 2025
@raphael-theriault-swi
Copy link
Copy Markdown
Member Author

Bad bot

@dyladan dyladan removed the stale label Jul 16, 2025
@dyladan
Copy link
Copy Markdown
Member

dyladan commented Jul 16, 2025

Bad me for letting this get stale :/

@raphael-theriault-swi
Copy link
Copy Markdown
Member Author

@dyladan rebased on main

@pichlermarc pichlermarc added this pull request to the merge queue Aug 6, 2025
Merged via the queue into open-telemetry:main with commit bbf9dac Aug 6, 2025
25 checks passed
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.

error.type attribute is not set on http.server.request.duration metric

4 participants