Resource
EventGroupMetadataDescriptor
The metadata message descriptor of anEventGroup.Metadata. This metadata is used to describe the contents of an EventGroup without needing a direct dependency on it.
See Self-describing Messages: https://protobuf.dev/programming-guides/techniques/#self-description
Resource name pattern: dataProviders/{data_provider}/eventGroupMetadataDescriptors/{event_group_metadata_descriptor}
Resource name identifier.
FileDescriptorSet including the FileDescriptorProto of the metadata message and the transitive closure of its dependencies.This may exclude FileDescriptorProtos for protobuf well-known types (see https://protobuf.dev/reference/protobuf/google.protobuf/).Methods
GetEventGroupMetadataDescriptor
Returns theEventGroupMetadataDescriptor with the specified resource name.
Request
Resource name of the EventGroupMetadataDescriptor.Format:
dataProviders/{data_provider}/eventGroupMetadataDescriptors/{event_group_metadata_descriptor}EventGroupMetadataDescriptor resource.
Example
CreateEventGroupMetadataDescriptor
Creates (registers) aEventGroupMetadataDescriptor defined in the specified DataProvider’s system.
Request
Resource name of the parent
DataProvider.Format: dataProviders/{data_provider}The
EventGroupMetadataDescriptor to create.The name field will be ignored, and the system will assign an ID.Required fields:descriptor_set: FileDescriptorSet containing the metadata message definition
Unique identifier for this request.Using the protobuf type URL is recommended.If specified, the request will be idempotent. See https://google.aip.dev/155.
EventGroupMetadataDescriptor resource.
Example
- The
descriptor_setshould include the complete type definition including all dependencies. - The
request_idshould ideally be the protobuf type URL for consistency. - The descriptor set enables self-describing metadata without compile-time dependencies.
UpdateEventGroupMetadataDescriptor
Updates an existingEventGroupMetadataDescriptor. Results in a PERMISSION_DENIED error if the authenticated user does not have access to the EventGroupMetadataDescriptor. Results in a NOT_FOUND error if the specified EventGroupMetadataDescriptor does not exist.
Request
The
EventGroupMetadataDescriptor to update. The name field is used to identify the resource to update.Note: This is a full replacement update, not a partial update.EventGroupMetadataDescriptor resource.
Example
- This performs a full replacement update.
- Partial updates are not supported.
- The
namefield identifies which descriptor to update. - Use this to update the descriptor set when your metadata schema changes.
BatchGetEventGroupMetadataDescriptors
Batch getsEventGroupMetadataDescriptors. Results in a NOT_FOUND error if any of the specified EventGroupMetadataDescriptors does not exist.
Request
Resource name of the parent
DataProvider.Format: dataProviders/{data_provider}The resource names of
EventGroupMetadataDescriptors to retrieve.The
EventGroupMetadataDescriptor resources.ListEventGroupMetadataDescriptors
ListsEventGroupMetadataDescriptors. Results in a PERMISSION_DENIED error if attempting to list EventGroupMetadataDescriptors that the authenticated user does not have access to.
Request
Resource name of the parent
DataProvider. The wildcard ID (-) may be used in place of the DataProvider ID to list across DataProviders.Formats:dataProviders/{data_provider}- List for specific DataProviderdataProviders/-- List across all DataProviders
The maximum number of
EventGroupMetadataDescriptors to return. The service may return fewer than this value.If unspecified, at most 50 EventGroupMetadataDescriptors will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.A token from a previous call, specified to retrieve the next page. See https://aip.dev/158.
The
EventGroupMetadataDescriptor resources.A token that can be specified in a subsequent call to retrieve the next page. See https://aip.dev/158.
Self-Describing Metadata
Concept
EventGroupMetadataDescriptors enable self-describing metadata using Protocol Buffers’ descriptor mechanism. This allows metadata to be understood without compile-time dependencies on the metadata types.FileDescriptorSet
Thedescriptor_set field contains a FileDescriptorSet which includes:
- Message Descriptor: The
FileDescriptorProtocontaining your metadata message definition - Dependencies: All transitive dependencies of your message
- Exclusions: Well-known types may be excluded as they’re universally available
Creating a Descriptor Set
To create aFileDescriptorSet for your metadata:
--include_imports flag ensures all dependencies are included.
Using Descriptors
Consumers of the metadata can:- Fetch the
EventGroupMetadataDescriptor - Extract the
descriptor_set - Use reflection APIs to parse and understand the metadata
- No compile-time dependency on the metadata schema required
Workflow
Defining Metadata Schema
- Design Schema: Create a
.protofile defining your metadata structure:
- Generate Descriptor: Compile with
--descriptor_set_out:
-
Load Descriptor: Read the generated
.pbfile into aFileDescriptorSet. -
Create Descriptor Resource: Call
CreateEventGroupMetadataDescriptorwith the descriptor set.
Registering Descriptors
- One Per Schema: Create one descriptor per unique metadata schema.
- Use Type URL as Request ID: The protobuf type URL (e.g.,
type.googleapis.com/com.example.metadata.CampaignMetadata) makes a goodrequest_id. - Store Reference: Save the returned resource name for use in EventGroups.
Using Descriptors with EventGroups
When creating anEventGroup:
- Reference Descriptor: Set
event_group_metadata_descriptorto the descriptor resource name. - Provide Metadata: Include the actual metadata message in the
metadatafield. - Type Matching: The metadata must match the type defined in the descriptor.
Updating Schemas
- Version Control: Maintain backward compatibility when updating schemas.
- Create New Descriptor: For breaking changes, create a new descriptor instead of updating.
- Update Descriptor: For compatible changes, update the existing descriptor.
- Migrate EventGroups: Update EventGroups to reference the new descriptor.
Best Practices
Schema Design
- Backward Compatibility: Use field numbers that won’t conflict with future additions.
- Optional Fields: Make fields optional when possible for flexibility.
- Documentation: Include comments in your
.protofiles. - Namespacing: Use package names to avoid type collisions.
Descriptor Management
- Versioning: Include version information in your schema if needed.
- Dependencies: Minimize external dependencies for simpler descriptor sets.
- Well-Known Types: Leverage protobuf well-known types (they can be excluded from the descriptor set).
- Testing: Validate descriptor sets can be deserialized correctly.
Cross-Provider Compatibility
- Standard Schemas: Consider using common schemas across DataProviders.
- List Across Providers: Use
dataProviders/-to discover all available descriptors. - Batch Operations: Use batch get for efficient retrieval of multiple descriptors.
- Caching: Cache descriptors as they rarely change.
Error Handling
- Validation: Validate descriptor sets before creating resources.
- Idempotency: Use
request_idto make creation idempotent. - Type Checking: Ensure EventGroup metadata matches the referenced descriptor.
- Not Found: Handle cases where descriptors may have been deleted.
