Skip to content

Commit

Permalink
fix: Get back metrics by using old specific Receive log method (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanRynne authored Oct 30, 2023
1 parent 19e64fd commit 0bb72f0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 40 deletions.
3 changes: 2 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"${workspaceFolder}\\tests",
"--prettyPrint"
],
"problemMatcher": []
"problemMatcher": [],
"dependsOn": ["build"]
}
]
}
2 changes: 1 addition & 1 deletion Speckle.query.pq
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Use this file to write queries to test your data connector
let result = Speckle.GetByUrl("https://latest.speckle.dev/streams/c1faab5c62/commits/aefb7a5fff") in result
let result = Speckle.GetByUrl("https://latest.speckle.dev/streams/4e51c4025f/commits/766c20c5fb") in result
4 changes: 2 additions & 2 deletions speckle/api/Api.CommitReceived.pqm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let
Speckle.Api.Fetch = Extension.LoadFunction("Api.Fetch.pqm"),
Speckle.Log.Receive = Extension.LoadFunction("Log.Receive.pqm"),
Speckle.LogEvent = Extension.LoadFunction("LogEvent.pqm"),
Extension.LoadFunction = (fileName as text) =>
let
binary = Extension.Contents(fileName), asText = Text.FromBinary(binary)
Expand All @@ -27,7 +27,7 @@ in
sourceApplication = "PowerBI"
]
],
s = Speckle.Log.Receive(server, commit)
s = Speckle.LogEvent(server, commit)
in
// Read receipts should fail gracefully no matter what
try Speckle.Api.Fetch(s, query, variables)[commitReceive] otherwise false
18 changes: 15 additions & 3 deletions speckle/logging/LogEvent.pqm → speckle/helpers/LogEvent.pqm
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
let
GetApplicationSlug = Extension.LoadFunction("GetApplicationSlug.pqm"),
GetUser = Extension.LoadFunction("Api.GetUser.pqm"),
Hash = Extension.LoadFunction("Hash.pqm"),
Extension.LoadFunction = (fileName as text) =>
let
binary = Extension.Contents(fileName), asText = Text.FromBinary(binary)
Expand All @@ -13,12 +16,21 @@ let
Detail = [File = fileName, Error = e]
]
in
(server as text, event as text, properties as record) =>
(server as text, commit as any) =>
let
trackUrl = "https://analytics.speckle.systems/track?ip=1",
user = GetUser(server),
isMultiplayer = user[id] <> commit[authorId],
body = [
event = event,
properties = properties
event = "Receive",
properties = [
server_id = Hash(server),
token = "acd87c5a50b56df91a795e999812a3a4",
hostApp = "powerbi",
sourceHostApp = GetApplicationSlug(commit[sourceApplication]),
sourceHostAppVersion = commit[sourceApplication],
isMultiplayer = user[id] <> commit[authorId]
]
],
Result = Web.Contents(
trackUrl,
Expand Down
33 changes: 0 additions & 33 deletions speckle/logging/Log.Receive.pqm

This file was deleted.

0 comments on commit 0bb72f0

Please sign in to comment.