Splunk Search

accumulator widget calls endpoint twice

jguarini
Path Finder

can someone explain why my custom endpoint gets called twice for the accumulator widget in my custom setup.xml? And possibly how to get it called only once? I have not seen this behavior with the select widget, just the accumulator widget.

thanks

Tags (1)

jguarini
Path Finder

ok, so I have figured out why the endpoint gets called more than once.

short story: there are calls in the accumulator template that indirectly call the endpoint multiple times

long story:

In the accumulator.html template there is a call to a generator function (post_option found in eai.py) that makes the call to the endpoint. Each time this generator is called it does a getEntity() call.

the generator has this form

 element['options']

Commenting out the first call results in a single call to the endpoint. The reason I asked this question in the first place is that each of these calls could be expensive, both in terms of doing what ever the endpoint does and the user experience in terms of page render times. Since the call is made twice, and in my case it takes approximately 13s to return results, the user has to wait a minimum of 26s for the page to render (actually it's longer than this but I am not including the time it takes for the back-end to render all the results, button, text inputs, etc.).

What I have found through my limited testing is that converting all but the first generator call to use the results from the first call reduces the number of calls to the endpoint to 1 and the setup page still has the same data presented as it should. ie. selected elements are selected when updating an existing configuration.

Looks like I need to open an enhancement request to get the number of calls to the generator reduced, if possible.

LukeMurphey
Champion

I have observed similar behavior with some of my apps (though I didn't use an accumulator widget). I believe this is some sort of defect. I escalated this to Splunk a few months ago and I know they did some work to reduce the number of calls. I don't believe this fix has yet been released yet though.

BTW: For those who were a little lost on what an accumulator widget is: it is a UI pattern consisting of two lists where you select items you want to include from another list. Otherwise known as "the thing where you have two boxes and you can move things in between".

LukeMurphey
Champion

Do you have a snippet of code I could look at? I would like to reproduce this and see if I can figure out what is going on and if this is the same issue. Might help get some leverage to get this fixed if your issue isn't the same as mine.

0 Karma

jguarini
Path Finder

sorry had to double post to get around the char limit 😉

0 Karma

jguarini
Path Finder

At first I thought it might be one call for unselected and another to get the selected objects, but I haven't been able to find anything that differentiates the two calls. So far they appear to be identical calls. Still digging around in some of the .py and .js files to see what is actually triggering the second call. Also thought it could of been due to the "onChange" trigger, but removing that logic still resulted in two calls.

thanks for the confirmation that it's happening not just to me.

0 Karma

jguarini
Path Finder

hmm, well that sucks if it happens in other areas as well. I've verified it doesn't happen with the selector widget (changed accumulator to selector and observed the number of calls to the endpoint). I hope they fix this or have some documentation as to why it needs to make the call twice.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...