Set Metadata

  • This filter should be configured with the type URL type.googleapis.com/envoy.extensions.filters.http.set_metadata.v3.Config.

  • v3 API reference

This filters adds or updates dynamic metadata with static data.

Dynamic metadata values are updated with the following rules. If a key does not exist, it is copied into the current metadata. If the key exists, then following rules will be used:

  • if typed metadata value is used, it will overwrite existing values iff allow_overwrite is set to true, otherwise nothing is done.

  • if untyped metadata value is used and allow_overwrite is set to true, or if deprecated value field is used, the values are updated with the following scheme: - existing value with different type: the existing value is replaced. - scalar values (null, string, number, boolean): the existing value is replaced. - lists: new values are appended to the current list. - structures: recursively apply this scheme.

For instance, if the namespace already contains this structure:

myint: 1
mylist: ["a"]
mykey: ["val"]
mytags:
  tag0: 1

and the value to set is:

myint: 2
mylist: ["b","c"]
mykey: 1
mytags:
  tag1: 1

After applying this filter, the namespace will contain:

myint: 2
mylist: ["a","b","c"]
mykey: 1
mytags:
  tag0: 1
  tag1: 1

Statistics

The set_metadata filter outputs statistics in the http.<stat_prefix>.set_metadata. namespace. The stat prefix comes from the owning HTTP connection manager.

Name

Type

Description

overwrite_denied

Counter

Total number of denied attempts to overwrite an existing metadata value