Class EventProperties

Class Documentation

class Microsoft::Applications::Events::EventProperties

The EventProperties class encapsulates event properties.

Public Functions

EventProperties(const std::string &name, uint8_t diagnosticLevel)

Constructs an EventProperties object, taking a string for the property name and a diagnostic level.

You must supply a non-empty name whenever you supply any custom properties for the event via EventProperties.

EventProperties(const std::string &name)

Constructs an EventProperties object, taking a string for the property name.

Sets the diagnostic level of the event to DIAG_LEVEL_OPTIONAL You must supply a non-empty name whenever you supply any custom properties for the event via EventProperties.

EventProperties()

Constructs an EventProperties object (the default constructor).

Sets the diagnostic level of the event to DIAG_LEVEL_OPTIONAL You must supply a non-empty name whenever you supply any custom properties for the event via EventProperties.

EventProperties(EventProperties const &copy)

The EventProperties copy constructor.

EventProperties &operator=(EventProperties const &copy)

The EventProperties equals operator overload.

EventProperties(const std::string &name, const std::map<std::string, EventProperty> &properties)

Constructs an EventProperties object from a map of string to EventProperty.

You must supply a non-empty name whenever you supply any custom properties for the event via EventProperties.

EventProperties &operator+=(const std::map<std::string, EventProperty> &properties)

Adds a map of <string, EventProperty> to EventProperties.

EventProperties &operator=(const std::map<std::string, EventProperty> &properties)

Assigns a map of <string, EventProperty> to EventProperties.

EventProperties(const std::string &name, std::initializer_list<std::pair<std::string const, EventProperty>> properties)

An EventProperties constructor using a C++11 initializer list.

EventProperties &operator=(std::initializer_list<std::pair<std::string const, EventProperty>> properties)

An EventProperties assignment operator using C++11 initializer list.

bool SetName(const std::string &name)

Sets the name of an event, given a string for the event name.

You must supply a non-empty name whenever you supply any custom properties for the event via EventProperties.

Parameters

name – A string that contains the name of the event.

const std::string &GetName() const

Gets the name of an event.

An empty string is returned if the name was never set.

Returns

Name of the event

bool SetType(const std::string &recordType)

Sets the base type of an event.

Parameters

recordType – Base Type of event record.

const std::string &GetType() const

Gets the Base Type of an event.

Returns

A string that contains the type of the event.

void SetTimestamp(int64_t timestampInEpochMillis)

[optional] Sets the timestamp of an event, in milliseconds.

Note: This method overrides the default timestamp generated by the telemetry system.

Parameters

timestampInEpochMillis – The UNIX timestamp in milliseconds. This is the amount of time since 00:00:00 Coordinated Universal Time (UTC), January, 1, 1970 (not counting leap seconds).

int64_t GetTimestamp() const

Gets the timestamp of an event, in milliseconds.

Zero is returned when the time stamp was not specified with SetTimestamp().

Returns

The timestamp of the event, specified in milliseconds.

void SetPriority(EventPriority priority)

[optional] Sets the transmit priority of an event.

Note: If you don’t specify a value, then the default priority is used.

Parameters

priority – The transmit priority.

EventPriority GetPriority() const

Gets the transmit priority of the event.

Returns

The transmit priority.

Returns

void SetLatency(EventLatency latency)

[optional] Sets the transmit Latency of the event.

Parameters

latency – Event latency.

EventLatency GetLatency() const

Get the transmit Latency of the event.

Returns

Transmit Latency of the event<returns>

void SetPersistence(EventPersistence persistence)

[optional] Specify Persistence priority of an event.

Default Persistence priority will be used for persisting the event if none was specified.

Parameters

priority – Persistence of the event

EventPersistence GetPersistence() const

Get the transmit Latency of the event.

Returns

Transmit Latency of the event<returns>

void SetPopsample(double popSample)

[optional] Specify popSample of an event.

Parameters

priority – popSample of the event

double GetPopSample() const

Get the popSample of the event.

Returns

popSample of the event<returns>

void SetPolicyBitFlags(uint64_t policyBitFlags)

[optional] Specify Policy Bit flags for UTC usage of an event.

Default values will be used for transmitting the event if none was specified.

Parameters

priority – Transmit priority of the event

uint64_t GetPolicyBitFlags() const

Get the Policy bit flags for UTC usage of the event.

Returns

Transmit priority of the event<returns>

inline void SetLevel(uint8_t level)

Sets the diagnostic level of an event.

This is equivalent to: … SetProperty(COMMONFIELDS_EVENT_LEVEL, level); …

std::tuple<bool, uint8_t> TryGetLevel() const

TODO: [MG] - can we revisit this, do we need a tuple?

Attempts to get the diagnostic level for an event. <return>True and the level, or false if unset, set to the wrong type, or the value is out of bounds.</return>

void SetProperty(const std::string &name, EventProperty value)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

Parameters
  • name – Name of the property

  • value – Value of the property

  • piiKind – PIIKind of the property

void SetProperty(const std::string &name, char const *value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, const std::string &value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, double value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, int64_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, bool value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, time_ticks_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, GUID_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

inline void SetProperty(const std::string &name, int8_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

All integer types are currently being converted to int64_t.

inline void SetProperty(const std::string &name, int16_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

All integer types are currently being converted to int64_t.

inline void SetProperty(const std::string &name, int32_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

All integer types are currently being converted to int64_t.

inline void SetProperty(const std::string &name, uint8_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

All integer types are currently being converted to int64_t.

inline void SetProperty(const std::string &name, uint16_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

All integer types are currently being converted to int64_t.

inline void SetProperty(const std::string &name, uint32_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

All integer types are currently being converted to int64_t.

inline void SetProperty(const std::string &name, uint64_t value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

All integer types are currently being converted to int64_t.

void SetProperty(const std::string &name, std::vector<std::string> &value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, std::vector<GUID_t> &value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, std::vector<double> &value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

void SetProperty(const std::string &name, std::vector<int64_t> &value, PiiKind piiKind = PiiKind_None, DataCategory category = DataCategory_PartC)

Specify a property for an event.

It either creates a new property if none exists or overwrites the existing one.

const std::map<std::string, EventProperty> &GetProperties(DataCategory category = DataCategory_PartC) const

Get the properties bag of an event.

Returns

Properties bag of the event

const std::map<std::string, std::pair<std::string, PiiKind>> GetPiiProperties(DataCategory category = DataCategory_PartC) const

Get the Pii properties bag of an event.

Returns

Pii Properties bag of the event

size_t erase(const std::string &key, DataCategory category = DataCategory_PartC)

Erase property from event.

virtual ~EventProperties() noexcept
evt_prop *pack()

Implementation of ABI-safe packing of EventProperties object.

bool unpack(evt_prop *packed, size_t size)