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

add values to spannerDefaults #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

add values to spannerDefaults #2

wants to merge 2 commits into from

Conversation

j143
Copy link
Owner

@j143 j143 commented May 14, 2021

const spannerDefaults = {
  minNodes: 1,
  maxNodes: 3,
  stepSize: 2,
  overloadStepSize: 5,
  scaleOutCoolingMinutes: 5,
  scaleInCoolingMinutes: 30,
  scalingMethod: 'STEPWISE',
  regional_margin: 5,
  multi_regional_margin: 5
};
const metricDefaults = {
  period: 60,
  aligner: 'ALIGN_MAX',
  reducer: 'REDUCE_SUM'
}
const DEFAULT_THRESHOLD_MARGIN = 5;
    // merge in the defaults
    spanners[sIdx] = {...spannerDefaults, ...spanners[sIdx]};

    spanners[sIdx].metrics =
      buildMetrics(spanners[sIdx].projectId, spanners[sIdx].instanceId);
    // merge in the current Spanner state
    spanners[sIdx] = {
      ...spanners[sIdx],
      ...await getSpannerMetadata(spanners[sIdx].projectId, spanners[sIdx].instanceId)
    };
    if (spanner.regional) {
      threshold = metric.regional_threshold;
      if (!metric.hasOwnProperty('regional_margin')) 
        metric.regional_margin = DEFAULT_THRESHOLD_MARGIN;
      margin = metric.regional_margin;
    }
    const metricsObject = {
      name: metric.name,
      threshold: threshold,
      margin: margin,
      value: maxMetricValue
    };

@j143
Copy link
Owner Author

j143 commented May 14, 2021

cloudspannerecosystem#28

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.

1 participant