Chaffelson / nipyapi

A convenient Python wrapper for Apache NiFi
Other
243 stars 76 forks source link

Unable to add reporting task in nifi using nipyapi #352

Open prashant462 opened 1 month ago

prashant462 commented 1 month ago

Description

I have a usecase where I have to add reporting task (PrometheusReportingTask) using nipyapi , but not getting any method to do that.

What I Did

I tried listing all controller types in nifi env using nipyapi.canvas.list_all_controller_types() but not getting any controller of type PrometheusReportingTask. But using nifi UI I am getting option to add the same.

Urgency

For my production nifi flows I have to implement this, Please let me know If there is any method for adding a PrometheusReportingTask using nipyapi or any workaround for this. @Chaffelson

ottobackwards commented 1 month ago

Can you say how you are calling the code? The parameters to the function? What is the return value? Are you getting an error? Have you tried calling without specifying any parameters?

prashant462 commented 1 month ago

Hi @ottobackwards ,

I called the below method. controller_types = nipyapi.canvas.list_all_controller_types() for controller in controller_types: print(controller.type + " : " + controller.description) print("===============================\n")

The list I am getting is attached. controller_types.txt

ottobackwards commented 1 month ago

From what I can see the PrometheusRecordSink is the only Prometheus service, and it is returned: https://nifi.apache.org/documentation/v1/ I'm not sure this is the right call

ottobackwards commented 1 month ago

I think what you need is the flow api's get_reporting_task_types. This isn't exposed at the canvas layer yet. @Chaffelson ?

prashant462 commented 1 month ago

From what I can see the PrometheusRecordSink is the only Prometheus service, and it is returned: https://nifi.apache.org/documentation/v1/ I'm not sure this is the right call

@ottobackwards, yeah in list of Prometheus services PrometheusRecordSink is only visible there which is not a reporting task.

ottobackwards commented 1 month ago

@prashant462 : https://github.com/Chaffelson/nipyapi/issues/352#issuecomment-2134181916

prashant462 commented 1 month ago

@ottobackwards I tried with nipyapi.nifi.ControllerApi().create_reporting_task() it is working fine, this method not given in nipyapi docs . But already provided in nipyapi code.

ottobackwards commented 1 month ago

What I am saying is that you are using the wrong method to get all the Reporting task type names, it isn' t controller types, it is the get_reporting_task_types.

prashant462 commented 1 month ago

What I am saying is that you are using the wrong method to get all the Reporting task type names, it isn' t controller types, it is the get_reporting_task_types.

okkk , got it . Thanks @ottobackwards for your help