Feature Request: Adding optional information to the info endpoint.
mikand13 opened this issue ยท 11 comments
In our infrastructure we use custom elements of the info endpoint for among other things grafana links. Could you add a function for registering custom fields in the info endpoint?
Hi @mikand13, I'm glad you are asking, because I think what you are asking for is already supported by Pyctuator but isn't documented too good - Pyctuator already lets you to provide a JSON value that's included in the registration.
Please see the comment in https://github.com/SolarEdgeTech/pyctuator/blob/master/pyctuator/pyctuator.py#L76 .
An example can be found at
pyctuator/tests/fast_api_test_server.py
Line 30 in a1e8ade
Can you please try it out and let us know how did it go.
Thanks,
Michael
Ah, nice, will check!
@mikand13 I'm closing this issue for now.
Please re-open with additional info if you need something different.
Thanks
Hi, i didnt have a chance to test this until now. Been on vacation. As I understand it I would expect this to produce values in the /info endpoint?
metadata=dict(
serviceLinks=dict(
metrics="url here"
),
podLinks=dict(
metrics="url here"
)
)
Cannot find those values in the info endpoint
Should be relatively easy to expose it in AppInfo?
AppInfo(app=AppDetails(name=app_name, description=app_description)),
Hi @mikand13,
While its possible to add an untyped parameter to Pyctuator
that will be copied "as is" to the JSON returned from the /actuator/info
- I prefer to follow our convention of declaring all the types.
Can you point me to the documentation of spring-actuator (or code) explaining what are the supported attribute so I can evaluate how bad it would be to explicitly support all of them.
Thanks,
Micahel
https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints
2.10.2
Generally a direct manipulation of the json output.
Ok, reopening the ticket - will post a suggestion soon.
Testing this I added the info at the root of the /pyctuator/info
URI so in SBA it looks like this:
The JSON is:
{
"app": {
"description": "Demonstrate Spring Boot Admin Integration with Flask",
"name": "Flask Pyctuator"
},
"podLinks": {
"metrics": [
"http://xyz/pod/metrics/memory",
"http://xyz/pod/metrics/cpu"
]
},
"serviceLinks": {
"metrics": "http://xyz/service/metrics"
}
}
The change in Pyctuator initialization is:
Pyctuator(
app,
"Flask Pyctuator",
app_url=f"http://{example_app_address}:5000",
pyctuator_endpoint_url=f"http://{example_app_address}:5000/pyctuator",
registration_url=f"http://{example_sba_address}:8080/instances",
app_description="Demonstrate Spring Boot Admin Integration with Flask",
additional_app_info=dict(
serviceLinks=dict(
metrics="http://xyz/service/metrics"
),
podLinks=dict(
metrics=["http://xyz/pod/metrics/memory","http://xyz/pod/metrics/cpu"]
)
)
)
@mikand13 is this what you were looking for?
Looks perfect to me ๐
Please upgrade to v0.14.0