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

Non-standard use of "subject" in CloudEvents Spec #182

Closed
embano1 opened this issue Jun 19, 2020 · 8 comments
Closed

Non-standard use of "subject" in CloudEvents Spec #182

embano1 opened this issue Jun 19, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request wip
Milestone

Comments

@embano1
Copy link
Collaborator

embano1 commented Jun 19, 2020

Is your feature request related to a problem? Please describe.
As of today the use of type and subject in the CloudEvents structured event payload might not conform to what users expect. E.g. "com.vmware.event.router/event" can be considered an abstract event class and the corresponding event used in subject, e.g. VmPoweredOnEvent is not really a subject as per the meaning of the spec.

Describe the solution you'd like
Instead of this:

{
  "id": "08179137-b8e0-4973-b05f-8f212bf5003b",
  "source": "https://vcenter-01:443/sdk",
  "specversion": "1.0",
  "type": "com.vmware.event.router/event ",
  "subject": "VmPoweredOnEvent",
  "time": "2020-02-11T21:29:54.9052539Z"
}

Use:

{
  "id": "08179137-b8e0-4973-b05f-8f212bf5003b",
  "source": "https://vcenter-01:443/sdk",
  "specversion": "1.0",
  "type": "com.vmware.event.router/vmware/vcenter/VmPoweredOnEvent",
  "subject": "vm-01",
  "time": "2020-02-11T21:29:54.9052539Z"
}

Where the syntax for type can be defined as:

com.vmware.event.router/<vendor>/<provider>/<event>

Additional context
Breaking change with an option to provide backward compatibility for some time (deprecation notice).

@embano1 embano1 added the enhancement New feature or request label Jun 19, 2020
@github-actions
Copy link

github-actions bot commented Aug 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale No activity within the last 60 days label Aug 5, 2020
@embano1 embano1 added wip and removed stale No activity within the last 60 days labels Aug 5, 2020
@embano1
Copy link
Collaborator Author

embano1 commented Oct 6, 2020

Figuring out a subject that can be easily constructed across different providers might not be easy. A intermediary solution would be to use the event ID/UUID as the subject.

@embano1
Copy link
Collaborator Author

embano1 commented May 28, 2021

Comparison of CloudEvents generated by the VMware Event Router used currently in this project vs vSphere Sources for
Knative
:

CE Property Type Required Event Router vSphere Sources
ID string yes uuidv4 VC Event Key
Type string yes com.vmware.event.router/[event|eventex|extendedevent] com.vmware.vsphere.[ReflectEventName|EventTypeID].v0
Source string yes vcenter.URI() vcenter.URI()
Subject string no ReflectEventName|EventTypeID (unused)
datacontenttype string no application/json application/xml,application/json
time timestamp no GetEvent().CreatedTime GetEvent().CreatedTime
CE transport encoding n/a n/a configurable (per processor) binary

@vaikas
Copy link

vaikas commented Jun 4, 2021

@embano1 You added the datacontenttype overrides, so at least that field could now be updated for json/xml?
Also, would you mind adding a pointer or example on what ReflectEventName looks like.

@embano1
Copy link
Collaborator Author

embano1 commented Jun 4, 2021

@embano1 You added the datacontenttype overrides, so at least that field could now be updated for json/xml?

Wow, you're fast! Once I'm back on my laptop I'll do as my iPad Github app keeps crashing when I try to edit that comment :D

Also, would you mind adding a pointer or example on what ReflectEventName looks like.

Yeah, sorry for being too brief there. For "core" events such as VmPoweredOnEvent, i.e. those not belonging to EventEx or ExtendedEvent we use go type reflection on the BaseEvent interface to retrieve the event name. That's what I meant there.

@vaikas
Copy link

vaikas commented Jun 4, 2021

Oh no rush :) I was just playing with octobox (👍 so far) and noticed this lol :)

Ok, sweet, thanks!

@embano1
Copy link
Collaborator Author

embano1 commented Jun 24, 2021

Updated the table with the recent changes in the router to be more aligned with VSphereSources. Since the VSphereSources format correctly represents the CloudEvents spec, it makes sense to slowly transition the router event schema (metadata) to the VSphereSources approach.

This would lead to a breaking change for existing users (triggers and code if they use these fields in their functions), so we can do a slow migration:

  1. Communicate the changes upfront to prepare the user base
  2. Change type to what VSphereSources uses but keep subject (as most users trigger on subject in VEBA)
  3. Eventually phase out subject (hoping that most users would have migrated to the type trigger before)

This also requires changes on how the metrics stats are retrieved, e.g. currently based on subject.

@embano1 embano1 added this to the v0.8.0 milestone Mar 29, 2022
@lamw
Copy link
Contributor

lamw commented Jun 27, 2023

#1075

@lamw lamw closed this as completed Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wip
Projects
Status: Done
Development

No branches or pull requests

3 participants