envoyproxy / envoyproxy/gateway

The term `key` is quite confusing as it can mean two different things in EG and Envoy API

Open
#6,589 2 comments 0 reactions 1 assignee Claimed by @Xunzhuo View on GitHub
stale
Dominant language
Go
Stars
3k
Forks
864
Avg merge
2d 2h
Merged PRs (30d)
140

Description

The term `key` is quite confusing as it can mean two different things in EG and Envoy API.
* The `namespace` of the metadata, usually the filter name or sub-system of envoy.
* A `path` segment in the metadata value struct.

I suggest we make it clearer by using the terms `namespace` and `path`.

We should unify how value is extracted from the dynamic metadata using a common structure:

```go
type Metadata struct {

Namespace string `json:"namespace"`

Path []string `json:"path,omitempty" yaml:"path,omitempty"`

// Deprecated, please use Path instead
Key string `json:"key" yaml:"key"`
}
```

For example, to extract value from this dynamic metata:

```json
"com.test.my_filter":
{
"test_key": "foo",
"test_object":
{
"inner_key": "bar"
}
}
````

1.

```go
Metadata{
Namespace: " com.test.my_filter"
Path: "test_object"
}
```

value: {"inner_key": "bar"}

2.

```go
Metadata{
Namespace: " com.test.my_filter"
Path: {"test_object", "inner_key"}
}
```

value: "bar"

Reference: https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format-dynamic-metadata

_Originally posted by @zhaohuabing in https://github.com/envoyproxy/gateway/pull/6458#discussion_r2204028113_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.