Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Changing metricsDB provider while executing an integTest #523

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Conversation

yojs
Copy link
Contributor

@yojs yojs commented Dec 1, 2020

Fixes #: #524

Description of changes:

Today the gauntlet only let's you provide the metricsDB table at the top of a test class
or at the top of a test method. But sometimes during the test test execution, one might want
to change the instance of metricsDB. This is made possible by this patch. In order to do that,

You create a new inner class (doesn't have to be inner) with an appropriate name. Add, the metrics
details as you would if you were to do it as part of the main test class itself.

  @AMetric(name = CPU_Utilization.class,
      dimensionNames = {SHARDID_VALUE, INDEX_NAME_VALUE, OPERATION_VALUE, SHARD_ROLE_VALUE},
      tables = {
          @ATable(hostTag = HostTag.DATA_0,
              tuple = {
                  @ATuple(dimensionValues = {"0", "logs", "bulk", "p"},
                      sum = 0.0, avg = 0.0, min = 0.0, max = 111.0),
                  @ATuple(dimensionValues = {"1", "logs", "bulk", "r"},
                      sum = 0.0, avg = 0.0, min = 0.0, max = 88.0),
                  @ATuple(dimensionValues = {"2", "logs", "bulk", "p"},
                      sum = 0.0, avg = 0.0, min = 0.0, max = 11.0)
              }
          ),
      }
  )
  public static class MetricsAfterEventX {

  }

then from your test method, you can do something like this:

  @Test
  @AExpect(
      what = AExpect.Type.REST_API,
      on = HostTag.DATA_0,
      validator = UpdatedMetricsPocValidator.class,
      forRca = RcaItPocDedicated.SimpleAnalysisGraphForDedicated.ClusterRca.class)
  public void testMetricsUpdated() throws Exception {
    // Initial logic, uses the Class default metricsDB choice.
    // ...

    api.updateMetrics(MetricsAfterEventX.class);

   // Other test logic follows.
  }

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Today the gauntlet only let's you provide the metricsDB table at the top of a test class
or at the top of a test method. But sometimes during the test test execution, one might want
to change the instance of metricsDB. This is made possible by this patch. In order to do that,

You create a new inner class (doesn't have to be inner) with an appropriate name. Add, the metrics
details as you would if you were to do it as part of the main test class itself.

  @aMetric(name = CPU_Utilization.class,
      dimensionNames = {SHARDID_VALUE, INDEX_NAME_VALUE, OPERATION_VALUE, SHARD_ROLE_VALUE},
      tables = {
          @aTable(hostTag = HostTag.DATA_0,
              tuple = {
                  @atuple(dimensionValues = {"0", "logs", "bulk", "p"},
                      sum = 0.0, avg = 0.0, min = 0.0, max = 111.0),
                  @atuple(dimensionValues = {"1", "logs", "bulk", "r"},
                      sum = 0.0, avg = 0.0, min = 0.0, max = 88.0),
                  @atuple(dimensionValues = {"2", "logs", "bulk", "p"},
                      sum = 0.0, avg = 0.0, min = 0.0, max = 11.0)
              }
          ),
      }
  )
  public static class MetricsAfterEventX {

  }

then from your test method, you can do something like this:

  @test
  @AExpect(
      what = AExpect.Type.REST_API,
      on = HostTag.DATA_0,
      validator = UpdatedMetricsPocValidator.class,
      forRca = RcaItPocDedicated.SimpleAnalysisGraphForDedicated.ClusterRca.class)
  public void testMetricsUpdated() throws Exception {
    // Initial logic, uses the Class default metricsDB choice.
    // ...

    api.updateMetrics(MetricsAfterEventX.class);

   // Other test logic follows.
  }
@yojs yojs requested review from rguo-aws and ktkrg December 1, 2020 22:54
@codecov
Copy link

codecov bot commented Dec 2, 2020

Codecov Report

Merging #523 (535ca21) into master (a8aa2e0) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #523      +/-   ##
============================================
- Coverage     73.72%   73.70%   -0.02%     
+ Complexity     2983     2980       -3     
============================================
  Files           362      362              
  Lines         16895    16896       +1     
  Branches       1372     1372              
============================================
- Hits          12455    12453       -2     
+ Misses         3997     3995       -2     
- Partials        443      448       +5     
Impacted Files Coverage Δ Complexity Δ
...eanalyzer/rca/framework/metrics/WriterMetrics.java 70.58% <100.00%> (+1.83%) 3.00 <0.00> (ø)
...nalyzer/rca/net/handler/PublishRequestHandler.java 80.00% <0.00%> (-10.00%) 5.00% <0.00%> (ø%)
...ormanceanalyzer/rca/store/rca/cache/CacheUtil.java 58.62% <0.00%> (-6.90%) 9.00% <0.00%> (-2.00%)
...zer/decisionmaker/deciders/CacheHealthDecider.java 85.00% <0.00%> (-5.00%) 15.00% <0.00%> (-2.00%)
...csearch/performanceanalyzer/rca/RcaController.java 84.03% <0.00%> (-1.88%) 47.00% <0.00%> (ø%)
...ceanalyzer/rca/framework/util/InstanceDetails.java 80.64% <0.00%> (-1.62%) 15.00% <0.00%> (-1.00%)
...erformanceanalyzer/rca/framework/core/RcaConf.java 64.28% <0.00%> (-1.43%) 48.00% <0.00%> (ø%)
...formanceanalyzer/rca/net/tasks/FlowUnitTxTask.java 100.00% <0.00%> (+2.63%) 6.00% <0.00%> (ø%)
...asticsearch/performanceanalyzer/net/NetServer.java 87.34% <0.00%> (+5.06%) 23.00% <0.00%> (+1.00%)
...ch/performanceanalyzer/threads/ThreadProvider.java 86.95% <0.00%> (+17.39%) 6.00% <0.00%> (ø%)
... and 1 more

Continue to review full report at Codecov.

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

@yojs yojs merged commit 8e75266 into master Dec 2, 2020
@yojs yojs deleted the more-metrics branch December 2, 2020 23:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants