Skip to content
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ tabpy-server/tabpy_server/staging

# VS Code
*.code-workspace
.vscode/

# etc
setup.bat
Expand Down
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"git.enabled": true,
"files.exclude": {
"**/__pycache__": true,
"**/.pytest_cache": true
},
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true
}
40 changes: 40 additions & 0 deletions docs/server-config.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# TabPy Server Configuration Instructions

<!-- markdownlint-disable MD004 -->

<!-- toc -->

- [Configuring HTTP vs HTTPS](#configuring-http-vs-https)
Expand All @@ -10,8 +11,11 @@
* [Adding an Account](#adding-an-account)
* [Updating an Account](#updating-an-account)
* [Deleting an Account](#deleting-an-account)
- [Logging](#logging)
* [Request Context Logging](#request-context-logging)

<!-- tocstop -->

<!-- markdownlint-enable MD004 -->

Default settings for TabPy may be viewed in the
Expand Down Expand Up @@ -115,3 +119,39 @@ will be generated and displayed in the command line.

To delete an account open password file in any text editor and delete the
line with the user name.

## Logging

Logging for TabPy is implemented with standart Python logger and can be configured
as explained in Python documentation at
[Logging Configuration page](https://docs.python.org/3.6/library/logging.config.html).

Default config proveded with TabPy is
[`tabpy-server/tabpy_server/common/default.conf`](tabpy-server/tabpy_server/common/default.conf)
and has configuration for console and file loggers. With changing the config
user can modify log level, format of the logges messages and add or remove
loggers.

### Request Context Logging

For extended logging (e.g. for auditing purposes) additional logging can be turned
Copy link
Contributor

Choose a reason for hiding this comment

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

I would maybe say "additional logging details"

on with setting `TABPY_LOG_DETAILS` configuration file parameter to `true`.

With the feature on additional information is logged for HTTP requests: caller ip,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be useful to say specifically that the client is Tableau/Tableau Server to make users aware that this will log usernames from Tableau Server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll update the text together with the example below.

URL, client infomation (Tableau Desktop\Server), Tableau user name (for Tableau Server)
and TabPy user name as shown in the example below:

<!-- markdownlint-disable MD040 -->
```
2019-04-17,15:20:37 [INFO] (evaluation_plane_handler.py:evaluation_plane_handler:86):
::1 calls POST http://localhost:9004/evaluate,
Client: Tableau Server 2019.2,
Tableau user: ogolovatyi,
TabPy user: user1
function to evaluate=def _user_script(tabpy, _arg1, _arg2):
res = []
for i in range(len(_arg1)):
res.append(_arg1[i] * _arg2[i])
return res
```
<!-- markdownlint-enable MD040 -->
2 changes: 1 addition & 1 deletion tabpy-server/server_tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from unittest.mock import patch, call



def assert_raises_runtime_error(message, fn, args={}):
try:
fn(*args)
Expand Down Expand Up @@ -96,6 +95,7 @@ def test_config_file_present(self, mock_os, mock_path_exists,
self.assertEqual(app.settings['transfer_protocol'], 'http')
self.assertTrue('certificate_file' not in app.settings)
self.assertTrue('key_file' not in app.settings)
self.assertEqual(app.settings['log_request_context'], False)

os.remove(config_file.name)

Expand Down
2 changes: 1 addition & 1 deletion tabpy-server/server_tests/test_evaluation_plane_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_valid_creds_pass(self):

def test_null_request(self):
response = self.fetch('')
self.assertEqual(599, response.code)
self.assertEqual(404, response.code)

def test_script_not_present(self):
response = self.fetch(
Expand Down
3 changes: 2 additions & 1 deletion tabpy-server/server_tests/test_service_info_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import os
from tabpy_server.app.app import TabPyApp
from tabpy_server.app.SettingsParameters import SettingsParameters
import tempfile
from tornado.testing import AsyncHTTPTestCase
from unittest.mock import patch
Expand All @@ -12,7 +13,7 @@ def _create_expected_info_response(settings, tabpy_state):
'description': tabpy_state.get_description(),
'creation_time': tabpy_state.creation_time,
'state_path': settings['state_file_path'],
'server_version': settings['server_version'],
'server_version': settings[SettingsParameters.ServerVersion],
'name': tabpy_state.name,
'versions': settings['versions']
}
Expand Down
198 changes: 0 additions & 198 deletions tabpy-server/server_tests/test_validate_credentials.py

This file was deleted.

2 changes: 2 additions & 0 deletions tabpy-server/tabpy_server/app/ConfigParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ class ConfigParameters:
TABPY_CERTIFICATE_FILE = 'TABPY_CERTIFICATE_FILE'
TABPY_KEY_FILE = 'TABPY_KEY_FILE'
TABPY_PWD_FILE = 'TABPY_PWD_FILE'
TABPY_LOG_DETAILS = 'TABPY_LOG_DETAILS'
TABPY_STATIC_PATH = 'TABPY_STATIC_PATH'
14 changes: 14 additions & 0 deletions tabpy-server/tabpy_server/app/SettingsParameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class SettingsParameters:
'''
Application (TabPyApp) settings names
'''
TransferProtocol = 'transfer_protocol'
Port = 'port'
ServerVersion = 'server_version'
UploadDir = 'upload_dir'
CertificateFile = 'certificate_file'
KeyFile = 'key_file'
StateFilePath = 'state_file_path'
ApiVersions = 'versions'
LogRequestContext = 'log_request_context'
StaticPath = 'static_path'
Loading