Skip to content

fix(analysis): Graphite metric provider - index out of range [0] with length 0 - #2751

Merged
zachaller merged 2 commits into
argoproj:masterfrom
mdsjip:graphite-npe
May 5, 2023
Merged

fix(analysis): Graphite metric provider - index out of range [0] with length 0#2751
zachaller merged 2 commits into
argoproj:masterfrom
mdsjip:graphite-npe

Conversation

@mdsjip

@mdsjip mdsjip commented Apr 30, 2023

Copy link
Copy Markdown
Contributor

Rare case, but seen in the wild: Graphite APIs returning response body with just an empty array: []
This PR allows to handle this case by checking it and returning an empty dataPoint array.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional with a list of types and scopes found here, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.
  • My organization is added to USERS.md.

… length 0

Signed-off-by: mdsjip <2284562+mdsjip@users.noreply.github.com>
@mdsjip mdsjip changed the title fix(analysis): graphite metric provider - nil pointer dereference fix(analysis): graphite metric provider - index out of range [0] with length 0 Apr 30, 2023
@codecov

codecov Bot commented Apr 30, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (04b1e30) 81.62% compared to head (8ebd8b4) 81.63%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2751   +/-   ##
=======================================
  Coverage   81.62%   81.63%           
=======================================
  Files         133      133           
  Lines       20157    20160    +3     
=======================================
+ Hits        16454    16457    +3     
  Misses       2849     2849           
  Partials      854      854           
Impacted Files Coverage Δ
metricproviders/graphite/api.go 78.82% <100.00%> (+0.77%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions

github-actions Bot commented Apr 30, 2023

Copy link
Copy Markdown
Contributor

Go Published Test Results

1 950 tests   1 950 ✔️  2m 36s ⏱️
   118 suites         0 💤
       1 files           0

Results for commit 8ebd8b4.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Apr 30, 2023

Copy link
Copy Markdown
Contributor

E2E Tests Published Test Results

    4 files      4 suites   3h 29m 45s ⏱️
  96 tests   82 ✔️   5 💤   9
402 runs  364 ✔️ 20 💤 18

For more details on these failures, see this check.

Results for commit 8ebd8b4.

♻️ This comment has been updated with latest results.

@mdsjip mdsjip changed the title fix(analysis): graphite metric provider - index out of range [0] with length 0 fix(analysis): Graphite metric provider - index out of range [0] with length 0 Apr 30, 2023
@sonarqubecloud

sonarqubecloud Bot commented May 1, 2023

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@zachaller
zachaller merged commit 1f89c16 into argoproj:master May 5, 2023
@mdsjip
mdsjip deleted the graphite-npe branch May 6, 2023 12:32
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.

2 participants