Skip to content

Commit

Permalink
chore(log/docs): improve error log, docs (datahub-project#7239)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored and Oleg Ruban committed Feb 28, 2023
1 parent 2ca8095 commit 446fddc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
5 changes: 5 additions & 0 deletions docs-website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ module.exports = {
label: "Rest.li API",
id: "docs/api/restli/restli-overview",
},
{
type: "doc",
label: "Restore Indices",
id: "docs/api/restli/restore-indices",
},
{
type: "doc",
label: "Aspect Versioning and Rest.li Modeling",
Expand Down
19 changes: 19 additions & 0 deletions docs/api/restli/restore-indices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Restore Indices Endpoint

You can do a HTTP POST request to `/gms/aspects?action=restoreIndices` endpoint with the `urn` as part of JSON Payload to restore indices for the particular URN.

```
curl --location --request POST 'https://demo.datahubproject.io/api/gms/aspects?action=restoreIndices' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"urn": "YOUR_URN"
}'
```

The supported parameters are
- `urn` - Optionl URN string
- `aspect` - Optional Aspect string
- `urnLike` - Optional string regex to match URNs
- `start` - Optional integer to decide which rows number of sql store to restore
- `batchSize` - Optional integer to decide how many rows to restore
11 changes: 1 addition & 10 deletions docs/how/restore-indices.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,4 @@ Once the job completes, your indices will have been restored.

## Through API

You can do a HTTP POST request to `/gms/aspects?action=restoreIndices` endpoint with the `urn` as part of JSON Payload to restore indices for the particular URN.

```
curl --location --request POST 'https://demo.datahubproject.io/api/gms/aspects?action=restoreIndices' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"urn": "YOUR_URN"
}'
```
See [Restore Indices API](../api/restli/restore-indices.md).
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public Task<AnyRecord> get(@Nonnull String urnStr, @QueryParam("aspect") @Option
return RestliUtil.toTask(() -> {
final VersionedAspect aspect = _entityService.getVersionedAspect(urn, aspectName, version);
if (aspect == null) {
throw RestliUtil.resourceNotFoundException();
throw RestliUtil.resourceNotFoundException(String.format("Did not find urn: %s aspect: %s version: %s", urn, aspectName, version));
}
return new AnyRecord(aspect.data());
}, MetricRegistry.name(this.getClass(), "get"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public Task<AnyRecord> get(@Nonnull String urnStr,
aspectNames == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(aspectNames));
final Entity entity = _entityService.getEntity(urn, projectedAspects);
if (entity == null) {
throw RestliUtil.resourceNotFoundException();
throw RestliUtil.resourceNotFoundException(String.format("Did not find %s", urnStr));
}
return new AnyRecord(entity.data());
}, MetricRegistry.name(this.getClass(), "get"));
Expand Down

0 comments on commit 446fddc

Please sign in to comment.