Skip to content
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

refactor(exporter-metrics-otlp-http): fix eslint warning #5396

Conversation

chancancode
Copy link
Contributor

Which problem is this PR solving?

Fixes the following eslint warning in exporter-metrics-otlp-http:

/home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts
  120:30  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

Ref #5365

Short description of the changes

The unused parameter can be explicitly typed as InstrumentType, but since this default selector doesn't actually care about it, it can also just be elided.

By adding an explicit return type, if someone in the future added the wrong parameter to the default selector function, TypeScript would reject it.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • eslint

Checklist:

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

Fixes the following eslint warning in exporter-metrics-otlp-http:

```
/home/runner/work/opentelemetry-js/opentelemetry-js/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts
  120:30  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
```

The unused parameter can be explicitly typed as `InstrumentType`,
but since this default selector doesn't actually care about it, it
can also just be elided.

By adding an explicit return type, if someone in the future added
the wrong parameter to the default selector function, TypeScript
would reject it.

Ref open-telemetry#5365
@chancancode chancancode requested a review from a team as a code owner January 29, 2025 23:38
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.63%. Comparing base (3c040c4) to head (e9346ec).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5396      +/-   ##
==========================================
- Coverage   94.63%   94.63%   -0.01%     
==========================================
  Files         318      318              
  Lines        8032     8029       -3     
  Branches     1685     1684       -1     
==========================================
- Hits         7601     7598       -3     
  Misses        431      431              
Files with missing lines Coverage Δ
...er-metrics-otlp-http/src/OTLPMetricExporterBase.ts 88.88% <100.00%> (-0.51%) ⬇️

@chancancode chancancode mentioned this pull request Jan 29, 2025
25 tasks
@pichlermarc pichlermarc added this pull request to the merge queue Jan 30, 2025
Merged via the queue into open-telemetry:main with commit bb21233 Jan 30, 2025
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants