@grnsft/if 0.5.0-beta.0 → 0.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -17
- package/Refactor-migration-guide.md +110 -164
- package/build/common/config/index.d.ts +1 -0
- package/build/common/config/index.js +6 -0
- package/build/common/config/strings.d.ts +8 -0
- package/build/common/config/strings.js +16 -0
- package/build/common/lib/load.d.ts +6 -0
- package/build/common/lib/load.js +18 -0
- package/build/{types → common/types}/manifest.d.ts +4 -1
- package/build/common/types/manifest.js +3 -0
- package/build/common/util/debug-logger.js +115 -0
- package/build/common/util/fs.js +94 -0
- package/build/common/util/helpers.d.ts +15 -0
- package/build/common/util/helpers.js +80 -0
- package/build/{util → common/util}/logger.js +1 -1
- package/build/{util → common/util}/validations.d.ts +149 -47
- package/build/common/util/validations.js +141 -0
- package/build/common/util/yaml.js +59 -0
- package/build/if-check/config/config.d.ts +6 -0
- package/build/if-check/config/config.js +31 -0
- package/build/{config → if-check/config}/index.d.ts +0 -1
- package/build/if-check/config/index.js +8 -0
- package/build/if-check/config/strings.d.ts +12 -0
- package/build/if-check/config/strings.js +16 -0
- package/build/if-check/index.js +98 -0
- package/build/if-check/types/process-args.d.ts +4 -0
- package/build/if-check/types/process-args.js +3 -0
- package/build/if-check/util/args.d.ts +10 -0
- package/build/if-check/util/args.js +56 -0
- package/build/if-check/util/helpers.d.ts +4 -0
- package/build/if-check/util/helpers.js +18 -0
- package/build/if-check/util/npm.d.ts +4 -0
- package/build/if-check/util/npm.js +59 -0
- package/build/if-csv/config/config.d.ts +6 -0
- package/build/if-csv/config/config.js +37 -0
- package/build/if-csv/config/index.d.ts +2 -0
- package/build/if-csv/config/index.js +8 -0
- package/build/if-csv/config/strings.d.ts +4 -0
- package/build/if-csv/config/strings.js +8 -0
- package/build/if-csv/index.js +63 -0
- package/build/if-csv/types/csv.d.ts +7 -0
- package/build/if-csv/types/csv.js +3 -0
- package/build/if-csv/types/process-args.d.ts +5 -0
- package/build/if-csv/types/process-args.js +3 -0
- package/build/if-csv/util/args.d.ts +12 -0
- package/build/if-csv/util/args.js +51 -0
- package/build/if-csv/util/helpers.d.ts +9 -0
- package/build/if-csv/util/helpers.js +95 -0
- package/build/if-diff/config/config.d.ts +6 -0
- package/build/if-diff/config/config.js +31 -0
- package/build/if-diff/config/index.d.ts +2 -0
- package/build/if-diff/config/index.js +8 -0
- package/build/if-diff/config/strings.d.ts +6 -0
- package/build/if-diff/config/strings.js +10 -0
- package/build/if-diff/index.js +46 -0
- package/build/{lib → if-diff/lib}/compare.d.ts +1 -1
- package/build/if-diff/lib/compare.js +56 -0
- package/build/{lib → if-diff/lib}/load.d.ts +16 -18
- package/build/if-diff/lib/load.js +51 -0
- package/build/if-diff/types/args.js +3 -0
- package/build/if-diff/types/compare.js +3 -0
- package/build/if-diff/types/process-args.d.ts +4 -0
- package/build/if-diff/types/process-args.js +3 -0
- package/build/if-diff/util/args.d.ts +5 -0
- package/build/if-diff/util/args.js +51 -0
- package/build/if-diff/util/helpers.d.ts +13 -0
- package/build/if-diff/util/helpers.js +75 -0
- package/build/if-env/config/config.d.ts +6 -0
- package/build/if-env/config/config.js +37 -0
- package/build/if-env/config/index.d.ts +2 -0
- package/build/if-env/config/index.js +8 -0
- package/build/if-env/config/strings.d.ts +7 -0
- package/build/if-env/config/strings.js +11 -0
- package/build/if-env/index.js +40 -0
- package/build/if-env/types/if-env.js +3 -0
- package/build/if-env/types/npm.js +3 -0
- package/build/if-env/types/process-args.d.ts +5 -0
- package/build/if-env/types/process-args.js +3 -0
- package/build/if-env/util/args.d.ts +12 -0
- package/build/if-env/util/args.js +47 -0
- package/build/if-env/util/helpers.d.ts +20 -0
- package/build/if-env/util/helpers.js +94 -0
- package/build/{util → if-env/util}/npm.d.ts +0 -4
- package/build/if-env/util/npm.js +126 -0
- package/build/if-run/builtins/coefficient/index.d.ts +2 -0
- package/build/if-run/builtins/coefficient/index.js +67 -0
- package/build/if-run/builtins/copy-param/index.d.ts +2 -0
- package/build/if-run/builtins/copy-param/index.js +70 -0
- package/build/if-run/builtins/csv-lookup/index.d.ts +2 -0
- package/build/if-run/builtins/csv-lookup/index.js +190 -0
- package/build/if-run/builtins/divide/index.d.ts +2 -0
- package/build/if-run/builtins/divide/index.js +80 -0
- package/build/if-run/builtins/exponent/index.d.ts +2 -0
- package/build/if-run/builtins/exponent/index.js +60 -0
- package/build/{builtins → if-run/builtins}/export-log.d.ts +1 -1
- package/build/{builtins → if-run/builtins}/export-log.js +1 -1
- package/build/{builtins → if-run/builtins}/export-yaml.d.ts +1 -1
- package/build/if-run/builtins/export-yaml.js +30 -0
- package/build/{builtins → if-run/builtins}/index.d.ts +1 -2
- package/build/{builtins → if-run/builtins}/index.js +4 -6
- package/build/if-run/builtins/interpolation/index.d.ts +2 -0
- package/build/if-run/builtins/interpolation/index.js +151 -0
- package/build/if-run/builtins/mock-observations/helpers/common-generator.js +29 -0
- package/build/if-run/builtins/mock-observations/helpers/rand-int-generator.js +48 -0
- package/build/if-run/builtins/mock-observations/index.d.ts +2 -0
- package/build/if-run/builtins/mock-observations/index.js +116 -0
- package/build/if-run/builtins/mock-observations/interfaces/index.js +3 -0
- package/build/if-run/builtins/multiply/index.d.ts +2 -0
- package/build/if-run/builtins/multiply/index.js +59 -0
- package/build/if-run/builtins/regex/index.d.ts +2 -0
- package/build/if-run/builtins/regex/index.js +76 -0
- package/build/if-run/builtins/sci/config.js +44 -0
- package/build/if-run/builtins/sci/index.d.ts +2 -0
- package/build/if-run/builtins/sci/index.js +92 -0
- package/build/if-run/builtins/sci-embodied/index.d.ts +2 -0
- package/build/if-run/builtins/sci-embodied/index.js +156 -0
- package/build/if-run/builtins/shell/index.d.ts +2 -0
- package/build/if-run/builtins/shell/index.js +60 -0
- package/build/if-run/builtins/subtract/index.d.ts +2 -0
- package/build/if-run/builtins/subtract/index.js +61 -0
- package/build/if-run/builtins/sum/index.d.ts +2 -0
- package/build/if-run/builtins/sum/index.js +66 -0
- package/build/if-run/builtins/time-sync/index.d.ts +17 -0
- package/build/if-run/builtins/time-sync/index.js +339 -0
- package/build/if-run/config/config.d.ts +9 -0
- package/build/if-run/config/config.js +73 -0
- package/build/if-run/config/index.d.ts +2 -0
- package/build/if-run/config/index.js +8 -0
- package/build/{config → if-run/config}/strings.d.ts +28 -50
- package/build/if-run/config/strings.js +76 -0
- package/build/if-run/index.d.ts +2 -0
- package/build/if-run/index.js +63 -0
- package/build/if-run/lib/aggregate.d.ts +15 -0
- package/build/if-run/lib/aggregate.js +123 -0
- package/build/if-run/lib/compute.js +136 -0
- package/build/{lib → if-run/lib}/environment.d.ts +1 -1
- package/build/if-run/lib/environment.js +75 -0
- package/build/{lib → if-run/lib}/exhaust.d.ts +1 -1
- package/build/if-run/lib/exhaust.js +27 -0
- package/build/if-run/lib/explain.d.ts +9 -0
- package/build/if-run/lib/explain.js +43 -0
- package/build/if-run/lib/initialize.d.ts +6 -0
- package/build/if-run/lib/initialize.js +109 -0
- package/build/if-run/lib/regroup.d.ts +5 -0
- package/build/if-run/lib/regroup.js +64 -0
- package/build/if-run/types/aggregation.d.ts +5 -0
- package/build/if-run/types/aggregation.js +6 -0
- package/build/{types → if-run/types}/compute.d.ts +12 -8
- package/build/if-run/types/compute.js +3 -0
- package/build/if-run/types/environment.js +3 -0
- package/build/{types → if-run/types}/exhaust-plugin-interface.d.ts +1 -1
- package/build/if-run/types/exhaust-plugin-interface.js +3 -0
- package/build/if-run/types/explain.d.ts +10 -0
- package/build/if-run/types/explain.js +3 -0
- package/build/if-run/types/interface.d.ts +3 -0
- package/build/if-run/types/interface.js +6 -0
- package/build/if-run/types/plugin-storage.js +3 -0
- package/build/if-run/types/process-args.d.ts +25 -0
- package/build/if-run/types/process-args.js +3 -0
- package/build/if-run/types/time-sync.js +3 -0
- package/build/{util → if-run/util}/aggregation-helper.d.ts +2 -1
- package/build/if-run/util/aggregation-helper.js +47 -0
- package/build/if-run/util/args.d.ts +9 -0
- package/build/if-run/util/args.js +60 -0
- package/build/if-run/util/helpers.d.ts +14 -0
- package/build/if-run/util/helpers.js +57 -0
- package/build/if-run/util/log-memoize.js +19 -0
- package/build/if-run/util/os-checker.js +97 -0
- package/build/{util → if-run/util}/plugin-storage.d.ts +1 -1
- package/build/if-run/util/plugin-storage.js +34 -0
- package/jest.config.js +2 -6
- package/manifests/{plugins → examples/builtins}/coefficient/failure-invalid-config-input-param.yml +2 -2
- package/manifests/{plugins → examples/builtins}/coefficient/failure-output-param-is-null.yaml +3 -3
- package/manifests/{plugins → examples/builtins}/coefficient/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +3 -3
- package/manifests/{plugins → examples/builtins}/csv-lookup/cloud-metadata/failure-invalid-vendor.yaml +3 -3
- package/manifests/{plugins → examples/builtins}/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yml +3 -3
- package/manifests/{plugins → examples/builtins}/csv-lookup/cloud-metadata/success.yml +3 -3
- package/manifests/{plugins → examples/builtins}/csv-lookup/region-metadata/failure-missing-column.yml +3 -4
- package/manifests/{plugins → examples/builtins}/csv-lookup/region-metadata/failure-missing-output.yml +3 -4
- package/manifests/{plugins → examples/builtins}/csv-lookup/region-metadata/success-renaming.yml +4 -5
- package/manifests/{plugins → examples/builtins}/csv-lookup/region-metadata/success.yml +3 -4
- package/manifests/{plugins → examples/builtins}/csv-lookup/tdp-finder/failure-missing-input-param.yml +2 -2
- package/manifests/{plugins → examples/builtins}/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yml +2 -2
- package/manifests/{plugins → examples/builtins}/csv-lookup/tdp-finder/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/divide/failure-denominator-equal-zero.yml +4 -4
- package/manifests/{plugins → examples/builtins}/divide/failure-invalid-config-denominator.yml +5 -5
- package/manifests/{plugins → examples/builtins}/divide/failure-missing-numerator.yml +4 -4
- package/manifests/{plugins → examples/builtins}/divide/success.yml +4 -6
- package/manifests/{plugins → examples/builtins}/exponent/success.yml +5 -8
- package/manifests/{plugins → examples/builtins}/interpolation/interpolation.yml +2 -2
- package/manifests/{plugins → examples/builtins}/interpolation/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/mock-observations/failure-invalid-config-cpu-range.yml +2 -2
- package/manifests/{plugins → examples/builtins}/mock-observations/failure-invalid-memory-utilization-range.yml +2 -2
- package/manifests/{plugins → examples/builtins}/mock-observations/failure-missing-timestamp-from-param.yml +2 -2
- package/manifests/{plugins → examples/builtins}/mock-observations/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/multiply/failure-input-parameter-is-missing.yml +2 -4
- package/manifests/{plugins → examples/builtins}/multiply/success-with-multiple-inputs.yml +2 -4
- package/manifests/{plugins → examples/builtins}/multiply/success.yml +3 -4
- package/manifests/{plugins → examples/builtins}/regex/failure-missing-input-param.yml +2 -4
- package/manifests/{plugins → examples/builtins}/regex/failure-not-matching-with-regex.yml +2 -4
- package/manifests/{plugins → examples/builtins}/regex/success.yml +2 -4
- package/manifests/{plugins → examples/builtins}/sci/failure-invalid-config-value.yml +2 -2
- package/manifests/{plugins → examples/builtins}/sci/failure-missing-input-param.yml +3 -2
- package/manifests/{plugins → examples/builtins}/sci/success.yml +2 -3
- package/manifests/{plugins → examples/builtins}/sci-embodied/failure-invalid-default-emission-value.yml +3 -3
- package/manifests/{plugins → examples/builtins}/sci-embodied/failure-missing-expected-lifespan.yml +2 -2
- package/manifests/{plugins → examples/builtins}/sci-embodied/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/shell/failure-invalid-command.yml +2 -2
- package/manifests/{plugins → examples/builtins}/shell/success.yml +2 -1
- package/manifests/{plugins → examples/builtins}/subtract/success.yml +6 -9
- package/manifests/{plugins → examples/builtins}/sum/failure-missing-input-param.yml +2 -4
- package/manifests/{plugins → examples/builtins}/sum/failure-missing-output-param.yml +3 -5
- package/manifests/{plugins → examples/builtins}/sum/success.yml +2 -4
- package/manifests/{plugins → examples/builtins}/time-sync/failure-config-start-later-end.yml +3 -3
- package/manifests/{plugins → examples/builtins}/time-sync/failure-missing-global-config.yml +3 -3
- package/manifests/{plugins → examples/builtins}/time-sync/success.yml +2 -2
- package/manifests/{plugins/groupby/failure-invalid-config-group.yml → examples/features/regroup/failure-invalid-regroup.yml} +4 -11
- package/manifests/{plugins/groupby → examples/features/regroup}/failure-missing-cloud-instance-type.yml +5 -12
- package/manifests/{plugins/groupby → examples/features/regroup}/success.yml +4 -11
- package/manifests/examples/{generics.yml → pipelines/generics.yml} +12 -12
- package/manifests/examples/{instance-metadata.yml → pipelines/instance-metadata.yml} +6 -7
- package/manifests/examples/{nesting.yml → pipelines/nesting.yml} +157 -50
- package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-aggregate.yaml +997 -0
- package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-mocks.yaml +1059 -0
- package/manifests/examples/{pipeline-teads-sci.yml → pipelines/pipeline-teads-sci.yml} +11 -11
- package/manifests/examples/{pipeline-with-aggregate.yml → pipelines/pipeline-with-aggregate.yml} +113 -36
- package/manifests/examples/pipelines/pipeline-with-mocks.yml +297 -0
- package/manifests/{bugs/mock-observations-failure-duration-is-zero.yml → examples/pipelines/scenario-1.yml} +7 -7
- package/manifests/examples/pipelines/scenario-2.yml +52 -0
- package/manifests/examples/pipelines/scenario-3.yml +86 -0
- package/manifests/examples/pipelines/scenario-4.yml +46 -0
- package/manifests/examples/pipelines/scenario-5.yml +46 -0
- package/manifests/examples/{sci.yml → pipelines/sci.yml} +15 -17
- package/manifests/examples/{teads-curve.yml → pipelines/teads-curve.yml} +7 -6
- package/manifests/examples/{zeros.yaml → pipelines/zeros.yml} +15 -16
- package/manifests/outputs/bugs/aggregation-error-wrong-metric.yaml +235 -0
- package/manifests/outputs/bugs/input-error-missing-duration.yaml +82 -0
- package/manifests/outputs/bugs/mock-observations-failure-duration-is-zero.yaml +79 -0
- package/manifests/outputs/bugs/pipeline-error-naming-mismatch.yaml +89 -0
- package/manifests/outputs/bugs/pipeline-error-uninitialized-plugin.yaml +90 -0
- package/manifests/outputs/bugs/pipeline-ordering-error.yaml +152 -0
- package/manifests/outputs/bugs/sci-embodied-missing-resources-total.yaml +72 -0
- package/manifests/outputs/builtins/coefficient/failure-invalid-config-input-param.yaml +69 -0
- package/manifests/outputs/builtins/coefficient/failure-output-param-is-null.yaml +69 -0
- package/manifests/outputs/builtins/coefficient/success.yaml +70 -0
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +76 -0
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yaml +74 -0
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/success.yaml +79 -0
- package/manifests/outputs/builtins/csv-lookup/region-metadata/failure-missing-column.yaml +75 -0
- package/manifests/outputs/builtins/csv-lookup/region-metadata/failure-missing-output.yaml +73 -0
- package/manifests/outputs/builtins/csv-lookup/region-metadata/success-renaming.yaml +78 -0
- package/manifests/outputs/builtins/csv-lookup/region-metadata/success.yaml +90 -0
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/failure-missing-input-param.yaml +71 -0
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yaml +73 -0
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/success.yaml +74 -0
- package/manifests/outputs/builtins/divide/failure-invalid-config-denominator.yaml +69 -0
- package/manifests/outputs/builtins/divide/failure-missing-numerator.yaml +75 -0
- package/manifests/outputs/builtins/divide/success-denominator-equal-zero.yaml +91 -0
- package/manifests/outputs/builtins/divide/success.yaml +91 -0
- package/manifests/outputs/builtins/exponent/success.yaml +73 -0
- package/manifests/outputs/builtins/interpolation/interpolation.yaml +81 -0
- package/manifests/outputs/builtins/interpolation/success.yaml +81 -0
- package/manifests/outputs/builtins/mock-observations/failure-invalid-config-cpu-range.yaml +84 -0
- package/manifests/outputs/builtins/mock-observations/failure-invalid-memory-utilization-range.yaml +82 -0
- package/manifests/outputs/builtins/mock-observations/failure-missing-timestamp-from-param.yaml +81 -0
- package/manifests/outputs/builtins/mock-observations/success.yaml +358 -0
- package/manifests/outputs/builtins/multiply/failure-input-parameter-is-missing.yaml +71 -0
- package/manifests/outputs/builtins/multiply/success-with-multiple-inputs.yaml +92 -0
- package/manifests/outputs/builtins/multiply/success.yaml +74 -0
- package/manifests/outputs/builtins/regex/failure-missing-input-param.yaml +71 -0
- package/manifests/outputs/builtins/regex/success.yaml +76 -0
- package/manifests/outputs/builtins/sci/failure-invalid-config-value.yaml +70 -0
- package/manifests/outputs/builtins/sci/failure-missing-input-param.yaml +70 -0
- package/manifests/outputs/builtins/sci/success.yaml +77 -0
- package/manifests/outputs/builtins/sci-embodied/failure-invalid-default-emission-value.yaml +73 -0
- package/manifests/outputs/builtins/sci-embodied/failure-missing-expected-lifespan.yaml +69 -0
- package/manifests/outputs/builtins/sci-embodied/success.yaml +76 -0
- package/manifests/outputs/builtins/shell/failure-invalid-command.yaml +68 -0
- package/manifests/outputs/builtins/shell/success.yaml +66 -0
- package/manifests/outputs/builtins/subtract/success.yaml +74 -0
- package/manifests/outputs/builtins/sum/failure-missing-input-param.yaml +71 -0
- package/manifests/outputs/builtins/sum/failure-missing-output-param.yaml +74 -0
- package/manifests/outputs/builtins/sum/success.yaml +74 -0
- package/manifests/outputs/builtins/time-sync/failure-config-start-later-end.yaml +79 -0
- package/manifests/outputs/builtins/time-sync/success.yaml +122 -0
- package/manifests/outputs/features/aggregate-failure-invalid-metrics.yaml +100 -0
- package/manifests/outputs/features/aggregate-failure-missing-metric-in-inputs.yaml +99 -0
- package/manifests/outputs/features/aggregate-horizontal.yaml +132 -0
- package/manifests/outputs/features/aggregate-vertical.yaml +155 -0
- package/manifests/outputs/features/aggregate.yaml +159 -0
- package/manifests/outputs/features/failure-invalid-regroup.yaml +87 -0
- package/manifests/outputs/features/failure-missing-cloud-instance-type.yaml +86 -0
- package/manifests/outputs/pipelines/cloud-metadata-divide.yaml +91 -0
- package/manifests/outputs/pipelines/generics.yaml +239 -0
- package/manifests/outputs/pipelines/instance-metadata.yaml +98 -0
- package/manifests/outputs/pipelines/mock-obs-time-sync.yaml +449 -0
- package/manifests/outputs/pipelines/nesting.yaml +1799 -0
- package/manifests/outputs/pipelines/pipeline-teads-sci.yaml +276 -0
- package/manifests/outputs/pipelines/sci.yaml +297 -0
- package/manifests/outputs/pipelines/teads-curve.yaml +188 -0
- package/manifests/outputs/pipelines/zeros.yaml +198 -0
- package/package.json +15 -16
- package/src/__mocks__/mock-manifest.yaml +2 -3
- package/src/{config → if-env/config}/env-template.yml +2 -3
- package/src/{builtins → if-run/builtins}/coefficient/README.md +31 -9
- package/src/{builtins → if-run/builtins}/copy-param/README.md +30 -11
- package/src/{builtins → if-run/builtins}/csv-lookup/README.md +32 -20
- package/src/{builtins → if-run/builtins}/divide/README.md +21 -8
- package/src/{builtins → if-run/builtins}/exponent/README.md +19 -8
- package/src/{builtins → if-run/builtins}/interpolation/README.md +21 -6
- package/src/{builtins → if-run/builtins}/mock-observations/README.md +18 -4
- package/src/{builtins → if-run/builtins}/multiply/README.md +20 -8
- package/src/{builtins → if-run/builtins}/regex/README.md +19 -9
- package/src/{builtins → if-run/builtins}/sci/README.md +19 -9
- package/src/{builtins → if-run/builtins}/sci-embodied/README.md +17 -5
- package/src/{builtins → if-run/builtins}/shell/README.md +19 -7
- package/src/{builtins → if-run/builtins}/subtract/README.md +17 -6
- package/src/{builtins → if-run/builtins}/sum/README.md +34 -8
- package/src/if-run/builtins/time-sync/README.md +267 -0
- package/build/builtins/coefficient/index.d.ts +0 -2
- package/build/builtins/coefficient/index.js +0 -65
- package/build/builtins/copy-param/index.d.ts +0 -2
- package/build/builtins/copy-param/index.js +0 -68
- package/build/builtins/csv-lookup/index.d.ts +0 -2
- package/build/builtins/csv-lookup/index.js +0 -188
- package/build/builtins/divide/index.d.ts +0 -2
- package/build/builtins/divide/index.js +0 -78
- package/build/builtins/exponent/index.d.ts +0 -2
- package/build/builtins/exponent/index.js +0 -58
- package/build/builtins/export-csv-raw.d.ts +0 -4
- package/build/builtins/export-csv-raw.js +0 -132
- package/build/builtins/export-csv.d.ts +0 -10
- package/build/builtins/export-csv.js +0 -96
- package/build/builtins/export-yaml.js +0 -30
- package/build/builtins/group-by.d.ts +0 -5
- package/build/builtins/group-by.js +0 -71
- package/build/builtins/interpolation/index.d.ts +0 -2
- package/build/builtins/interpolation/index.js +0 -148
- package/build/builtins/mock-observations/helpers/common-generator.js +0 -29
- package/build/builtins/mock-observations/helpers/rand-int-generator.js +0 -48
- package/build/builtins/mock-observations/index.d.ts +0 -2
- package/build/builtins/mock-observations/index.js +0 -114
- package/build/builtins/mock-observations/interfaces/index.js +0 -3
- package/build/builtins/multiply/index.d.ts +0 -2
- package/build/builtins/multiply/index.js +0 -57
- package/build/builtins/regex/index.d.ts +0 -2
- package/build/builtins/regex/index.js +0 -74
- package/build/builtins/sci/config.js +0 -44
- package/build/builtins/sci/index.d.ts +0 -2
- package/build/builtins/sci/index.js +0 -70
- package/build/builtins/sci-embodied/index.d.ts +0 -2
- package/build/builtins/sci-embodied/index.js +0 -114
- package/build/builtins/shell/index.d.ts +0 -2
- package/build/builtins/shell/index.js +0 -58
- package/build/builtins/subtract/index.d.ts +0 -2
- package/build/builtins/subtract/index.js +0 -59
- package/build/builtins/sum/index.d.ts +0 -2
- package/build/builtins/sum/index.js +0 -64
- package/build/builtins/time-sync.d.ts +0 -2
- package/build/builtins/time-sync.js +0 -300
- package/build/check.js +0 -85
- package/build/config/config.d.ts +0 -29
- package/build/config/config.js +0 -147
- package/build/config/index.js +0 -10
- package/build/config/params.d.ts +0 -2
- package/build/config/params.js +0 -196
- package/build/config/strings.js +0 -101
- package/build/diff.js +0 -46
- package/build/env.js +0 -38
- package/build/index.js +0 -48
- package/build/lib/aggregate.d.ts +0 -6
- package/build/lib/aggregate.js +0 -77
- package/build/lib/compare.js +0 -56
- package/build/lib/compute.js +0 -91
- package/build/lib/environment.js +0 -75
- package/build/lib/exhaust.js +0 -53
- package/build/lib/initialize.d.ts +0 -6
- package/build/lib/initialize.js +0 -101
- package/build/lib/load.js +0 -70
- package/build/lib/parameterize.d.ts +0 -6
- package/build/lib/parameterize.js +0 -55
- package/build/types/aggregation.d.ts +0 -2
- package/build/types/aggregation.js +0 -5
- package/build/types/compute.js +0 -3
- package/build/types/environment.js +0 -3
- package/build/types/exhaust-plugin-interface.js +0 -3
- package/build/types/if-env.js +0 -3
- package/build/types/interface.d.ts +0 -4
- package/build/types/interface.js +0 -8
- package/build/types/lib/compare.js +0 -3
- package/build/types/manifest.js +0 -3
- package/build/types/npm.js +0 -3
- package/build/types/parameters.d.ts +0 -5
- package/build/types/parameters.js +0 -5
- package/build/types/plugin-storage.js +0 -3
- package/build/types/process-args.d.ts +0 -33
- package/build/types/process-args.js +0 -3
- package/build/types/time-sync.js +0 -3
- package/build/types/util/args.js +0 -3
- package/build/util/aggregation-helper.js +0 -55
- package/build/util/args.d.ts +0 -37
- package/build/util/args.js +0 -205
- package/build/util/debug-logger.js +0 -117
- package/build/util/fs.js +0 -94
- package/build/util/helpers.d.ts +0 -57
- package/build/util/helpers.js +0 -250
- package/build/util/json.d.ts +0 -4
- package/build/util/json.js +0 -36
- package/build/util/log-memoize.js +0 -19
- package/build/util/npm.js +0 -152
- package/build/util/os-checker.js +0 -97
- package/build/util/plugin-storage.js +0 -34
- package/build/util/validations.js +0 -124
- package/build/util/yaml.js +0 -59
- package/manifests/bugs/aggregation-error-wrong-metric.yml +0 -178
- package/manifests/bugs/azure-importer-ignoring-defaults.yml +0 -64
- package/manifests/bugs/azure-importer-incorrect-calculation.yml +0 -59
- package/manifests/bugs/initialize-error-no-config.yml +0 -26
- package/manifests/bugs/initialize-error-no-path.yml +0 -32
- package/manifests/bugs/initialize-error-no-plugins.yml +0 -23
- package/manifests/bugs/input-error-missing-duration.yml +0 -25
- package/manifests/bugs/pipeline-error-naming-mismatch.yml +0 -32
- package/manifests/bugs/pipeline-error-uninitialized-plugin.yml +0 -33
- package/manifests/bugs/pipeline-ordering-error.yml +0 -91
- package/manifests/bugs/sci-embodied-missing-resources-total.yml +0 -23
- package/manifests/examples/copy.yaml +0 -20
- package/manifests/examples/mock-cpu-util-to-carbon.yml +0 -76
- package/manifests/examples/pipeline-with-mocks.yml +0 -207
- package/manifests/examples/region-metadata.yml +0 -26
- package/manifests/examples/tdp-finder.yml +0 -23
- package/manifests/features/aggregate-failure-invalid-metrics.yml +0 -49
- package/manifests/features/aggregate-failure-missing-metric-in-inputs.yml +0 -49
- package/manifests/features/aggregate-horizontal.yml +0 -50
- package/manifests/features/aggregate-vertical.yml +0 -50
- package/manifests/features/aggregate.yml +0 -50
- package/manifests/integrations/cloud-metadata-divide.yml +0 -37
- package/manifests/integrations/instance-metadata/failure-invalid-instance-type.yaml +0 -33
- package/manifests/integrations/instance-metadata/failure-invalid-provider.yaml +0 -33
- package/manifests/integrations/instance-metadata/failure-missing-queried-input.yml +0 -33
- package/manifests/integrations/instance-metadata/success.yml +0 -33
- package/manifests/integrations/mock-obs-group-by-cloud-meta.yml +0 -57
- package/manifests/integrations/mock-obs-groupby.yml +0 -39
- package/manifests/integrations/mock-obs-time-sync.yml +0 -110
- package/src/__tests__/integration/templates/integration.yaml +0 -16
- package/src/builtins/README.md +0 -848
- /package/build/{util → common/util}/debug-logger.d.ts +0 -0
- /package/build/{util → common/util}/fs.d.ts +0 -0
- /package/build/{util → common/util}/logger.d.ts +0 -0
- /package/build/{util → common/util}/yaml.d.ts +0 -0
- /package/build/{index.d.ts → if-check/index.d.ts} +0 -0
- /package/build/{check.d.ts → if-csv/index.d.ts} +0 -0
- /package/build/{diff.d.ts → if-diff/index.d.ts} +0 -0
- /package/build/{types/util → if-diff/types}/args.d.ts +0 -0
- /package/build/{types/lib → if-diff/types}/compare.d.ts +0 -0
- /package/build/{env.d.ts → if-env/index.d.ts} +0 -0
- /package/build/{types → if-env/types}/if-env.d.ts +0 -0
- /package/build/{types → if-env/types}/npm.d.ts +0 -0
- /package/build/{builtins → if-run/builtins}/mock-observations/helpers/common-generator.d.ts +0 -0
- /package/build/{builtins → if-run/builtins}/mock-observations/helpers/rand-int-generator.d.ts +0 -0
- /package/build/{builtins → if-run/builtins}/mock-observations/interfaces/index.d.ts +0 -0
- /package/build/{builtins → if-run/builtins}/sci/config.d.ts +0 -0
- /package/build/{lib → if-run/lib}/compute.d.ts +0 -0
- /package/build/{types → if-run/types}/environment.d.ts +0 -0
- /package/build/{types → if-run/types}/plugin-storage.d.ts +0 -0
- /package/build/{types → if-run/types}/time-sync.d.ts +0 -0
- /package/build/{util → if-run/util}/log-memoize.d.ts +0 -0
- /package/build/{util → if-run/util}/os-checker.d.ts +0 -0
package/src/builtins/README.md
DELETED
|
@@ -1,848 +0,0 @@
|
|
|
1
|
-
# IF builtins
|
|
2
|
-
|
|
3
|
-
There are three built-in features of IF:
|
|
4
|
-
|
|
5
|
-
- time-sync
|
|
6
|
-
- CSV exporter
|
|
7
|
-
- groupby
|
|
8
|
-
|
|
9
|
-
On this page, you can find the documentation for each of these three builtins.
|
|
10
|
-
|
|
11
|
-
## Time-sync
|
|
12
|
-
|
|
13
|
-
Time sync standardizes the start time, end time and temporal resolution of all output data across an entire tree.
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
### Plugin config
|
|
18
|
-
|
|
19
|
-
The following should be defined in the plugin initialization:
|
|
20
|
-
|
|
21
|
-
- `start-time`: global start time as ISO 8061 string
|
|
22
|
-
- `stop`: global end time as ISO 8061 string
|
|
23
|
-
- `interval`: temporal resolution in seconds
|
|
24
|
-
- `error-on-padding`: avoid zero/'zeroish' padding (if needed) and error out instead. `False` by defult.
|
|
25
|
-
|
|
26
|
-
#### Inputs:
|
|
27
|
-
|
|
28
|
-
- `inputs`: an array of observations
|
|
29
|
-
|
|
30
|
-
#### Returns
|
|
31
|
-
|
|
32
|
-
- `inputs`: time-synchronized version of the tree
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
#### Overview
|
|
38
|
-
|
|
39
|
-
A manifest file for a tree might contain many nodes each representing some different part of an application's stack or even different applications running on different machines. It is therefore common to have time series data in each component that is not directly comparable to other components either because the temporal resolution of the data is different, they cover different periods, or there are gaps in some records (e.g. some apps might burst but then go dormant, while others run continuously). This makes post-hoc visualization, analysis and aggregation of data from groups of nodes difficult to achieve. To address this, we created a time synchronization plugin that takes in non-uniform times series and snaps them all to a regular timeline with uniform start time, end time and temporal resolution.
|
|
40
|
-
|
|
41
|
-
We do this by implementing the following logic:
|
|
42
|
-
|
|
43
|
-
- Shift readings to nearest whole seconds
|
|
44
|
-
- Upsample the time series to a base resolution (1s)
|
|
45
|
-
- Resample to desired resolution by batching 1s entries
|
|
46
|
-
- Extrapolate or trim to ensure all time series share global start and end dates
|
|
47
|
-
|
|
48
|
-
The next section explains each stage in more detail.
|
|
49
|
-
|
|
50
|
-
#### Details
|
|
51
|
-
|
|
52
|
-
##### Upsampling rules
|
|
53
|
-
|
|
54
|
-
A set of `inputs` is naturally a time series because all `observations` include a `timestamp` and a `duration`, measured in seconds.
|
|
55
|
-
For each `observation` in `inputs` we check whether the duration is greater than 1 second. If `duration` is greater than 1 second, we create N new `observation` objects, where N is equal to `duration`. This means we have an `observation` for every second between the initial timestamp and the end of the observation period. Each new object receives a timestamp incremented by one second.
|
|
56
|
-
|
|
57
|
-
This looks as follows:
|
|
58
|
-
|
|
59
|
-
```ts
|
|
60
|
-
[{timestamp: '2023-12-12T00:00:00.000Z', duration: 5}]
|
|
61
|
-
|
|
62
|
-
# becomes
|
|
63
|
-
[
|
|
64
|
-
{timestamp: '2023-12-12T00:00:01.000Z', duration: 1}
|
|
65
|
-
{timestamp: '2023-12-12T00:00:02.000Z', duration: 1}
|
|
66
|
-
{timestamp: '2023-12-12T00:00:03.000Z', duration: 1}
|
|
67
|
-
{timestamp: '2023-12-12T00:00:04.000Z', duration: 1}
|
|
68
|
-
{timestamp: '2023-12-12T00:00:05.000Z', duration: 1}
|
|
69
|
-
]
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Each `observation` actually includes many key-value pairs. The precise content of the `observation` is not known until runtime because it depends on which plugins have been included in the pipeline. Different values have to be treated differently when we upsample in time. The method we use to upsample depends on the `aggregation-method` defined for each key in `units.yml`.
|
|
73
|
-
|
|
74
|
-
If the right way to aggregate a value is to sum it, then the right way to upsample it is to divide by `duration`, effectively spreading the total out evenly across the new, higher resolution, `observations` so that the total across the same bucket of time is unchanged (i.e. if the total for some value is 10 when there is one entry with `duration = 10s`, then the total should still be 10 when there are 10 entries each witch `duration = 1s`).
|
|
75
|
-
|
|
76
|
-
On the other hand, if the right way to aggregate a value is to take its average over some time period, the value should be copied unchanged into the newly upsampled `observations`. This is appropriate for values that are proportional or percentages, such as `cpu/utilization`. Treating these values as constants means the average over the `duration` for an observation is identical whether you consider the initial `observation` or the upsampled set of N `observation`s.
|
|
77
|
-
|
|
78
|
-
Constants can simply be copied as-is, because they are constants. Examples might be the `grid/carbon-intensity` - this value does not change depending on how frequently you observe it.
|
|
79
|
-
|
|
80
|
-
Therefore, we apply this logic and the resulting flow looks as follows (the `aggregation-method` for `carbon` and `energy` is `sum`, `grid/carbon-intensity` is a constant and `cpu/utilization` is expressed as a percentage):
|
|
81
|
-
|
|
82
|
-
```ts
|
|
83
|
-
[{timestamp: '2023-12-12T00:00:00.000Z', duration: 5, 'cpu/utilization': 12, carbon: 5, energy: 10, 'grid/carbon-intensity': 471}]
|
|
84
|
-
|
|
85
|
-
# becomes
|
|
86
|
-
|
|
87
|
-
[
|
|
88
|
-
{timestamp: '2023-12-12T00:00:00.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, 'grid/carbon-intensity': 471},
|
|
89
|
-
{timestamp: '2023-12-12T00:00:01.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, 'grid/carbon-intensity': 471},
|
|
90
|
-
{timestamp: '2023-12-12T00:00:02.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, 'grid/carbon-intensity': 471},
|
|
91
|
-
{timestamp: '2023-12-12T00:00:03.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, 'grid/carbon-intensity': 471},
|
|
92
|
-
{timestamp: '2023-12-12T00:00:04.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, 'grid/carbon-intensity': 471},
|
|
93
|
-
{timestamp: '2023-12-12T00:00:05.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, 'grid/carbon-intensity': 471}
|
|
94
|
-
]
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
The end result is that for each `observation`, we upsample the time series to yield 1 second resolution data between `timestamp` and `timestamp + duration`.
|
|
98
|
-
|
|
99
|
-
##### Gap-filling
|
|
100
|
-
|
|
101
|
-
Sometimes there might be discontinuities in the time series between one `observation` and another. For example we might have two `observations` in a set of `inputs` that have timestamps spaced 10 seconds apart, but the `duration` of the first `observation` is only 5 seconds. in this case, 5 seconds of data are unaccounted for and create a discontinuity in the time series.
|
|
102
|
-
|
|
103
|
-
To solve this problem, for all but the first `observation` in the `inputs` array, we grab the `timestamp` and `duration` from the previous `observation` and check that `timestamp[N] + duration[N] == timestamp[N+1]`. If this condition is not satisfied, we backfill the missing data with a "zero-observation" which is identical to the surrounding observations except any values whose `aggregation-method` is `sum` are set to zero. This is equivalent to assuming that when there is no data available, the app being monitored is switched off.
|
|
104
|
-
|
|
105
|
-
The end result of this gap-filling is that we have continuous 1 second resolution data that can be resampled to a new temporal resolution.
|
|
106
|
-
|
|
107
|
-
```ts
|
|
108
|
-
[
|
|
109
|
-
{timestamp: '2023-12-12T00:00:00.000Z', duration: 5, 'cpu/utilization': 12, carbon: 5, energy: 10, grid/carbon-intensity: 471},
|
|
110
|
-
{timestamp: '2023-12-12T00:00:08.000Z', duration: 2, 'cpu/utilization': 12, carbon: 5, energy: 10, grid/carbon-intensity: 471}
|
|
111
|
-
]
|
|
112
|
-
|
|
113
|
-
# There are 2 seconds of missing data between the end of timestamp[0] + duration, and timestamp[1]
|
|
114
|
-
# After expansion and infilling, the array becomes:
|
|
115
|
-
|
|
116
|
-
[
|
|
117
|
-
{timestamp: '2023-12-12T00:00:00.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
118
|
-
{timestamp: '2023-12-12T00:00:01.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
119
|
-
{timestamp: '2023-12-12T00:00:02.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
120
|
-
{timestamp: '2023-12-12T00:00:03.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
121
|
-
{timestamp: '2023-12-12T00:00:04.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
122
|
-
{timestamp: '2023-12-12T00:00:05.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
123
|
-
{timestamp: '2023-12-12T00:00:06.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
124
|
-
{timestamp: '2023-12-12T00:00:07.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
125
|
-
{timestamp: '2023-12-12T00:00:08.000Z', duration: 1, 'cpu/utilization': 12, carbon: 2.5, energy: 5, grid/carbon-intensity: 471},
|
|
126
|
-
{timestamp: '2023-12-12T00:00:09.000Z', duration: 1, 'cpu/utilization': 12, carbon: 2.5, energy: 5, grid/carbon-intensity: 471}
|
|
127
|
-
]
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Note that when `error-on-padding` is `true` no gap-filling is performed and the plugin will error out instead.
|
|
131
|
-
|
|
132
|
-
##### Trimming and padding
|
|
133
|
-
|
|
134
|
-
To ensure parity across all the components in a tree, we need to synchronize the start and end times for all time series. To do this, we pass the `time-sync` plugin plugin some global config: `startTime`, `endTime` and `interval`. The `startTime` is the timestamp where _all_ input arrays across the entire tree should begin, and `endTime` is the timestamp where _all_ input arrays across the entire tree should end. `interval` is the time resolution we ultimately want to resample to.
|
|
135
|
-
|
|
136
|
-
To synchronize the time series start and end we check the first element of `inputs` for each node in the tree and determine whether it is earlier, later or equal to the global start time. If it is equal then no action is required. If the `input` start time is earlier than the global start time, we simply discard entries from the front of the array until the start times are aligned. If the `input` start time is after the global start time, then we pad with our "zero-observation" object - one for every second separating the global start time from the `input` start time. The same process is repeated for the end time - we either trim away `input` data or pad it out with "zero-observation" objects.
|
|
137
|
-
|
|
138
|
-
For example, for `startTime = 2023-12-12T00:00:00.000Z` and `endTime = 2023-12-12T00:00:15.000Z`:
|
|
139
|
-
|
|
140
|
-
```ts
|
|
141
|
-
[
|
|
142
|
-
{timestamp: '2023-12-12T00:00:05.000Z', duration: 5, 'cpu/utilization': 12, carbon: 5, energy: 10, 'grid/carbon-intensity': 471},
|
|
143
|
-
]
|
|
144
|
-
|
|
145
|
-
# There are 5 seconds missing from the start and end. After padding, the array becomes:
|
|
146
|
-
|
|
147
|
-
[
|
|
148
|
-
{timestamp: '2023-12-12T00:00:00.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
149
|
-
{timestamp: '2023-12-12T00:00:01.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
150
|
-
{timestamp: '2023-12-12T00:00:02.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
151
|
-
{timestamp: '2023-12-12T00:00:03.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
152
|
-
{timestamp: '2023-12-12T00:00:04.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
153
|
-
{timestamp: '2023-12-12T00:00:05.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
154
|
-
{timestamp: '2023-12-12T00:00:06.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
155
|
-
{timestamp: '2023-12-12T00:00:07.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
156
|
-
{timestamp: '2023-12-12T00:00:08.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
157
|
-
{timestamp: '2023-12-12T00:00:09.000Z', duration: 1, 'cpu/utilization': 12, carbon: 1, energy: 2, grid/carbon-intensity: 471},
|
|
158
|
-
{timestamp: '2023-12-12T00:00:10.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
159
|
-
{timestamp: '2023-12-12T00:00:11.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
160
|
-
{timestamp: '2023-12-12T00:00:12.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
161
|
-
{timestamp: '2023-12-12T00:00:13.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
162
|
-
{timestamp: '2023-12-12T00:00:14.000Z', duration: 1, 'cpu/utilization': 0, carbon: 0, energy: 0, grid/carbon-intensity: 471},
|
|
163
|
-
|
|
164
|
-
]
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Note that when `error-on-padding` is `true` no padding is performed and the plugin will error out instead.
|
|
168
|
-
|
|
169
|
-
##### Resampling rules
|
|
170
|
-
|
|
171
|
-
Now we have synchronized, continuous, high resolution time series data, we can resample. To achieve this, we use `interval`, which sets the global temporal resolution for the final, processed time series. `intervalk` is expressed in units of seconds, which means we can simply batch `observations` together in groups of size `interval`. For each value in each object we either sum, average or copy the values into one single summary object representing each time bucket of size `interval` depending on their `aggregation-method` defined in `params.ts`. The returned array is the final, synchronized time series at the desired temporal resolution.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
#### Assumptions and limitations
|
|
175
|
-
|
|
176
|
-
To do time synchronization, we assume:
|
|
177
|
-
|
|
178
|
-
- There is no environmental impact for an application when there is no data available.
|
|
179
|
-
- Evenly distributing the total for a `duration` across higher resolution `observations` is appropriate, as opposed to having some non-uniform distribution.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
### Typescript implementation
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
To run the plugin, you must first create an instance of `TimeSync`.
|
|
186
|
-
Then, you can call `execute()`.
|
|
187
|
-
|
|
188
|
-
```typescript
|
|
189
|
-
const globalConfig = {
|
|
190
|
-
'start-time': '2023-12-12T00:00:00.000Z',
|
|
191
|
-
'end-time': '2023-12-12T00:00:30.000Z',
|
|
192
|
-
interval: 10
|
|
193
|
-
}
|
|
194
|
-
const timeSync = TimeSync(globalConfig);
|
|
195
|
-
const results = timeSync.execute([
|
|
196
|
-
{
|
|
197
|
-
timestamp: '2023-12-12T00:00:00.000Z'
|
|
198
|
-
duration: 10
|
|
199
|
-
'cpu/utilization': 10
|
|
200
|
-
carbon: 100
|
|
201
|
-
energy: 100
|
|
202
|
-
requests: 300
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
timestamp: '2023-12-12T00:00:10.000Z'
|
|
206
|
-
duration: 10
|
|
207
|
-
'cpu/utilization': 20
|
|
208
|
-
carbon: 100,
|
|
209
|
-
energy: 100,
|
|
210
|
-
requests: 380
|
|
211
|
-
}
|
|
212
|
-
])
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Example manifest
|
|
216
|
-
|
|
217
|
-
IF users will typically call the plugin as part of a pipeline defined in an `manifest`
|
|
218
|
-
file. In this case, instantiating and configuring the plugin is handled by
|
|
219
|
-
`ie` and does not have to be done explicitly by the user.
|
|
220
|
-
The following is an example `manifest` that calls `time-sync`:
|
|
221
|
-
|
|
222
|
-
```yaml
|
|
223
|
-
name: time-sync-demo
|
|
224
|
-
description: impl with 2 levels of nesting with non-uniform timing of observations
|
|
225
|
-
tags:
|
|
226
|
-
initialize:
|
|
227
|
-
plugins:
|
|
228
|
-
teads-curve:
|
|
229
|
-
method: TeadsCurve
|
|
230
|
-
path: '@grnsft/if-unofficial-plugins'
|
|
231
|
-
sci-e:
|
|
232
|
-
method: SciE
|
|
233
|
-
path: '@grnsft/if-plugins'
|
|
234
|
-
sci-embodied:
|
|
235
|
-
path: 'builtin'
|
|
236
|
-
method: SciEmbodied
|
|
237
|
-
sci-o:
|
|
238
|
-
method: SciO
|
|
239
|
-
path: '@grnsft/if-plugins'
|
|
240
|
-
time-sync:
|
|
241
|
-
method: TimeSync
|
|
242
|
-
path: builtin
|
|
243
|
-
global-config:
|
|
244
|
-
start-time: '2023-12-12T00:00:00.000Z' # ISO timestamp
|
|
245
|
-
end-time: '2023-12-12T00:01:00.000Z' # ISO timestamp
|
|
246
|
-
interval: 5 # seconds
|
|
247
|
-
tree:
|
|
248
|
-
children:
|
|
249
|
-
child: # an advanced grouping node
|
|
250
|
-
pipeline:
|
|
251
|
-
- teads-curve
|
|
252
|
-
- sci-e
|
|
253
|
-
- sci-embodied
|
|
254
|
-
- sci-o
|
|
255
|
-
- time-sync
|
|
256
|
-
config:
|
|
257
|
-
teads-curve:
|
|
258
|
-
cpu/thermal-design-power: 65
|
|
259
|
-
sci-embodied:
|
|
260
|
-
device/emissions-embodied: 251000 # gCO2eq
|
|
261
|
-
time-reserved: 3600 # 1 hour in s
|
|
262
|
-
device/expected-lifespan: 126144000 # 4 years in seconds
|
|
263
|
-
resources-reserved: 1
|
|
264
|
-
resources-total: 1
|
|
265
|
-
sci-o:
|
|
266
|
-
grid/carbon-intensity: 457 # gCO2/kwh
|
|
267
|
-
children:
|
|
268
|
-
child-1:
|
|
269
|
-
inputs:
|
|
270
|
-
- timestamp: '2023-12-12T00:00:00.000Z'
|
|
271
|
-
duration: 10
|
|
272
|
-
cpu/utilization: 10
|
|
273
|
-
carbon: 100
|
|
274
|
-
energy: 100
|
|
275
|
-
requests: 300
|
|
276
|
-
- timestamp: '2023-12-12T00:00:10.000Z'
|
|
277
|
-
duration: 10
|
|
278
|
-
cpu/utilization: 20
|
|
279
|
-
carbon: 200
|
|
280
|
-
energy: 200
|
|
281
|
-
requests: 380
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
## CSV Exporter
|
|
286
|
-
|
|
287
|
-
IF supports exporting data to CSV files. This provides users with a data format that enables visualization and data analysis using standard data analysis tools.
|
|
288
|
-
|
|
289
|
-
### Manifest config
|
|
290
|
-
|
|
291
|
-
To export your data to a CSV file, you have to provide a small piece of config data to your manifest file:
|
|
292
|
-
|
|
293
|
-
```yaml
|
|
294
|
-
initialize:
|
|
295
|
-
outputs:
|
|
296
|
-
- csv
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
You can also add `- yaml` if you want to export to both `yaml` and `csv` simultaneously.
|
|
300
|
-
|
|
301
|
-
### CLI command
|
|
302
|
-
|
|
303
|
-
Then, you must select the metric you want to export to CSV. The name of that metric must be added to the savepath provided to the `--output` command in the CLI, after a hashtag.
|
|
304
|
-
|
|
305
|
-
For example, to export the `carbon` data from your tree to a CSV file:
|
|
306
|
-
|
|
307
|
-
```sh
|
|
308
|
-
if-run --manifest example.yml --output example#carbon
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
This will save a CSV file called `example.csv`. The contents will look similar to the following:
|
|
312
|
-
|
|
313
|
-
| | | | | |
|
|
314
|
-
| ---------------------------------------------- | ---------------- | ---------------------------- | ---------------------------- | ---------------------------- |
|
|
315
|
-
| **Path** | **Aggregated** | **2024-03-05T00:00:00.000Z** | **2024-03-05T00:05:00.000Z** | **2024-03-05T00:10:00.000Z** |
|
|
316
|
-
| tree.carbon | 425.289232008725 | 17.9269877157543 | 8.9024388783018 | 45.6021901509012 |
|
|
317
|
-
| tree.children.westus3.carbon | 104.696836722878 | 3.59973803197887 | 3.47438149032372 | 6.91318436533634 |
|
|
318
|
-
| tree.children.westus3.children.server-1.carbon | 104.696836722878 | 3.59973803197887 | 3.47438149032372 | 6.91318436533634 |
|
|
319
|
-
| tree.children.france.carbon | 320.592395285847 | 14.3272496837754 | 5.42805738797808 | 38.6890057855649 |
|
|
320
|
-
| tree.children.france.children.server-2.carbon | 320.592395285847 | 14.3272496837754 | 5.42805738797808 | 38.6890057855649 |
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
### Comparing CSV to Yaml
|
|
324
|
-
|
|
325
|
-
The CSV above is generated from the following yaml. The `carbon` metric is extracted and added to the CSV. Otherwise, the CSV is an exact representation of the following yaml tree. You can see that the CSV representation is *much* easier to understand than the full yaml tree:
|
|
326
|
-
|
|
327
|
-
```yaml
|
|
328
|
-
tree:
|
|
329
|
-
pipeline:
|
|
330
|
-
- mock-observations
|
|
331
|
-
- group-by
|
|
332
|
-
- cloud-metadata
|
|
333
|
-
- time-sync
|
|
334
|
-
- watttime
|
|
335
|
-
- teads-curve
|
|
336
|
-
- operational-carbon
|
|
337
|
-
defaults:
|
|
338
|
-
grid/carbon-intensity: 500
|
|
339
|
-
config:
|
|
340
|
-
group-by:
|
|
341
|
-
group:
|
|
342
|
-
- cloud/region
|
|
343
|
-
- name
|
|
344
|
-
children:
|
|
345
|
-
westus3:
|
|
346
|
-
children:
|
|
347
|
-
server-1:
|
|
348
|
-
inputs:
|
|
349
|
-
- timestamp: '2024-03-05T00:00:00.000Z'
|
|
350
|
-
duration: 300
|
|
351
|
-
name: server-1
|
|
352
|
-
cloud/instance-type: Standard_E64_v3
|
|
353
|
-
cloud/region: westus3
|
|
354
|
-
cloud/vendor: azure
|
|
355
|
-
cpu/utilization: 66
|
|
356
|
-
grid/carbon-intensity: 500
|
|
357
|
-
- timestamp: '2024-03-05T00:05:00.000Z'
|
|
358
|
-
duration: 300
|
|
359
|
-
name: server-1
|
|
360
|
-
cloud/instance-type: Standard_E64_v3
|
|
361
|
-
cloud/region: westus3
|
|
362
|
-
cloud/vendor: azure
|
|
363
|
-
cpu/utilization: 4
|
|
364
|
-
grid/carbon-intensity: 500
|
|
365
|
-
- timestamp: '2024-03-05T00:10:00.000Z'
|
|
366
|
-
duration: 300
|
|
367
|
-
name: server-1
|
|
368
|
-
cloud/instance-type: Standard_E64_v3
|
|
369
|
-
cloud/region: westus3
|
|
370
|
-
cloud/vendor: azure
|
|
371
|
-
cpu/utilization: 54
|
|
372
|
-
grid/carbon-intensity: 500
|
|
373
|
-
- timestamp: '2024-03-05T00:15:00.000Z'
|
|
374
|
-
duration: 300
|
|
375
|
-
name: server-1
|
|
376
|
-
cloud/instance-type: Standard_E64_v3
|
|
377
|
-
cloud/region: westus3
|
|
378
|
-
cloud/vendor: azure
|
|
379
|
-
cpu/utilization: 19
|
|
380
|
-
grid/carbon-intensity: 500
|
|
381
|
-
outputs:
|
|
382
|
-
- timestamp: '2024-03-05T00:00:00.000Z'
|
|
383
|
-
duration: 300
|
|
384
|
-
name: server-1
|
|
385
|
-
cloud/instance-type: Standard_E64_v3
|
|
386
|
-
cloud/region: westus3
|
|
387
|
-
cloud/vendor: azure
|
|
388
|
-
cpu/utilization: 65.78
|
|
389
|
-
grid/carbon-intensity: 369.4947514218548
|
|
390
|
-
vcpus-allocated: 64
|
|
391
|
-
vcpus-total: 64
|
|
392
|
-
memory-available: 432
|
|
393
|
-
physical-processor: >-
|
|
394
|
-
Intel® Xeon® Platinum 8370C,Intel® Xeon® Platinum 8272CL,Intel®
|
|
395
|
-
Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz
|
|
396
|
-
cpu/thermal-design-power: 269.1
|
|
397
|
-
cloud/region-cfe: CAISO
|
|
398
|
-
cloud/region-em-zone-id: US-CAL-CISO
|
|
399
|
-
cloud/region-wt-id: CAISO_NORTH
|
|
400
|
-
cloud/region-location: US West (N. California)
|
|
401
|
-
cloud/region-geolocation: 34.0497,-118.1326
|
|
402
|
-
geolocation: 34.0497,-118.1326
|
|
403
|
-
cpu/energy: 0.018934842060004835
|
|
404
|
-
carbon: 6.996324760173567
|
|
405
|
-
- timestamp: '2024-03-05T00:05:00.000Z'
|
|
406
|
-
duration: 300
|
|
407
|
-
name: server-1
|
|
408
|
-
cloud/instance-type: Standard_E64_v3
|
|
409
|
-
cloud/region: westus3
|
|
410
|
-
cloud/vendor: azure
|
|
411
|
-
cpu/utilization: 3.986666666666667
|
|
412
|
-
grid/carbon-intensity: 369.38452029076234
|
|
413
|
-
vcpus-allocated: 64
|
|
414
|
-
vcpus-total: 64
|
|
415
|
-
memory-available: 432
|
|
416
|
-
physical-processor: >-
|
|
417
|
-
Intel® Xeon® Platinum 8370C,Intel® Xeon® Platinum 8272CL,Intel®
|
|
418
|
-
Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz
|
|
419
|
-
cpu/thermal-design-power: 269.1
|
|
420
|
-
cloud/region-cfe: CAISO
|
|
421
|
-
cloud/region-em-zone-id: US-CAL-CISO
|
|
422
|
-
cloud/region-wt-id: CAISO_NORTH
|
|
423
|
-
cloud/region-location: US West (N. California)
|
|
424
|
-
cloud/region-geolocation: 34.0497,-118.1326
|
|
425
|
-
geolocation: 34.0497,-118.1326
|
|
426
|
-
cpu/energy: 0.004545546617763956
|
|
427
|
-
carbon: 1.6790545568620359
|
|
428
|
-
- timestamp: '2024-03-05T00:10:00.000Z'
|
|
429
|
-
duration: 300
|
|
430
|
-
name: server-1
|
|
431
|
-
cloud/instance-type: Standard_E64_v3
|
|
432
|
-
cloud/region: westus3
|
|
433
|
-
cloud/vendor: azure
|
|
434
|
-
cpu/utilization: 53.82
|
|
435
|
-
grid/carbon-intensity: 372.58122309244305
|
|
436
|
-
vcpus-allocated: 64
|
|
437
|
-
vcpus-total: 64
|
|
438
|
-
memory-available: 432
|
|
439
|
-
physical-processor: >-
|
|
440
|
-
Intel® Xeon® Platinum 8370C,Intel® Xeon® Platinum 8272CL,Intel®
|
|
441
|
-
Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz
|
|
442
|
-
cpu/thermal-design-power: 269.1
|
|
443
|
-
cloud/region-cfe: CAISO
|
|
444
|
-
cloud/region-em-zone-id: US-CAL-CISO
|
|
445
|
-
cloud/region-wt-id: CAISO_NORTH
|
|
446
|
-
cloud/region-location: US West (N. California)
|
|
447
|
-
cloud/region-geolocation: 34.0497,-118.1326
|
|
448
|
-
geolocation: 34.0497,-118.1326
|
|
449
|
-
cpu/energy: 0.017357893372978016
|
|
450
|
-
carbon: 6.467225143212361
|
|
451
|
-
- timestamp: '2024-03-05T00:15:00.000Z'
|
|
452
|
-
duration: 300
|
|
453
|
-
name: server-1
|
|
454
|
-
cloud/instance-type: Standard_E64_v3
|
|
455
|
-
cloud/region: westus3
|
|
456
|
-
cloud/vendor: azure
|
|
457
|
-
cpu/utilization: 18.936666666666667
|
|
458
|
-
grid/carbon-intensity: 434.20042537311633
|
|
459
|
-
vcpus-allocated: 64
|
|
460
|
-
vcpus-total: 64
|
|
461
|
-
memory-available: 432
|
|
462
|
-
physical-processor: >-
|
|
463
|
-
Intel® Xeon® Platinum 8370C,Intel® Xeon® Platinum 8272CL,Intel®
|
|
464
|
-
Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz
|
|
465
|
-
cpu/thermal-design-power: 269.1
|
|
466
|
-
cloud/region-cfe: CAISO
|
|
467
|
-
cloud/region-em-zone-id: US-CAL-CISO
|
|
468
|
-
cloud/region-wt-id: CAISO_NORTH
|
|
469
|
-
cloud/region-location: US West (N. California)
|
|
470
|
-
cloud/region-geolocation: 34.0497,-118.1326
|
|
471
|
-
geolocation: 34.0497,-118.1326
|
|
472
|
-
cpu/energy: 0.010385485956624245
|
|
473
|
-
carbon: 4.5093824200727735
|
|
474
|
-
aggregated:
|
|
475
|
-
carbon: 19.651986880320734
|
|
476
|
-
outputs:
|
|
477
|
-
- carbon: 6.996324760173567
|
|
478
|
-
timestamp: '2024-03-05T00:00:00.000Z'
|
|
479
|
-
duration: 300
|
|
480
|
-
- carbon: 1.6790545568620359
|
|
481
|
-
timestamp: '2024-03-05T00:05:00.000Z'
|
|
482
|
-
duration: 300
|
|
483
|
-
- carbon: 6.467225143212361
|
|
484
|
-
timestamp: '2024-03-05T00:10:00.000Z'
|
|
485
|
-
duration: 300
|
|
486
|
-
- carbon: 4.5093824200727735
|
|
487
|
-
timestamp: '2024-03-05T00:15:00.000Z'
|
|
488
|
-
duration: 300
|
|
489
|
-
aggregated:
|
|
490
|
-
carbon: 19.651986880320734
|
|
491
|
-
france:
|
|
492
|
-
children:
|
|
493
|
-
server-2:
|
|
494
|
-
inputs:
|
|
495
|
-
- timestamp: '2024-03-05T00:00:00.000Z'
|
|
496
|
-
duration: 300
|
|
497
|
-
name: server-2
|
|
498
|
-
cloud/instance-type: Standard_E64_v3
|
|
499
|
-
cloud/region: france
|
|
500
|
-
cloud/vendor: azure
|
|
501
|
-
cpu/utilization: 15
|
|
502
|
-
grid/carbon-intensity: 500
|
|
503
|
-
- timestamp: '2024-03-05T00:05:00.000Z'
|
|
504
|
-
duration: 300
|
|
505
|
-
name: server-2
|
|
506
|
-
cloud/instance-type: Standard_E64_v3
|
|
507
|
-
cloud/region: france
|
|
508
|
-
cloud/vendor: azure
|
|
509
|
-
cpu/utilization: 78
|
|
510
|
-
grid/carbon-intensity: 500
|
|
511
|
-
- timestamp: '2024-03-05T00:10:00.000Z'
|
|
512
|
-
duration: 300
|
|
513
|
-
name: server-2
|
|
514
|
-
cloud/instance-type: Standard_E64_v3
|
|
515
|
-
cloud/region: france
|
|
516
|
-
cloud/vendor: azure
|
|
517
|
-
cpu/utilization: 16
|
|
518
|
-
grid/carbon-intensity: 500
|
|
519
|
-
- timestamp: '2024-03-05T00:15:00.000Z'
|
|
520
|
-
duration: 300
|
|
521
|
-
name: server-2
|
|
522
|
-
cloud/instance-type: Standard_E64_v3
|
|
523
|
-
cloud/region: france
|
|
524
|
-
cloud/vendor: azure
|
|
525
|
-
cpu/utilization: 6
|
|
526
|
-
grid/carbon-intensity: 500
|
|
527
|
-
outputs:
|
|
528
|
-
- timestamp: '2024-03-05T00:00:00.000Z'
|
|
529
|
-
duration: 300
|
|
530
|
-
name: server-2
|
|
531
|
-
cloud/instance-type: Standard_E64_v3
|
|
532
|
-
cloud/region: france
|
|
533
|
-
cloud/vendor: azure
|
|
534
|
-
cpu/utilization: 14.95
|
|
535
|
-
grid/carbon-intensity: 1719.1647205176753
|
|
536
|
-
vcpus-allocated: 64
|
|
537
|
-
vcpus-total: 64
|
|
538
|
-
memory-available: 432
|
|
539
|
-
physical-processor: >-
|
|
540
|
-
Intel® Xeon® Platinum 8370C,Intel® Xeon® Platinum 8272CL,Intel®
|
|
541
|
-
Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz
|
|
542
|
-
cpu/thermal-design-power: 269.1
|
|
543
|
-
cloud/region-cfe: France
|
|
544
|
-
cloud/region-em-zone-id: FR
|
|
545
|
-
cloud/region-wt-id: FR
|
|
546
|
-
cloud/region-location: Paris
|
|
547
|
-
cloud/region-geolocation: 48.8567,2.3522
|
|
548
|
-
geolocation: 48.8567,2.3522
|
|
549
|
-
cpu/energy: 0.00905914075141129
|
|
550
|
-
carbon: 15.574155178030272
|
|
551
|
-
- timestamp: '2024-03-05T00:05:00.000Z'
|
|
552
|
-
duration: 300
|
|
553
|
-
name: server-2
|
|
554
|
-
cloud/instance-type: Standard_E64_v3
|
|
555
|
-
cloud/region: france
|
|
556
|
-
cloud/vendor: azure
|
|
557
|
-
cpu/utilization: 77.74
|
|
558
|
-
grid/carbon-intensity: 1719.0544893865829
|
|
559
|
-
vcpus-allocated: 64
|
|
560
|
-
vcpus-total: 64
|
|
561
|
-
memory-available: 432
|
|
562
|
-
physical-processor: >-
|
|
563
|
-
Intel® Xeon® Platinum 8370C,Intel® Xeon® Platinum 8272CL,Intel®
|
|
564
|
-
Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz
|
|
565
|
-
cpu/thermal-design-power: 269.1
|
|
566
|
-
cloud/region-cfe: France
|
|
567
|
-
cloud/region-em-zone-id: FR
|
|
568
|
-
cloud/region-wt-id: FR
|
|
569
|
-
cloud/region-location: Paris
|
|
570
|
-
cloud/region-geolocation: 48.8567,2.3522
|
|
571
|
-
geolocation: 48.8567,2.3522
|
|
572
|
-
cpu/energy: 0.020379266251888902
|
|
573
|
-
carbon: 35.0330691407141
|
|
574
|
-
- timestamp: '2024-03-05T00:10:00.000Z'
|
|
575
|
-
duration: 300
|
|
576
|
-
name: server-2
|
|
577
|
-
cloud/instance-type: Standard_E64_v3
|
|
578
|
-
cloud/region: france
|
|
579
|
-
cloud/vendor: azure
|
|
580
|
-
cpu/utilization: 15.946666666666667
|
|
581
|
-
grid/carbon-intensity: 1718.8707708347622
|
|
582
|
-
vcpus-allocated: 64
|
|
583
|
-
vcpus-total: 64
|
|
584
|
-
memory-available: 432
|
|
585
|
-
physical-processor: >-
|
|
586
|
-
Intel® Xeon® Platinum 8370C,Intel® Xeon® Platinum 8272CL,Intel®
|
|
587
|
-
Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz
|
|
588
|
-
cpu/thermal-design-power: 269.1
|
|
589
|
-
cloud/region-cfe: France
|
|
590
|
-
cloud/region-em-zone-id: FR
|
|
591
|
-
cloud/region-wt-id: FR
|
|
592
|
-
cloud/region-location: Paris
|
|
593
|
-
cloud/region-geolocation: 48.8567,2.3522
|
|
594
|
-
geolocation: 48.8567,2.3522
|
|
595
|
-
cpu/energy: 0.009405866514354337
|
|
596
|
-
carbon: 16.16746902589712
|
|
597
|
-
- timestamp: '2024-03-05T00:15:00.000Z'
|
|
598
|
-
duration: 300
|
|
599
|
-
name: server-2
|
|
600
|
-
cloud/instance-type: Standard_E64_v3
|
|
601
|
-
cloud/region: france
|
|
602
|
-
cloud/vendor: azure
|
|
603
|
-
cpu/utilization: 5.98
|
|
604
|
-
grid/carbon-intensity: 1718.6686804277592
|
|
605
|
-
vcpus-allocated: 64
|
|
606
|
-
vcpus-total: 64
|
|
607
|
-
memory-available: 432
|
|
608
|
-
physical-processor: >-
|
|
609
|
-
Intel® Xeon® Platinum 8370C,Intel® Xeon® Platinum 8272CL,Intel®
|
|
610
|
-
Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz
|
|
611
|
-
cpu/thermal-design-power: 269.1
|
|
612
|
-
cloud/region-cfe: France
|
|
613
|
-
cloud/region-em-zone-id: FR
|
|
614
|
-
cloud/region-wt-id: FR
|
|
615
|
-
cloud/region-location: Paris
|
|
616
|
-
cloud/region-geolocation: 48.8567,2.3522
|
|
617
|
-
geolocation: 48.8567,2.3522
|
|
618
|
-
cpu/energy: 0.0054492484351820105
|
|
619
|
-
carbon: 9.365452617417297
|
|
620
|
-
aggregated:
|
|
621
|
-
carbon: 76.1401459620588
|
|
622
|
-
outputs:
|
|
623
|
-
- carbon: 15.574155178030272
|
|
624
|
-
timestamp: '2024-03-05T00:00:00.000Z'
|
|
625
|
-
duration: 300
|
|
626
|
-
- carbon: 35.0330691407141
|
|
627
|
-
timestamp: '2024-03-05T00:05:00.000Z'
|
|
628
|
-
duration: 300
|
|
629
|
-
- carbon: 16.16746902589712
|
|
630
|
-
timestamp: '2024-03-05T00:10:00.000Z'
|
|
631
|
-
duration: 300
|
|
632
|
-
- carbon: 9.365452617417297
|
|
633
|
-
timestamp: '2024-03-05T00:15:00.000Z'
|
|
634
|
-
duration: 300
|
|
635
|
-
aggregated:
|
|
636
|
-
carbon: 76.1401459620588
|
|
637
|
-
outputs:
|
|
638
|
-
- carbon: 22.57047993820384
|
|
639
|
-
timestamp: '2024-03-05T00:00:00.000Z'
|
|
640
|
-
duration: 300
|
|
641
|
-
- carbon: 36.71212369757613
|
|
642
|
-
timestamp: '2024-03-05T00:05:00.000Z'
|
|
643
|
-
duration: 300
|
|
644
|
-
- carbon: 22.63469416910948
|
|
645
|
-
timestamp: '2024-03-05T00:10:00.000Z'
|
|
646
|
-
duration: 300
|
|
647
|
-
- carbon: 13.87483503749007
|
|
648
|
-
timestamp: '2024-03-05T00:15:00.000Z'
|
|
649
|
-
duration: 300
|
|
650
|
-
aggregated:
|
|
651
|
-
carbon: 95.79213284237952
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
### CSV and aggregation
|
|
655
|
-
|
|
656
|
-
The CSV representation of the output data is helpful for intuiting how the aggregation procedure works. What we refer to as "horizontal" aggregation is really an aggregation of the *rows* of the CSV. You can replicate the IF aggregation function by summing the cells in each row of the CSV. Similarly, what we refer to as "vertical" aggregation can be replicated by summing the *columns* in the CSV representation (this is not *exactly* accurate because you have to skip summing both parent nodes and their children, both of which are represented in the CSV, but it is true conceptually).
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
## Groupby
|
|
660
|
-
|
|
661
|
-
Groupby is an IF plugin that reorganizes a tree according to keys provided by the user. This allows users to regroup their observations according to various properties of their application. For example, the following manifest file contains a flat array of observations. This is how you might expect data to arrive from an importer plugin, maybe one that hits a metrics API for a cloud service.
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
```yaml
|
|
665
|
-
name: if-demo
|
|
666
|
-
description: demo pipeline
|
|
667
|
-
graph:
|
|
668
|
-
children:
|
|
669
|
-
my-app:
|
|
670
|
-
pipeline:
|
|
671
|
-
- group-by
|
|
672
|
-
- teads-curve
|
|
673
|
-
config:
|
|
674
|
-
group-by:
|
|
675
|
-
- cloud/region
|
|
676
|
-
- instance-type
|
|
677
|
-
inputs:
|
|
678
|
-
- timestamp: 2023-07-06T00:00
|
|
679
|
-
duration: 300
|
|
680
|
-
instance-type: A1
|
|
681
|
-
cloud/region: uk-west
|
|
682
|
-
cpu-util: 99
|
|
683
|
-
- timestamp: 2023-07-06T05:00
|
|
684
|
-
duration: 300
|
|
685
|
-
instance-type: A1
|
|
686
|
-
cloud/region: uk-west
|
|
687
|
-
cpu-util: 23
|
|
688
|
-
- timestamp: 2023-07-06T10:00
|
|
689
|
-
duration: 300
|
|
690
|
-
instance-type: A1
|
|
691
|
-
cloud/region: uk-west
|
|
692
|
-
cpu-util: 12
|
|
693
|
-
- timestamp: 2023-07-06T00:00 # note this time restarts at the start timstamp
|
|
694
|
-
duration: 300
|
|
695
|
-
instance-type: B1
|
|
696
|
-
cloud/region: uk-west
|
|
697
|
-
cpu-util: 11
|
|
698
|
-
- timestamp: 2023-07-06T05:00
|
|
699
|
-
duration: 300
|
|
700
|
-
instance-type: B1
|
|
701
|
-
cloud/region: uk-west
|
|
702
|
-
cpu-util: 67
|
|
703
|
-
- timestamp: 2023-07-06T10:00
|
|
704
|
-
duration: 300
|
|
705
|
-
instance-type: B1
|
|
706
|
-
cloud/region: uk-west
|
|
707
|
-
cpu-util: 1
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
However, each observation contains an `instance-type` field that varies between observations. There are two instance types being represented in this array of observations. This means there are duplicate entries for the same timestamp in this array. This is the problem that `group-by` solves. You provide `instance-type` as a key to the `group-by` plugin and it extracts the data belonging to the different instances and separates them into independent arrays. The above example would be restructured so that instance types `A1` and `B1` have their own data, as follows:
|
|
711
|
-
|
|
712
|
-
```yaml
|
|
713
|
-
graph:
|
|
714
|
-
children:
|
|
715
|
-
my-app:
|
|
716
|
-
pipeline:
|
|
717
|
-
# - group-by
|
|
718
|
-
- teads-curve
|
|
719
|
-
config:
|
|
720
|
-
group-by:
|
|
721
|
-
groups:
|
|
722
|
-
- cloud/region
|
|
723
|
-
- instance-type
|
|
724
|
-
children:
|
|
725
|
-
A1:
|
|
726
|
-
inputs:
|
|
727
|
-
- timestamp: 2023-07-06T00:00
|
|
728
|
-
duration: 300
|
|
729
|
-
instance-type: A1
|
|
730
|
-
cloud/region: uk-west
|
|
731
|
-
cpu-util: 99
|
|
732
|
-
- timestamp: 2023-07-06T05:00
|
|
733
|
-
duration: 300
|
|
734
|
-
instance-type: A1
|
|
735
|
-
cloud/region: uk-west
|
|
736
|
-
cpu-util: 23
|
|
737
|
-
- timestamp: 2023-07-06T10:00
|
|
738
|
-
duration: 300
|
|
739
|
-
instance-type: A1
|
|
740
|
-
cloud/region: uk-west
|
|
741
|
-
cpu-util: 12
|
|
742
|
-
B1:
|
|
743
|
-
inputs:
|
|
744
|
-
- timestamp: 2023-07-06T00:00
|
|
745
|
-
duration: 300
|
|
746
|
-
instance-type: B1
|
|
747
|
-
cloud/region: uk-east
|
|
748
|
-
cpu-util: 11
|
|
749
|
-
- timestamp: 2023-07-06T05:00
|
|
750
|
-
duration: 300
|
|
751
|
-
instance-type: B1
|
|
752
|
-
cloud/region: uk-east
|
|
753
|
-
cpu-util: 67
|
|
754
|
-
- timestamp: 2023-07-06T10:00
|
|
755
|
-
duration: 300
|
|
756
|
-
instance-type: B1
|
|
757
|
-
cloud/region: uk-east
|
|
758
|
-
cpu-util: 1
|
|
759
|
-
```
|
|
760
|
-
|
|
761
|
-
### Using `group-by`
|
|
762
|
-
|
|
763
|
-
To use `group-by`, you have to initialize it as a plugin and invoke it in a pipeline.
|
|
764
|
-
|
|
765
|
-
The initialization looks as follows:
|
|
766
|
-
|
|
767
|
-
```yaml
|
|
768
|
-
initialize:
|
|
769
|
-
plugins:
|
|
770
|
-
group-by:
|
|
771
|
-
path: 'builtin'
|
|
772
|
-
method: GroupBy
|
|
773
|
-
```
|
|
774
|
-
|
|
775
|
-
You then have to provide config defining which keys to group by in each component. This is done at the component level (i.e. not global config).
|
|
776
|
-
For example:
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
```yaml
|
|
780
|
-
tree:
|
|
781
|
-
children:
|
|
782
|
-
my-app:
|
|
783
|
-
pipeline:
|
|
784
|
-
- group-by
|
|
785
|
-
config:
|
|
786
|
-
group-by:
|
|
787
|
-
group:
|
|
788
|
-
- cloud/region
|
|
789
|
-
- instance-type
|
|
790
|
-
```
|
|
791
|
-
|
|
792
|
-
In the example above, the plugin would regroup the input data for the specific component by `cloud/region` and by `instance-type`.
|
|
793
|
-
|
|
794
|
-
Assuming the values `A1` and `B1` are found for `instance-type` and the values `uk-east` and `uk-west` are found for `cloud/region`, the result of `group-by` would look similar to the following:
|
|
795
|
-
|
|
796
|
-
```yaml
|
|
797
|
-
tree:
|
|
798
|
-
children:
|
|
799
|
-
my-app:
|
|
800
|
-
pipeline:
|
|
801
|
-
- group-by
|
|
802
|
-
config:
|
|
803
|
-
group-by:
|
|
804
|
-
groups:
|
|
805
|
-
- cloud/region
|
|
806
|
-
- instance-type
|
|
807
|
-
children:
|
|
808
|
-
uk-west:
|
|
809
|
-
children:
|
|
810
|
-
A1:
|
|
811
|
-
inputs:
|
|
812
|
-
- timestamp: 2023-07-06T00:00
|
|
813
|
-
duration: 300
|
|
814
|
-
instance-type: A1
|
|
815
|
-
cloud/region: uk-west
|
|
816
|
-
cpu-util: 99
|
|
817
|
-
- timestamp: 2023-07-06T05:00
|
|
818
|
-
duration: 300
|
|
819
|
-
instance-type: A1
|
|
820
|
-
cloud/region: uk-west
|
|
821
|
-
cpu-util: 23
|
|
822
|
-
- timestamp: 2023-07-06T10:00
|
|
823
|
-
duration: 300
|
|
824
|
-
instance-type: A1
|
|
825
|
-
cloud/region: uk-west
|
|
826
|
-
cpu-util: 12
|
|
827
|
-
uk-east:
|
|
828
|
-
children:
|
|
829
|
-
B1:
|
|
830
|
-
inputs:
|
|
831
|
-
- timestamp: 2023-07-06T00:00
|
|
832
|
-
duration: 300
|
|
833
|
-
instance-type: B1
|
|
834
|
-
cloud/region: uk-east
|
|
835
|
-
cpu-util: 11
|
|
836
|
-
- timestamp: 2023-07-06T05:00
|
|
837
|
-
duration: 300
|
|
838
|
-
instance-type: B1
|
|
839
|
-
cloud/region: uk-east
|
|
840
|
-
cpu-util: 67
|
|
841
|
-
- timestamp: 2023-07-06T10:00
|
|
842
|
-
duration: 300
|
|
843
|
-
instance-type: B1
|
|
844
|
-
cloud/region: uk-east
|
|
845
|
-
cpu-util: 1
|
|
846
|
-
```
|
|
847
|
-
|
|
848
|
-
This reorganized data can then be used to feed the rest of a computation pipeline.
|