Skip to content

Commit 7d82318

Browse files
authored
Collapse AttributeDescriptor into a map<string, AttributeInfo> (#80)
* Remove AttributeDescriptor, collapsing it into a map<string, AttributeInfo> in the AttributeManifest message. * Add back comments about the requirements for attribute naming that were originally on the AttributeDescriptor message * Add comments removed from attribute_descriptor.proto to AttributeManifest.
1 parent 89fe520 commit 7d82318

File tree

2 files changed

+64
-86
lines changed

2 files changed

+64
-86
lines changed

mixer/v1/config/cfg.proto

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ syntax = "proto3";
1616

1717
import "google/protobuf/struct.proto";
1818

19-
import "mixer/v1/config/descriptor/attribute_descriptor.proto";
2019
import "mixer/v1/config/descriptor/log_entry_descriptor.proto";
2120
import "mixer/v1/config/descriptor/metric_descriptor.proto";
2221
import "mixer/v1/config/descriptor/monitored_resource_descriptor.proto";
2322
import "mixer/v1/config/descriptor/principal_descriptor.proto";
2423
import "mixer/v1/config/descriptor/quota_descriptor.proto";
24+
import "mixer/v1/config/descriptor/value_type.proto";
2525

2626

2727
package istio.mixer.v1.config;
@@ -119,7 +119,7 @@ message Aspect {
119119
//
120120
// In the following example we define a `metrics` adapter using the Mixer's prepackaged
121121
// prometheus adapter. This adapter doesn't require any parameters.
122-
//
122+
//
123123
// ```yaml
124124
// kind: metrics
125125
// name: prometheus-adapter
@@ -177,9 +177,68 @@ message AttributeManifest {
177177
// `attributes` kind adapter in Mixer.
178178
string name = 2;
179179

180-
// The set of attributes this Istio component will be responsible for
181-
// producing at runtime.
182-
repeated istio.mixer.v1.config.descriptor.AttributeDescriptor attributes = 3;
180+
// AttributeInfo describes the schema of an Istio `Attribute`.
181+
//
182+
// ## Istio Attributes
183+
//
184+
// Istio uses `attributes` to describe runtime activities of Istio services.
185+
// An Istio attribute carries a specific piece of information about an activity,
186+
// such as the error code of an API request, the latency of an API request, or the
187+
// original IP address of a TCP connection. The attributes are often generated
188+
// and consumed by different services. For example, a frontend service can
189+
// generate an authenticated user attribute and pass it to a backend service for
190+
// access control purpose.
191+
//
192+
// To simplify the system and improve developer experience, Istio uses
193+
// shared attribute definitions across all components. For example, the same
194+
// authenticated user attribute will be used for logging, monitoring, analytics,
195+
// billing, access control, auditing. Many Istio components provide their
196+
// functionality by collecting, generating, and operating on attributes.
197+
// For example, the proxy collects the error code attribute, and the logging
198+
// stores it into a log.
199+
//
200+
// ## Design
201+
//
202+
// Each Istio attribute must conform to an `AttributeInfo` in an
203+
// `AttributeManifest` in the current Istio deployment at runtime. An
204+
// [`AttributeInfo`][istio.mixer.v1.config] is used to define an attribute's
205+
// metadata: the type of its value and a detailed description that explains
206+
// the semantics of the attribute type. Each attribute's name is globally unique;
207+
// in other words an attribute name can only appear once across all manifests.
208+
//
209+
// The runtime presentation of an attribute is intentionally left out of this
210+
// specification, because passing attribute using JSON, XML, or Protocol Buffers
211+
// does not change the semantics of the attribute. Different implementations
212+
// can choose different representations based on their needs.
213+
//
214+
// ## HTTP Mapping
215+
//
216+
// Because many systems already have REST APIs, it makes sense to define a
217+
// standard HTTP mapping for Istio attributes that are compatible with typical
218+
// REST APIs. The design is to map one attribute to one HTTP header, the
219+
// attribute name and value becomes the HTTP header name and value. The actual
220+
// encoding scheme will be decided later.
221+
message AttributeInfo {
222+
// Optional. A human-readable description of the attribute's purpose.
223+
string description = 1;
224+
225+
// Required. The type of data carried by this attribute.
226+
istio.mixer.v1.config.descriptor.ValueType value_type = 2;
227+
}
228+
// The set of attributes this Istio component will be responsible for producing at runtime.
229+
// We map from attribute name to the attribute's specification. The name of an attribute,
230+
// which is how attributes are referred to in aspect configuration, must conform to:
231+
//
232+
// Name = IDENT { SEPARATOR IDENT };
233+
//
234+
// Where `IDENT` must match the regular expression `[a-z][a-z0-9]+` and `SEPARATOR` must
235+
// match the regular expression `[\.-]`.
236+
//
237+
// Attribute names must be unique within a single Istio deployment. The set of canonical
238+
// attributes are described at https://istio.io/docs/reference/attribute-vocabulary.html.
239+
// Attributes not in that list should be named with a component-specific suffix such as
240+
// request.count-my.component
241+
map<string, AttributeInfo> attributes = 3;
183242
}
184243

185244
// Uri represents a properly formed URI.

mixer/v1/config/descriptor/attribute_descriptor.proto

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)