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

Specifies int type for endpoint_id get params in routes #452

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
14 changes: 7 additions & 7 deletions flask_monitoringdashboard/views/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_overview():
return jsonify(get_endpoint_overview(session))


@blueprint.route('/api/users/<endpoint_id>')
@blueprint.route('/api/users/<int:endpoint_id>')
@secure
def users(endpoint_id):
"""
Expand All @@ -54,7 +54,7 @@ def users(endpoint_id):
return jsonify(dicts)


@blueprint.route('/api/ip/<endpoint_id>')
@blueprint.route('/api/ip/<int:endpoint_id>')
@secure
def ips(endpoint_id):
"""
Expand Down Expand Up @@ -135,7 +135,7 @@ def set_rule():
return 'OK'


@blueprint.route('/api/endpoint_info/<endpoint_id>')
@blueprint.route('/api/endpoint_info/<int:endpoint_id>')
@secure
def endpoint_info(endpoint_id):
"""
Expand All @@ -154,15 +154,15 @@ def endpoint_info(endpoint_id):
return jsonify(get_endpoint_details(session, endpoint_id))


@blueprint.route('api/endpoint_status_code_distribution/<endpoint_id>')
@blueprint.route('api/endpoint_status_code_distribution/<int:endpoint_id>')
@secure
def endpoint_status_code_distribution(endpoint_id):
post_to_back_if_telemetry_enabled(**{'name': f'endpoint_status_code_distribution/{endpoint_id}'})
with session_scope() as session:
return jsonify(get_status_code_distribution(session, endpoint_id))


@blueprint.route('api/endpoint_status_code_summary/<endpoint_id>')
@blueprint.route('api/endpoint_status_code_summary/<int:endpoint_id>')
@secure
def endpoint_status_code_summary(endpoint_id):
post_to_back_if_telemetry_enabled(**{'name': f'endpoint_status_code_summary/{endpoint_id}'})
Expand All @@ -176,7 +176,7 @@ def endpoint_status_code_summary(endpoint_id):
return jsonify(result)


@blueprint.route('api/endpoint_versions/<endpoint_id>', methods=['POST'])
@blueprint.route('api/endpoint_versions/<int:endpoint_id>', methods=['POST'])
@secure
def endpoint_versions(endpoint_id):
post_to_back_if_telemetry_enabled(**{'name': f'endpoint_versions/{endpoint_id}'})
Expand All @@ -186,7 +186,7 @@ def endpoint_versions(endpoint_id):
return jsonify(get_endpoint_versions(session, endpoint_id, versions))


@blueprint.route('/api/endpoint_users/<endpoint_id>', methods=['POST'])
@blueprint.route('/api/endpoint_users/<int:endpoint_id>', methods=['POST'])
@secure
def endpoint_users(endpoint_id):
post_to_back_if_telemetry_enabled(**{'name': f'endpoint_users/{endpoint_id}'})
Expand Down
6 changes: 3 additions & 3 deletions flask_monitoringdashboard/views/outlier.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
from flask_monitoringdashboard import blueprint


@blueprint.route('/api/num_outliers/<endpoint_id>')
@blueprint.route('/api/num_outliers/<int:endpoint_id>')
@secure
def num_outliers(endpoint_id):
post_to_back_if_telemetry_enabled(**{'name': f'num_outliers/{endpoint_id}'})
with session_scope() as session:
return jsonify(count_outliers(session, endpoint_id))


@blueprint.route('/api/outlier_graph/<endpoint_id>')
@blueprint.route('/api/outlier_graph/<int:endpoint_id>')
@secure
def outlier_graph(endpoint_id):
post_to_back_if_telemetry_enabled(**{'name': f'outlier_graph/{endpoint_id}'})
with session_scope() as session:
return jsonify(get_outlier_graph(session, endpoint_id))


@blueprint.route('/api/outlier_table/<endpoint_id>/<offset>/<per_page>')
@blueprint.route('/api/outlier_table/<int:endpoint_id>/<offset>/<per_page>')
@secure
def outlier_table(endpoint_id, offset, per_page):
post_to_back_if_telemetry_enabled(**{'name': f'outlier_table/{endpoint_id}'})
Expand Down
6 changes: 3 additions & 3 deletions flask_monitoringdashboard/views/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
from flask_monitoringdashboard.database.count import count_profiled_requests


@blueprint.route('/api/num_profiled/<endpoint_id>')
@blueprint.route('/api/num_profiled/<int:endpoint_id>')
@secure
def num_profiled(endpoint_id):
post_to_back_if_telemetry_enabled(**{'name': f'num_profiled/{endpoint_id}'})
with session_scope() as session:
return jsonify(count_profiled_requests(session, endpoint_id))


@blueprint.route('/api/profiler_table/<endpoint_id>/<offset>/<per_page>')
@blueprint.route('/api/profiler_table/<int:endpoint_id>/<offset>/<per_page>')
@secure
def profiler_table(endpoint_id, offset, per_page):
post_to_back_if_telemetry_enabled(**{'name': f'profiled_table/{endpoint_id}'})
with session_scope() as session:
return jsonify(get_profiler_table(session, endpoint_id, offset, per_page))


@blueprint.route('/api/grouped_profiler/<endpoint_id>')
@blueprint.route('/api/grouped_profiler/<int:endpoint_id>')
@secure
def grouped_profiler(endpoint_id):
post_to_back_if_telemetry_enabled(**{'name': f'grouped_profiler/{endpoint_id}'})
Expand Down
2 changes: 1 addition & 1 deletion flask_monitoringdashboard/views/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def num_requests(start_date, end_date):


@blueprint.route('/api/hourly_load/<start_date>/<end_date>')
@blueprint.route('/api/hourly_load/<start_date>/<end_date>/<endpoint_id>')
@blueprint.route('/api/hourly_load/<start_date>/<end_date>/<int:endpoint_id>')
@secure
# both days must be in the form: yyyy-mm-dd
def hourly_load(start_date, end_date, endpoint_id=None):
Expand Down
6 changes: 3 additions & 3 deletions flask_monitoringdashboard/views/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


@blueprint.route('/api/versions')
@blueprint.route('/api/versions/<endpoint_id>')
@blueprint.route('/api/versions/<int:endpoint_id>')
@secure
def versions(endpoint_id=None):
"""
Expand Down Expand Up @@ -56,7 +56,7 @@ def multi_version():
return jsonify(get_multi_version_data(session, endpoints, versions))


@blueprint.route('/api/version_user/<endpoint_id>', methods=['POST'])
@blueprint.route('/api/version_user/<int:endpoint_id>', methods=['POST'])
@secure
def version_user(endpoint_id):
"""
Expand Down Expand Up @@ -87,7 +87,7 @@ def version_user(endpoint_id):
return jsonify(get_version_user_data(session, endpoint_id, versions, users))


@blueprint.route('/api/version_ip/<endpoint_id>', methods=['POST'])
@blueprint.route('/api/version_ip/<int:endpoint_id>', methods=['POST'])
@secure
def version_ip(endpoint_id):
"""
Expand Down