This repository has been archived by the owner on Jul 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(log): Request /response analysis
Closes gravitee-io/issues#568
- Loading branch information
Showing
6 changed files
with
461 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
50 changes: 50 additions & 0 deletions
50
src/main/java/io/gravitee/repository/analytics/query/tabular/TabularQuery.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.repository.analytics.query.tabular; | ||
|
||
import io.gravitee.repository.analytics.query.AbstractQuery; | ||
|
||
/** | ||
* @author David BRASSELY (david.brassely at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class TabularQuery extends AbstractQuery<TabularResponse> { | ||
|
||
private int size = 20; | ||
|
||
private int page = 0; | ||
|
||
@Override | ||
public Class<TabularResponse> responseType() { | ||
return TabularResponse.class; | ||
} | ||
|
||
public int size() { | ||
return size; | ||
} | ||
|
||
void size(int size) { | ||
this.size = size; | ||
} | ||
|
||
public int page() { | ||
return page; | ||
} | ||
|
||
void page(int page) { | ||
this.page = page; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/io/gravitee/repository/analytics/query/tabular/TabularQueryBuilder.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.repository.analytics.query.tabular; | ||
|
||
import io.gravitee.repository.analytics.query.AbstractQueryBuilder; | ||
|
||
/** | ||
* @author David BRASSELY (david.brassely at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class TabularQueryBuilder extends AbstractQueryBuilder<TabularQueryBuilder, TabularQuery> { | ||
|
||
protected TabularQueryBuilder(TabularQuery query) { | ||
super(query); | ||
} | ||
|
||
public static TabularQueryBuilder query() { | ||
return new TabularQueryBuilder(new TabularQuery()); | ||
} | ||
|
||
public TabularQueryBuilder page(int page) { | ||
query.page(page); | ||
return this; | ||
} | ||
|
||
public TabularQueryBuilder size(int size) { | ||
query.size(size); | ||
return this; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/io/gravitee/repository/analytics/query/tabular/TabularResponse.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.repository.analytics.query.tabular; | ||
|
||
import io.gravitee.repository.log.model.Request; | ||
import io.gravitee.repository.analytics.query.response.Response; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author David BRASSELY (david.brassely at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class TabularResponse implements Response { | ||
|
||
private final long total; | ||
|
||
public TabularResponse(long total) { | ||
this.total = total; | ||
} | ||
|
||
private List<Request> requests; | ||
|
||
public List<Request> getRequests() { | ||
return requests; | ||
} | ||
|
||
public void setRequests(List<Request> requests) { | ||
this.requests = requests; | ||
} | ||
|
||
public long getSize() { | ||
return total; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/io/gravitee/repository/log/api/LogRepository.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.repository.log.api; | ||
|
||
import io.gravitee.repository.analytics.AnalyticsException; | ||
import io.gravitee.repository.analytics.query.tabular.TabularQuery; | ||
import io.gravitee.repository.analytics.query.tabular.TabularResponse; | ||
import io.gravitee.repository.log.model.Request; | ||
|
||
/** | ||
* @author David BRASSELY (david.brassely at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public interface LogRepository { | ||
|
||
TabularResponse query(TabularQuery query) throws AnalyticsException; | ||
|
||
Request findById(String requestId) throws AnalyticsException; | ||
} |
Oops, something went wrong.