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

chore(log/docs): improve error log, docs #7239

Merged
merged 2 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
Copy link
Contributor

Choose a reason for hiding this comment

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

concern: adding the urn to exceptionmessages, can leak PII

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The URN in question is passed in as input parameter. So the caller already has knowledge of the URN and thus the PII. The URN is being logged few lines above either way. It just makes it possible to connect the URN with the exception.

}
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