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

feat: add config metadata to object store results #75

Merged
merged 2 commits into from
Oct 22, 2021

Conversation

aaron-steinfeld
Copy link
Contributor

Description

This change updates the object store abstractions to return more metadata with results such as timestamps (and eventually could include things like version, last updated by etc.). These are stored and returned, but not exposed currently. This includes a clarifying terminology change, referring to the raw config as "data" while the full config with metadata as "object". Open to other names if anyone has suggestions.

Note: I did this as a breaking change for object store apis to avoid duplicate functionality, which is acceptable as this is not a published artifact.

Testing

Added and updated UTs. Ran Integration tests.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

breaking change for object store apis
@github-actions

This comment has been minimized.

@codecov
Copy link

codecov bot commented Oct 20, 2021

Codecov Report

Merging #75 (7157f9d) into main (91b1b34) will increase coverage by 0.87%.
The diff coverage is 92.45%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main      #75      +/-   ##
============================================
+ Coverage     84.27%   85.15%   +0.87%     
- Complexity      286      305      +19     
============================================
  Files            36       38       +2     
  Lines          1418     1495      +77     
  Branches         45       45              
============================================
+ Hits           1195     1273      +78     
+ Misses          194      191       -3     
- Partials         29       31       +2     
Flag Coverage Δ
integration 85.15% <92.45%> (+0.87%) ⬆️
unit 84.34% <92.45%> (+0.95%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...e/alerting/config/service/EventConditionStore.java 73.33% <ø> (ø)
...rule/config/service/LabelApplicationRuleStore.java 70.00% <ø> (ø)
...rg/hypertrace/label/config/service/LabelStore.java 70.00% <ø> (ø)
...ation/config/service/NotificationChannelStore.java 73.33% <ø> (ø)
...fication/config/service/NotificationRuleStore.java 73.33% <ø> (ø)
...race/config/objectstore/IdentifiedObjectStore.java 87.70% <77.50%> (+3.22%) ⬆️
...ertrace/config/objectstore/DefaultObjectStore.java 77.61% <92.30%> (ø)
...ypertrace/config/objectstore/ConfigObjectImpl.java 94.44% <94.44%> (ø)
...config/objectstore/ContextualConfigObjectImpl.java 96.42% <96.42%> (ø)
...onfig/service/EventConditionConfigServiceImpl.java 81.81% <100.00%> (+1.49%) ⬆️
... and 6 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 91b1b34...7157f9d. Read the comment docs.


public Optional<T> getObject(RequestContext context) {
public Optional<T> getData(RequestContext context) {
Copy link
Contributor

@saxenakshitiz saxenakshitiz Oct 21, 2021

Choose a reason for hiding this comment

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

The caller may require creation timestamp in response of get call. Can we just return same ConfigObject here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not without introducing new grpc APIs - the original design of config service expected much more hierarchical config usage, so get (unlike upsert/delete/getAll) takes in any number of contexts and returns a merged result. That merged result has no associated context or metadata, since it may be a merge of multiple entries.

If we do have the need for timestamp on the singular get, we can introduce a getByContext rpc or something similar and then update this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. I have never understood the merge usecase. However I agree, we can add another get call to return the data with timestamps. Can we add that call now or if need arises?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd wait until the need arises, since it's purely additive to what we have here.

The merge use case is, for example - imagine fetching a config for an api where we may have some tenant-wide config, some service level config, and some api level config. We'd want to return a merged result conceptually like:

Config getConfigForApi() {
  return apiConfig.withDefaultValuesFrom(serviceConfig.withDefaultValuesFrom(tenantConfig));
}

@github-actions

This comment has been minimized.

@aaron-steinfeld aaron-steinfeld merged commit 7f85265 into main Oct 22, 2021
@aaron-steinfeld aaron-steinfeld deleted the more-metadata branch October 22, 2021 17:58
@github-actions
Copy link

Unit Test Results

21 files  ±0  21 suites  ±0   42s ⏱️ +3s
77 tests ±0  77 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 7f85265. ± Comparison against base commit 91b1b34.

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.

2 participants