Repository navigation
Feat/computed attributes - #21
Merged
Merged
Conversation
Legacy computed attributes (attr.comp.X + label.comp.X) are fetched in the
metrics step, translated to Cloud computedAttribute entities
(SELECT CASE WHEN SUM({metric/..}) .. END BY {label/..} ALL OTHER) and
deployed between plain metrics and metrics that reference them.
Metrics, insights and dashboards now reference them as
{computed_attribute/label.comp.X} / type "computedAttribute".
risk: low
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dashboard-permissions gets --include-metrics / --include-insights: Legacy author -> Cloud createdBy and Legacy contributor -> Cloud modifiedBy are set in the workspace layout for metrics and insights (no permissions). Dashboards now also get modifiedBy from contributor instead of author. risk: low Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two features for the Legacy → Cloud migration:
dashboard-permissionscan now setcreatedBy/modifiedByon metrics and insights too, not only on dashboards.1. Computed attributes (
c5cd9c9)Legacy CA =
attr.comp.X+label.comp.X. Each one becomes a CloudcomputedAttributeentity with idlabel.comp.X:metrics/computed_attribute.py, new):reldefinitions are parsed with a strict grammar: one metric, numeric thresholds, literal bucket labels. A CA that does not match is logged ascannot be migratedand skipped, and the run continues.workflows/migrate_metrics.py): plain metrics → computed attributes → metrics that reference a CA. CA creation uses the same create /--overwrite-existingsemantics as other objects (ComputedAttributeCreationStrategy).computed_attribute/…/"type": "computedAttribute"instead oflabel:content_tree_modifier.py)COUNT(attr.comp.X)measures (cloud_insight.py)filter_context.py) and drills (drill_converter.py)IdMappingsresolvesattr.comp.*/label.comp.*even without a mapping row. The metrics step also writescomputed_attribute_mappings.csv.cloud_failed_computed_attributes.jsonandcloud_skipped_computed_attributes.json. With--dump-legacy/--dump-cloud, alsolegacy_computed_attributes.jsonandcloud_computed_attributes.json.Requirements and limitations (also in the README)
enableComputedAttributesfeature flag on the parent and on every child workspace where the migration runs; the flag is not inherited.GET …/computedAttributesreturns 400 ("Feature 'enableComputedAttributes' is not enabled"), so themetricsstep fails for that workspace, even when it has no CA content.SUM(). This is exact for additive metrics. For metrics that are already averages (e.g. Avg Wait Time, Avg Agent Handle Time), bucket values may differ from Legacy and should be checked visually.2. Creator/modifier of metrics and insights (
e6991ec)dashboard-permissionsgets--include-metricsand--include-insights. Legacyauthor→ CloudcreatedBy, Legacycontributor→ CloudmodifiedBy, written through the workspace layout. Metrics and insights have no permissions, so only these two fields change. The objects are read frommetric_mappings.csv/insight_mappings.csv(--metric-mapping-file/--insight-mapping-file).modifiedByfrom the Legacycontributorinstead ofauthor.Testing
pytest, 119 passed. New tests:tests/test_computed_attributes.py: CA translation, unsupported definitions, mappingswith_computed_attribute_*)tests/test_layout_manager.py: createdBy / modifiedBy for metrics and insights