Skip to content

Commit 7e400b0

Browse files
Google APIscopybara-github
authored andcommitted
feat: added GetMetadata method for metadata including custom dimensions and metrics.
PiperOrigin-RevId: 338118656
1 parent 34c5a5c commit 7e400b0

File tree

4 files changed

+76
-84
lines changed

4 files changed

+76
-84
lines changed

gapic/metadata/gapic_metadata.proto

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

google/analytics/data/v1alpha/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ proto_library(
2828
"//google/api:annotations_proto",
2929
"//google/api:client_proto",
3030
"//google/api:field_behavior_proto",
31+
"//google/api:resource_proto",
3132
],
3233
)
3334

@@ -164,6 +165,7 @@ moved_proto_library(
164165
"//google/api:annotations_proto",
165166
"//google/api:client_proto",
166167
"//google/api:field_behavior_proto",
168+
"//google/api:resource_proto",
167169
],
168170
)
169171

google/analytics/data/v1alpha/analytics_data_api.proto

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import "google/analytics/data/v1alpha/data.proto";
2020
import "google/api/annotations.proto";
2121
import "google/api/client.proto";
2222
import "google/api/field_behavior.proto";
23+
import "google/api/resource.proto";
2324

2425
option go_package = "google.golang.org/genproto/googleapis/analytics/data/v1alpha;data";
2526
option java_multiple_files = true;
@@ -88,6 +89,40 @@ service AlphaAnalyticsData {
8889
get: "/v1alpha/universalMetadata"
8990
};
9091
}
92+
93+
// Returns metadata for dimensions and metrics available in reporting methods.
94+
// Used to explore the dimensions and metrics. In this method, a Google
95+
// Analytics App + Web Property Identifier is specified in the request, and
96+
// the metadata response includes Custom dimensions and metrics as well as
97+
// Universal metadata.
98+
//
99+
// For example if a custom metric with parameter name `levels_unlocked` is
100+
// registered to a property, the Metadata response will contain
101+
// `customEvent:levels_unlocked`. Universal metadata are dimensions and
102+
// metrics applicable to any property such as `country` and `totalUsers`.
103+
rpc GetMetadata(GetMetadataRequest) returns (Metadata) {
104+
option (google.api.http) = {
105+
get: "/v1alpha/{name=properties/*/metadata}"
106+
};
107+
option (google.api.method_signature) = "name";
108+
}
109+
}
110+
111+
// The dimensions and metrics currently accepted in reporting methods.
112+
message Metadata {
113+
option (google.api.resource) = {
114+
type: "analyticsdata.googleapis.com/Metadata"
115+
pattern: "properties/{property}/metadata"
116+
};
117+
118+
// Resource name of this metadata.
119+
string name = 3;
120+
121+
// The dimensions descriptions.
122+
repeated DimensionMetadata dimensions = 1;
123+
124+
// The metric descriptions.
125+
repeated MetricMetadata metrics = 2;
91126
}
92127

93128
// The request to generate a report.
@@ -353,3 +388,18 @@ message UniversalMetadata {
353388
// The metric descriptions.
354389
repeated MetricMetadata metrics = 2;
355390
}
391+
392+
// Request for a property's dimension and metric metadata.
393+
message GetMetadataRequest {
394+
// Required. The resource name of the metadata to retrieve. This name field is
395+
// specified in the URL path and not URL parameters. Property is a numeric
396+
// Google Analytics App + Web Property identifier.
397+
//
398+
// Example: properties/1234/metadata
399+
string name = 1 [
400+
(google.api.field_behavior) = REQUIRED,
401+
(google.api.resource_reference) = {
402+
type: "analyticsdata.googleapis.com/Metadata"
403+
}
404+
];
405+
}

google/analytics/data/v1alpha/data.proto

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,30 @@ enum MetricType {
674674
// A duration of seconds; a special floating point type.
675675
TYPE_SECONDS = 4;
676676

677+
// A duration in milliseconds; a special floating point type.
678+
TYPE_MILLISECONDS = 5;
679+
680+
// A duration in minutes; a special floating point type.
681+
TYPE_MINUTES = 6;
682+
683+
// A duration in hours; a special floating point type.
684+
TYPE_HOURS = 7;
685+
686+
// A custom metric of standard type; a special floating point type.
687+
TYPE_STANDARD = 8;
688+
677689
// An amount of money; a special floating point type.
678690
TYPE_CURRENCY = 9;
691+
692+
// A length in feet; a special floating point type.
693+
TYPE_FEET = 10;
694+
695+
// A length in miles; a special floating point type.
696+
TYPE_MILES = 11;
697+
698+
// A length in meters; a special floating point type.
699+
TYPE_METERS = 12;
700+
701+
// A length in kilometers; a special floating point type.
702+
TYPE_KILOMETERS = 13;
679703
}

0 commit comments

Comments
 (0)