Skip to content

Commit d395233

Browse files
feat: [google-analytics-data] add SamplingLevel type to Data API v1alpha (#13177)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add `SamplingLevel` type to Data API v1alpha feat: add `sampling_level` to the `ReportDefinition` type END_COMMIT_OVERRIDE PiperOrigin-RevId: 686560382 Source-Link: googleapis/googleapis@7b6975c Source-Link: googleapis/googleapis-gen@52607af Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1kYXRhLy5Pd2xCb3QueWFtbCIsImgiOiI1MjYwN2FmMDMwMjgzN2NlODgwNDcxYTk0ZTQ3M2RlYWI1Y2EwZTRmIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
1 parent 18b266f commit d395233

5 files changed

Lines changed: 44 additions & 0 deletions

File tree

packages/google-analytics-data/google/analytics/data_v1alpha/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
ResponseMetaData,
103103
RestrictedMetricType,
104104
Row,
105+
SamplingLevel,
105106
SamplingMetadata,
106107
Segment,
107108
SegmentEventFilter,
@@ -207,6 +208,7 @@
207208
"Row",
208209
"RunFunnelReportRequest",
209210
"RunFunnelReportResponse",
211+
"SamplingLevel",
210212
"SamplingMetadata",
211213
"Segment",
212214
"SegmentEventFilter",

packages/google-analytics-data/google/analytics/data_v1alpha/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
ResponseMetaData,
9494
RestrictedMetricType,
9595
Row,
96+
SamplingLevel,
9697
SamplingMetadata,
9798
Segment,
9899
SegmentEventFilter,
@@ -221,6 +222,7 @@
221222
"MetricAggregation",
222223
"MetricType",
223224
"RestrictedMetricType",
225+
"SamplingLevel",
224226
"SessionCriteriaScoping",
225227
"SessionExclusionDuration",
226228
"UserCriteriaScoping",

packages/google-analytics-data/google/analytics/data_v1alpha/types/analytics_data_api.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,8 @@ class ReportTask(proto.Message):
12211221
class ReportDefinition(proto.Message):
12221222
r"""The definition of how a report should be run.
12231223
1224+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1225+
12241226
Attributes:
12251227
dimensions (MutableSequence[google.analytics.data_v1alpha.types.Dimension]):
12261228
Optional. The dimensions requested and
@@ -1299,6 +1301,10 @@ class ReportDefinition(proto.Message):
12991301
then a query for the ``eventName`` dimension and
13001302
``eventCount`` metric will not have a row containing
13011303
eventName: "purchase" and eventCount: 0.
1304+
sampling_level (google.analytics.data_v1alpha.types.SamplingLevel):
1305+
Optional. The report's sampling level.
1306+
1307+
This field is a member of `oneof`_ ``_sampling_level``.
13021308
"""
13031309

13041310
dimensions: MutableSequence[data.Dimension] = proto.RepeatedField(
@@ -1359,6 +1365,12 @@ class ReportDefinition(proto.Message):
13591365
proto.BOOL,
13601366
number=13,
13611367
)
1368+
sampling_level: data.SamplingLevel = proto.Field(
1369+
proto.ENUM,
1370+
number=14,
1371+
optional=True,
1372+
enum=data.SamplingLevel,
1373+
)
13621374

13631375
class ReportMetadata(proto.Message):
13641376
r"""The report metadata for a specific report task.

packages/google-analytics-data/google/analytics/data_v1alpha/types/data.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"MetricAggregation",
3333
"MetricType",
3434
"RestrictedMetricType",
35+
"SamplingLevel",
3536
"DateRange",
3637
"Dimension",
3738
"DimensionExpression",
@@ -308,6 +309,32 @@ class RestrictedMetricType(proto.Enum):
308309
REVENUE_DATA = 2
309310

310311

312+
class SamplingLevel(proto.Enum):
313+
r"""Categories of sampling levels for the requests.
314+
315+
Values:
316+
SAMPLING_LEVEL_UNSPECIFIED (0):
317+
Unspecified type.
318+
LOW (1):
319+
Applies a sampling level of 10 million to
320+
standard properties and 100 million to Google
321+
Analytics 360 properties.
322+
MEDIUM (2):
323+
Exclusive to Google Analytics 360 properties
324+
with a sampling level of 1 billion.
325+
UNSAMPLED (3):
326+
Exclusive to Google Analytics 360 properties.
327+
Unsampled explorations are more accurate and can
328+
reveal insights that aren't visible in standard
329+
explorations. To learn more, see
330+
https://support.google.com/analytics/answer/10896953.
331+
"""
332+
SAMPLING_LEVEL_UNSPECIFIED = 0
333+
LOW = 1
334+
MEDIUM = 2
335+
UNSAMPLED = 3
336+
337+
311338
class DateRange(proto.Message):
312339
r"""A contiguous set of days: ``startDate``, ``startDate + 1``, ...,
313340
``endDate``. Requests are allowed up to 4 date ranges.

packages/google-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11681,6 +11681,7 @@ def test_create_report_task_rest_call_success(request_type):
1168111681
"cohort_report_settings": {"accumulate": True},
1168211682
},
1168311683
"keep_empty_rows": True,
11684+
"sampling_level": 1,
1168411685
},
1168511686
"report_metadata": {
1168611687
"state": 1,

0 commit comments

Comments
 (0)