Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubt on setting the PageSize in Events function. #1725

Closed
akankshadokania opened this issue Nov 27, 2019 · 6 comments
Closed

Doubt on setting the PageSize in Events function. #1725

akankshadokania opened this issue Nov 27, 2019 · 6 comments

Comments

@akankshadokania
Copy link

Hi,
func (m Manager) Events(ctx context.Context, objects []types.ManagedObjectReference, pageSize int32, tail bool, force bool, f func(types.ManagedObjectReference, []types.BaseEvent) error, kind ...string) error {
What is the pageSize generally preferred? And, suppose if I set it to 25 and from vCenter I receive 35 events, is there a way to fetch the older events than those 25 events...the previous 10 events to these 25 events?

@dougm
Copy link
Member

dougm commented Dec 5, 2019

You'll get the updates, but can't go back in history. However, you can use HistoryCollector for that:
https://code.vmware.com/apis/704/vsphere/vim.HistoryCollector.html

There are wrappers in the govmomi 'event' package. The Events() method has the advantage of also working directly against ESX, but HistoryCollector is vCenter only.

As for the page size, it's mainly tuning for memory use and network transfer.

@dougm
Copy link
Member

dougm commented Jan 7, 2020

We need some examples for EventHistoryCollector, but there's a test that'll do for the moment:

c, err := event.NewManager(vc.Client).CreateCollectorForEvents(ctx, spec)

@dougm
Copy link
Member

dougm commented Jan 7, 2020

I was thinking ReadNextEvents would block until there were more events, but looks like that's not the case. Sorry for the confusion, the Events() method actually does use EventHistoryCollector:

collector, err := p.mgr.CreateCollectorForEvents(ctx, filter)

It must have been TaskHistoryCollector that is vCenter only.

@dougm dougm added this to the 0.23 milestone Jan 9, 2020
@dougm dougm modified the milestones: 0.23, 0.24 Jun 11, 2020
@dougm dougm modified the milestones: 0.24, 0.25 Dec 18, 2020
@dougm dougm modified the milestones: 0.25, 0.26 Apr 16, 2021
@dougm dougm modified the milestones: 0.26, 0.27 Jun 4, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2021

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Mark as fresh by adding the comment /remove-lifecycle stale.

@embano1
Copy link
Contributor

embano1 commented Sep 3, 2021

In the upcoming release, this method will be marked deprecated (see #1775)

@dougm dougm modified the milestones: 0.27, 0.28 Oct 15, 2021
@github-actions
Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Mark as fresh by adding the comment /remove-lifecycle stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants