Is there any API for checking the ztn connection status and additionally, getting the trace logs?
Hi @avaneeshramaseshan, Welcome to the community.
OpenZiti API Reference page has the list of APIs that the application [Node.js app using ziti services] can call and make use of.
API guide for node.js SDK has references to APIs for reducing log levels during run time and checking the connection status.
Change logging level: An API named ziti.setLogLevel can be used to dynamically change the logging level.
Ziti Service stats: An API named ziti.serviceAvailable can be used to check if a given Ziti Service is reachable.
setLogLevel does not return any value, and hence I am unable to get an output.
serviceAvailable checks a particular service. However, I need to check the status of my current connection.
Do you have a sample code for the serviceAvailable API using schemeHostPort instead of the serviceName? I am not able to get the callback.
setLogLevel() is used to dynamically adjust the volume of logging that is emitted by the SDK’s internals, and this API has a
void return type. Are you seeking a way to dynamically discover what the logLevel is? If so, please open an issue against the SDK, and we’ll work on adding it.
You say you need to:
check the status of my current connection.
I assume you are referring to the
conn returned to the
onConnect callback used on the
dial API. If so, we do not have a way to query that
conn for its current status. So again, please open an issue against the SDK if you really need that functionality, and we’ll work on adding it.
@avaneeshramaseshan …also please confirm for me that your
onConnect callback is indeed being invoked, and that you have obtained the
conn you are subsequently curious about from that callback.
My objective is to obtain the logs. Is there an API to achieve this?
I have opened an issue - Link to issue for checking whether current status is active
@curt - regarding the onConnect callback, I am using the init API to authenticate my connection. What is the difference between the dial and init APIs?
@avaneeshramaseshan the SDK emits log msgs to stderr. We do not currently provide an API to facilitate the app receiving these log msgs.
Can you tell me a bit more about your use case? That is, if your app had such an API, is there a specific format you’d like the msgs to be provided to you? Also, can you describe how you anticipate your app reacting to the log msgs?
init API is used to authenticate your app onto the Ziti network. Period. It does not make connections to any Ziti
Once your app is authenticated onto the network, then the
dial API is used to make a connection to a given Ziti
Service on the network (i.e. a
Service that the app’s
Identity, used in the
init API, has permission to access). The
onConnect callback on the
dial API is where your code will receive the results of the
dial attempt (i.e. the