Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8830 add google analytics authentication and reporting to enso #8907

Merged
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
68b550a
updated google api to the latest and added google analytics method
Cassandra-Clark Jan 24, 2024
cab5064
updated google api to the latest and added google analytics method
Cassandra-Clark Jan 24, 2024
6a04ab4
Merge branch '8830-add-google-analytics-authentication-and-reporting-…
Cassandra-Clark Jan 24, 2024
3157e16
hardcoded values for testing
Cassandra-Clark Jan 29, 2024
1b7521c
Latest version based on session with James
Cassandra-Clark Jan 29, 2024
b0feb24
updated google api to the latest and added google analytics method
Cassandra-Clark Jan 24, 2024
fd6783a
hardcoded values for testing
Cassandra-Clark Jan 29, 2024
d73dba3
Latest version based on session with James
Cassandra-Clark Jan 29, 2024
4a021a1
Parse the result into a Table.
jdunkerley Jan 30, 2024
00b1981
Merge branch '8830-add-google-analytics-authentication-and-reporting-…
Cassandra-Clark Jan 30, 2024
22445fd
Update CHANGELOG.md
Cassandra-Clark Jan 30, 2024
10144c3
Update distribution/lib/Standard/Google_Api/0.0.0-dev/src/Main.enso
Cassandra-Clark Jan 31, 2024
370320b
Updated documentation
Cassandra-Clark Jan 31, 2024
7bef9c4
Merge branch '8830-add-google-analytics-authentication-and-reporting-…
Cassandra-Clark Jan 31, 2024
6f69f93
rename run_google_report to run_analytics_report
Cassandra-Clark Feb 5, 2024
dfdef99
adding license info 1
radeusgd Feb 6, 2024
18311b0
faster dropdown in helper tool
radeusgd Feb 6, 2024
0421c88
Merge branch 'develop' into 8830-add-google-analytics-authentication-…
radeusgd Feb 6, 2024
c9b1264
update reviews
radeusgd Feb 7, 2024
fab9861
update generated reports
radeusgd Feb 7, 2024
a0a8230
Remove jsr305 from dependencies
radeusgd Feb 7, 2024
8eb28bc
Merge branch 'develop' into 8830-add-google-analytics-authentication-…
jdunkerley Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@
- [DataflowError.withoutTrace doesn't store stacktrace][8608]
- [Derive --in-project from --run source location][8775]
- [Binary operator resolution based on that value][8779]
- [Add run_google_report method][8907]

[3227]: https://github.com/enso-org/enso/pull/3227
[3248]: https://github.com/enso-org/enso/pull/3248
Expand Down Expand Up @@ -1189,6 +1190,7 @@
[8608]: https://github.com/enso-org/enso/pull/8608
[8775]: https://github.com/enso-org/enso/pull/8775
[8779]: https://github.com/enso-org/enso/pull/8779
[8907]: https://github.com/enso-org/enso/pull/8907

# Enso 2.0.0-alpha.18 (2021-10-12)

Expand Down
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2779,8 +2779,9 @@ lazy val `std-google-api` = project
Compile / packageBin / artifactPath :=
`google-api-polyglot-root` / "std-google-api.jar",
libraryDependencies ++= Seq(
"com.google.api-client" % "google-api-client" % "1.35.2",
"com.google.apis" % "google-api-services-sheets" % "v4-rev612-1.25.0"
"com.google.api-client" % "google-api-client" % "2.2.0",
"com.google.apis" % "google-api-services-sheets" % "v4-rev612-1.25.0",
"com.google.analytics" % "google-analytics-data" % "0.44.0"
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
Expand Down
42 changes: 42 additions & 0 deletions distribution/lib/Standard/Google_Api/0.0.0-dev/src/Main.enso
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Standard.Base import all
import Standard.Base.Data.Array_Proxy.Array_Proxy

from Standard.Table import Table

Expand All @@ -8,6 +9,14 @@ polyglot java import com.google.api.client.json.gson.GsonFactory
polyglot java import com.google.api.services.sheets.v4.Sheets
polyglot java import com.google.api.services.sheets.v4.SheetsScopes
polyglot java import java.util.Collections
polyglot java import com.google.analytics.data.v1beta.BetaAnalyticsDataClient
polyglot java import com.google.analytics.data.v1beta.DateRange
polyglot java import com.google.analytics.data.v1beta.Dimension
polyglot java import com.google.analytics.data.v1beta.Metric
polyglot java import com.google.analytics.data.v1beta.Row
polyglot java import com.google.analytics.data.v1beta.RunReportRequest
polyglot java import com.google.analytics.data.v1beta.RunReportResponse


## PRIVATE
type Google_Api_Client
Expand Down Expand Up @@ -58,3 +67,36 @@ initialize secret_file =
http_transport = GoogleNetHttpTransport.newTrustedTransport
json_factory = GsonFactory.getDefaultInstance
Google_Api_Client.Value credential json_factory http_transport


## PLACEHOLDER, performs google analytics call
This method calls the google reporting v4 api. Presently it specifically returns activeUsers by City
Arguments:
- property_id: The Google Analytics property_id that is being queried
- start_date: The beginning date of the query. Default is 2020-03-31
- end_date: The end date being queried. Defaults to today.
run_analytics_report : Text -> Date -> Date -> Table
run_analytics_report property_id:Text start_date:Date=(Date.new 2020 3 31) end_date:Date=Date.today -> Table =
analytics_data = BetaAnalyticsDataClient.create
request = RunReportRequest.newBuilder
. setProperty ("properties/"+property_id)
. addDimensions (Dimension.newBuilder.setName "city")
. addMetrics (Metric.newBuilder.setName "activeUsers")
. addDateRanges (DateRange.newBuilder.setStartDate start_date.to_text . setEndDate end_date.to_text)
. build
response = analytics_data.runReport request

dimension_count = response.getDimensionHeadersCount
dimensions = 0.up_to dimension_count . map i-> response.getDimensionHeaders i . getName
metric_count = response.getMetricHeadersCount
metrics = 0.up_to metric_count . map i-> response.getMetricHeaders i . getName
headers = dimensions + metrics

row_count = response.getRowCount
row_proxy = Array_Proxy.new row_count i->
row = response.getRows i
dimension_values = 0.up_to dimension_count . map i-> row.getDimensionValues i . getValue
metric_values = 0.up_to metric_count . map i-> row.getMetricValues i . getValue
dimension_values + metric_values
Cassandra-Clark marked this conversation as resolved.
Show resolved Hide resolved

Table.from_rows headers (Vector.from_polyglot_array row_proxy)
3 changes: 2 additions & 1 deletion project/Editions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ object Editions {
"Standard.Geo",
"Standard.Visualization",
"Standard.Examples",
"Standard.Searcher"
"Standard.Searcher",
"Standard.Google_Api"
)

case class ContribLibrary(name: String, version: String)
Expand Down
5 changes: 4 additions & 1 deletion project/src/main/scala/licenses/report/HTMLWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ class HTMLWriter(bufferedWriter: BufferedWriter) {
|$$( function() {
| $$( ".accordion" ).accordion({
| active: false,
| collapsible: true
| collapsible: true,
| animate: {
| duration: 100
| }
| });
|});
|</script>
Expand Down
2 changes: 1 addition & 1 deletion tools/legal-review/AWS/report-state
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
79F8085006CADBE1F915455506E1CDEB9A27B8B59EDFCA78FAA3218A3296DE62
6F5A08E5432F0B0C17A5CFC28207781B7C39E85B120D4F74B9B6AA35FF80E8C0
0
2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copyright 2023 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copyright (C) 2012 The Android Open Source Project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
copyright notice, this list of conditions and the following disclaimer
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Copyright 2011 Google Inc.
Copyright 2012 Google Inc.
Copyright 2013 Google Inc.
Copyright 2014 Google Inc.
Copyright 2015 Google Inc.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright 2010 Google Inc.
Copyright 2020 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Redistributions of source code must retain the above copyright
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
copyright notice, this list of conditions and the following disclaimer
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright 2017, Google Inc.
Copyright 2018, Google Inc.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright 2016, Google Inc.
Copyright 2023, Google Inc.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Copyright 2016 Google LLC
Copyright 2017 Google LLC
Copyright 2017 Google LLC
Copyright 2018 Google LLC
Copyright 2018 Google LLC
Copyright 2019 Google LLC
Copyright 2020 Google LLC
Copyright 2020 Google LLC
Copyright 2021 Google LLC
Copyright 2021 Google LLC
Copyright 2022 Google LLC
Copyright 2022 Google LLC
Copyright 2023 Google LLC
Redistributions of source code must retain the above copyright
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Redistributions of source code must retain the above copyright
Redistributions of source code must retain the above copyright
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
copyright notice, this list of conditions and the following disclaimer
copyright notice, this list of conditions and the following disclaimer
copyright notice, this list of conditions and the following disclaimer
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Copyright 2017 Google LLC
Copyright 2018 Google LLC
Copyright 2019 Google LLC
Copyright 2020 Google LLC
Copyright 2021 Google LLC
Copyright 2022 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright 2016 Google LLC
Copyright 2023 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Redistributions of source code must retain the above copyright
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
copyright notice, this list of conditions and the following disclaimer
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Copyright 2017 Google LLC
Copyright 2018 Google LLC
Copyright 2019 Google LLC
Copyright 2020 Google LLC
Copyright 2021 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright 2016 Google LLC
Copyright 2022 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Redistributions of source code must retain the above copyright
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
copyright notice, this list of conditions and the following disclaimer
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Copyright 2018 Google LLC
Copyright 2020 Google LLC
Copyright 2021 Google LLC
Copyright 2022 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright 2017 Google LLC
Copyright 2023 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copyright 2023 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copyright 2023 Google LLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright (c) 2020 The Go Authors. All rights reserved.
Copyright (c) 2021 The Go Authors. All rights reserved.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this work for additional information regarding copyright ownership.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>This is public domain code with no copyrights. From home page of
Some portions of this file Copyright (c) 2004-2006 Intel Corporation
This is public domain code with no copyrights. From home page of
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
META-INF/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
META-INF/NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
META-INF/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
META-INF/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
META-INF/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
META-INF/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (C) 2008 The Android Open Source Project
Copyright (C) 2009 The Android Open Source Project
Copyright (C) 2010 The Android Open Source Project
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 The Android Open Source Project
Copyright (C) 2013 The Android Open Source Project
Copyright (C) 2014 The Android Open Source Project
Copyright (C) 2015 The Android Open Source Project
Copyright (C) 2016 The Android Open Source Project
Copyright (C) 2017 The Android Open Source Project
Copyright (C) 2019 The Android Open Source Project
Copyright (C) 2020 The Android Open Source Project
Copyright 2014 The Android Open Source Project
Copyright 2014 The Netty Project
Copyright 2015 The Android Open Source Project
Copyright 2016 The Android Open Source Project
Copyright 2016 The Netty Project
Copyright 2017 The Android Open Source Project
Copyright 2017 The Netty Project
Copyright 2018 The Android Open Source Project
Copyright 2019 The Android Open Source Project
Copyright 2021 The Android Open Source Project
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Copyright (C) 2007 The Android Open Source Project
Copyright 2013 The Android Open Source Project
Copyright 2013 The Netty Project
this work for additional information regarding copyright ownership.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
6 changes: 3 additions & 3 deletions tools/legal-review/Google_Api/report-state
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
C5C845C319F900C420F04C815ACFC315E24C581960BE61B03BB6A2F8D71122C9
12BB786E599BE5441F12C0061839D42DBA889C1FBC45F74938E71F664ABD0E65
0
4B20A73BCBECA2ADC0A608DD3814442B01F67891DB6524AE5B24CD919092C304
055A656383D37CCC25C13D065991E90CB66A86A5133B1A2967629C86077C83A8
137
1 change: 1 addition & 0 deletions tools/legal-review/Google_Api/reviewed-licenses/Apache_2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tools/legal-review/license-texts/APACHE2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tools/legal-review/license-texts/BSD-3-Clause
1 change: 1 addition & 0 deletions tools/legal-review/Google_Api/reviewed-licenses/Go_License
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tools/legal-review/license-texts/Go_License
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tools/legal-review/license-texts/MIT
4 changes: 2 additions & 2 deletions tools/legal-review/Table/report-state
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
AE474B24FC7C88ACA56C70EC19DCD5F224178089AA2910DB117EE7D914D6C7FF
45B9C528D26D13399A07F9FFE79576924709B1DEB991862372B4AFB185869893
0
B1FEB2318218F5AC9CA5E5CEC9B32A557ED81934709392767D2FA8C2E4453CA7
3
4 changes: 2 additions & 2 deletions tools/legal-review/engine/report-state
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
D8B011DD7E11E226FD042DCDEE28B22C5D74D2B7A666346317619CCB487832C4
0035ED295654FAACCD79D0DA6D2CDDA8E2EC8D0BA9254722FB55C6F622A68B94
0
B4092E4B002E6805BC5493117C9015F6B026A087556E4C61B0CA44DCD4EDFC8F
54
4 changes: 2 additions & 2 deletions tools/legal-review/launcher/report-state
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
7FD6B2CEF25DA9C73D447AAFC64AB53637F764914391B1A08BE19DC78C9A30E8
BBDB37A47F71427476C52022158EA9E9BC3FF9AEFB6705E2BE56D8AF09A6A621
0
B3CE610284A3C4F12E5E0C0B5E00855F1A6C9DA3AEFE99517FD4735E2944CF4E
38
27 changes: 27 additions & 0 deletions tools/legal-review/license-texts/Go_License
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2009 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 2 additions & 2 deletions tools/legal-review/project-manager/report-state
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
578C28B786B877E41559F52CBDFBF45DE798CEB12FDF9632A93CC4B1B30C72C6
D1B18FEE4514908AD689F9B25D7E4445E5F3D75296F136BED478DB855D891F88
0
6CAD27DB2DC8213B675ADB97FFF37E474A7F8B81E80538F871042F36A73111D4
59
Loading