Comments (5)
The following function shoes the log output, and does not throw an error
def handle(event, context):
print("45\n89")
print(3/0)
return event
Produces logs:
[2020-07-13 14:03:09.577] [INFO] [9527a53ec51111eab60d5e071ba3e3fa] [hello] 45
[2020-07-13 14:03:09.578] [INFO] [9527a53ec51111eab60d5e071ba3e3fa] [hello] 89
[2020-07-13 14:03:09.578] [ERROR] [9527a53ec51111eab60d5e071ba3e3fa] [hello] User code exception: 0
division by zero
Traceback (most recent call last):
File "/opt/mfn/FunctionWorker/python/FunctionWorker.py", line 428, in _fork_and_handle_message
function_output = self._state_utils.exec_function_catch_retry(self._function_runtime, exec_arguments, sapi)
File "/opt/mfn/FunctionWorker/python/StateUtils.py", line 385, in exec_function_catch_retry
ret_value = self._exec_function(runtime, exec_arguments, sapi)
File "/opt/mfn/FunctionWorker/python/StateUtils.py", line 260, in _exec_function
function_output = func(args, sapi)
File "/opt/mfn/workflow/states/hello/hello/hello.py", line 5, in handle
print(3/0)
ZeroDivisionError: division by zero
So fluentbit can handle newlines. Maybe this specific case needs more investigation.
from knix.
is it with empty lines (message key might get optimized?) just a wild guess :)
from knix.
Yeah, maybe.
def handle(event, context):
print("45\n89")
return event
works.
def handle(event, context):
print("45\n\n89")
return event
fails.
The difference is that the printed content has \n\n
.
from knix.
The retrieveAllWorkflows function in the management service now first checks whether the 'message' field exists before using it.
When the content is consisting of multiple lines (e.g., long text file), the empty lines might still get out of order; however, this issue is due to the timestamp field. Not sure whether it is due to the elasticsearch receiving the log line and indexing it at that time and whether we can use another timestamp other than source['asctime'] to determine the order.
from knix.
A few observations:
- empty lines with a just a newline (i.e., '\n') don't seem to be indexed by elasticsearch and/or sent by fluentbit. Possibly related to that, multiple newline characters in one logging statement get translated into one.
print()
was splitting the lines and logging each line separately as defined inMicroFunctionsLogWriter
. In contrast,MicroFunctionsAPI.log()
just logs the entire content in one go. I modfified theprint()
to also log the content in one go. The reasoning is that at the end of the day, there is a singleprint()
call and whether the content contains multiple lines should not matter.- The retrieveAllWorkflowsLogs now returns output log with source['timestamp'] from the elasticsearch result, which is used by the GUI to sort the statements. This is to help with the cases where source['asctime'] did not have enough precision. With the implementation of 2), this probably won't have much effect; however, I think it is better with this. The progress log stays currently as it was before.
from knix.
Related Issues (20)
- CentOS support for ansible deployments HOT 2
- Caching of downloaded function dependencies
- Shutting down sandboxes may hang HOT 5
- Upgrading KNIX breaks the datalayer HOT 1
- workflow logs not available due to elasticsearch sharding problem HOT 1
- test asl_Map hangs with maxconcurrency values != 0 HOT 3
- allow user-supplied data be included in the trigger from TriggersFrontend
- bare metal installation fails due to missing dependencies HOT 22
- error when deploy the knix on a host machine HOT 5
- Does it mean I deploy successful? HOT 1
- error when workflow.excute. requests.exceptions.HTTPError: 405 Client Error: Not Allowed for url: http://XXXX:32777 HOT 10
- knix can not support parallel states. HOT 6
- Error when executing java function with maven dependency of Gson HOT 1
- error[E0658]: use of unstable library feature 'renamed_spin_loop' HOT 9
- 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_ssh_host' HOT 7
- update riak build scripts to use a newer Ubuntu image HOT 3
- Triggers API object update for Java (storage, message queues, timers) HOT 5
- Recovery manager
- KNIX GPU monitoring/accounting capabilities
- Execution log entries get disordered HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knix.