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

Rework attribution options to be specified by container authors #15397

Closed

Conversation

Abe27342
Copy link
Contributor

@Abe27342 Abe27342 commented May 2, 2023

Description

This reworks how options affecting attribution get specified--previous method relied heavily on the host setting things up appropriately. Some changes which I think are in the right direction:

  1. "enabling attribution" needs to be done both at the container-runtime level and at the DDS level.
  2. I've removed config flags--shying away from these seems reasonable as consumers can always inject things like feature flags of their own if they want quicker rollout

Notably, having individualized control at the DDS level controlled by a dataObject's creator seems like the right direction for the future: it's easy to imagine containers which have heterogeneous content involving some SharedStrings that want attribution enabled and other SharedStrings which don't. Making this setting parameterizable via the SharedObject factory satisfies both of those goals. One can even accomplish having the same type of DDS within the same data store with different parameters if enough information about those parameters is persisted in the attributes blob (though that isn't done here, this would require changes to the channel creation flow).

It's probably not ideal that the container author also needs to enable it at the runtime level, but not a huge deal. I also don't feel strongly that that setting should be injected via scope, but since this was already the case for other content, it didn't feel unreasonable.

@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: sharedstring area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: tests Tests to add, test infrastructure improvements, etc public api change Changes to a public API base: main PRs targeted against main branch changeset-present labels May 2, 2023
@Abe27342
Copy link
Contributor Author

Abe27342 commented May 2, 2023

There are still some things to resolve with this before it's in a check-in-able state:

  1. I need to do a full audit of attribution docs/readmes to make sure they're up-to-date.
  2. SharedCell needs to be updated
  3. Unrelated to attribution, our testing setup (and maybe other things which are unknown) needs updates to make 'parameterizable DDSes' make sense. The main issue currently is that describeCompat and variants build a registry of all DDSes using the parameterless getFactory and take the subset of that registry which is referenced by a given test. See note on attribution e2e tests. this creates problems.
  4. I think handling of the DDS's attributes blob could use some more work.

(3) and (4) are obviously the biggest things here.

) {
super(id, dataStoreRuntime, attributes, "fluid_sequence_");

this.loadedDeferred.promise.catch((error) => {
this.logger.sendErrorEvent({ eventName: "SequenceLoadFailed" }, error);
});

let clientOptions = dataStoreRuntime.options;
if (options?.attribution) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like the overall pattern, but it would be nice if we could just smash them all together, rather than just propagating attribution.

maybe something like {...dataStoreRuntime.options, ...options} . i just want to be able to add more later and not have to figure why they don't propagate correctly.

@@ -109,6 +110,10 @@ export interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {
);
}

export interface SequenceOptions {
attribution: IMergeTreeAttributionOptions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if we want to take a firmer stance on what options are, specifically if they can be more than primitive values. probably doesn't need to be solved immediately.

@@ -24,6 +32,8 @@ export class SharedStringFactory implements IChannelFactory {
packageVersion: pkgVersion,
};

public constructor(public readonly options?: SequenceOptions) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of related to my above comment, and your inline comment. an idea, that i'm not sure i even like, is to split what you have, options is only primitives, and a services dictionary/object/something. the policy on options would then indicate the key entry of the services to use. not sure how something like this would propagate through the stack. what i do like if it worked out, is applications could potentially centralize, or share a services registry, but have distinct options objects, without needing to compose objects from the two.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we follow a similar pattern for data store and dds registries, and it works ok.

@@ -343,6 +340,22 @@ export interface IAttributionCollectionSpec<T> {
}>;
}

// @public
export interface IAttributionPolicyFactory {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still need to do a bit of cleanup of API tags and docs in this realm.

Also not totally convinced I want to expose classes for the policy registry elements or have them be self-named, but that's a bit more minor (self-naming is less of a concern for closed-ecosystem set of options, which is what attribution policies currently are. Maybe we open them up in the future but it's pretty easy to shoot yourself in the foot, so I'd rather not if we can get away with it)

@github-actions github-actions bot added the area: examples Changes that focus on our examples label Jun 23, 2023
@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +1.34 KB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 452.56 KB 453.22 KB +679 Bytes
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 243.06 KB 243.06 KB +2 Bytes
loader.js 154.05 KB 154.05 KB +4 Bytes
map.js 46.75 KB 46.75 KB +2 Bytes
matrix.js 146.68 KB 146.69 KB +3 Bytes
odspDriver.js 93.25 KB 93.26 KB +6 Bytes
odspPrefetchSnapshot.js 44.13 KB 44.14 KB +4 Bytes
sharedString.js 163.33 KB 163.99 KB +675 Bytes
sharedTree2.js 249.35 KB 249.35 KB No change
Total Size 1.71 MB 1.71 MB +1.34 KB

Baseline commit: 7981852

Generated by 🚫 dangerJS against 78083dc

@microsoft-github-policy-service
Copy link
Contributor

This PR has been automatically marked as stale because it has had no activity for 60 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: sharedstring area: dds Issues related to distributed data structures area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch public api change Changes to a public API status: stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants