View Source Toolbox.Incident.IdGenerator (toolbox v5.4.3)

Module provides functions to generate incident id.

Summary

Functions

Generates full incident ID based on incident type, timestamp and serialization vector.

Generates incident ID based on incident type, timestamp and serialization vector.

Functions

Link to this function

generate(incident_type, timestamp, vector)

View Source
This function is deprecated. Use generate_id/3 instead.

Generates full incident ID based on incident type, timestamp and serialization vector.

Serialization vector is list of relevant attributes which together with type and timestamp uniquely identify given incident.

Note including maps in serialization vector increases a risk the ID will change on new major OTP version. If you strongly prefer long-term stability avoid maps. This uses :erlang.term_to_binary under the hood.

This function is deprecated as it returns the full ID that includes type. This is no longer very useful as Output Actions take type and ID separately. Use generate_id/3 instead.

Examples

  iex> Toolbox.Incident.IdGenerator.generate("/incident/type", 0123456789, ["/asset/type/1"])
  "/incident/type/f4c3877a-d50b-3a16-b6ec-3ebb2b308d40"
Link to this function

generate_id(incident_type, timestamp, vector)

View Source (since 5.2.0)

Generates incident ID based on incident type, timestamp and serialization vector.

Serialization vector is list of relevant attributes which together with type and timestamp uniquely identify given incident.

Note including maps in serialization vector increases a risk the ID will change on new major OTP version. If you strongly prefer long-term stability avoid maps. This uses :erlang.term_to_binary under the hood.

This function is compatible with deprecated generate/3, you can replace it with this and the IDs will not change.

Examples

  iex> Toolbox.Incident.IdGenerator.generate_id("/incident/type", 0123456789, ["/asset/type/1"])
  "f4c3877a-d50b-3a16-b6ec-3ebb2b308d40"