Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1001b660
Commit
1001b660
authored
Sep 15, 2020
by
Jacob Vosmaer
Committed by
Nick Thomas
Sep 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging for local LSIF ZIP caching
parent
df805fb1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
4 deletions
+15
-4
changelogs/unreleased/jv-log-lsif-zip-cache.yml
changelogs/unreleased/jv-log-lsif-zip-cache.yml
+5
-0
internal/lsif_transformer/parser/parser.go
internal/lsif_transformer/parser/parser.go
+5
-1
internal/lsif_transformer/parser/parser_test.go
internal/lsif_transformer/parser/parser_test.go
+2
-1
internal/lsif_transformer/parser/performance_test.go
internal/lsif_transformer/parser/performance_test.go
+2
-1
internal/upload/rewrite.go
internal/upload/rewrite.go
+1
-1
No files found.
changelogs/unreleased/jv-log-lsif-zip-cache.yml
0 → 100644
View file @
1001b660
---
title
:
Add logging for local LSIF ZIP caching
merge_request
:
579
author
:
type
:
added
internal/lsif_transformer/parser/parser.go
View file @
1001b660
...
@@ -2,11 +2,14 @@ package parser
...
@@ -2,11 +2,14 @@ package parser
import
(
import
(
"archive/zip"
"archive/zip"
"context"
"errors"
"errors"
"fmt"
"fmt"
"io"
"io"
"io/ioutil"
"io/ioutil"
"os"
"os"
"gitlab.com/gitlab-org/labkit/log"
)
)
var
(
var
(
...
@@ -23,7 +26,7 @@ type Config struct {
...
@@ -23,7 +26,7 @@ type Config struct {
TempPath
string
TempPath
string
}
}
func
NewParser
(
r
io
.
Reader
,
config
Config
)
(
io
.
ReadCloser
,
error
)
{
func
NewParser
(
ctx
context
.
Context
,
r
io
.
Reader
,
config
Config
)
(
io
.
ReadCloser
,
error
)
{
docs
,
err
:=
NewDocs
(
config
)
docs
,
err
:=
NewDocs
(
config
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -45,6 +48,7 @@ func NewParser(r io.Reader, config Config) (io.ReadCloser, error) {
...
@@ -45,6 +48,7 @@ func NewParser(r io.Reader, config Config) (io.ReadCloser, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
log
.
WithContextFields
(
ctx
,
log
.
Fields
{
"lsif_zip_cache_bytes"
:
size
})
.
Print
(
"cached incoming LSIF zip on disk"
)
zr
,
err
:=
zip
.
NewReader
(
tempFile
,
size
)
zr
,
err
:=
zip
.
NewReader
(
tempFile
,
size
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
internal/lsif_transformer/parser/parser_test.go
View file @
1001b660
...
@@ -3,6 +3,7 @@ package parser
...
@@ -3,6 +3,7 @@ package parser
import
(
import
(
"archive/zip"
"archive/zip"
"bytes"
"bytes"
"context"
"encoding/json"
"encoding/json"
"io"
"io"
"io/ioutil"
"io/ioutil"
...
@@ -42,7 +43,7 @@ func createFiles(t *testing.T, filePath, tmpDir string) {
...
@@ -42,7 +43,7 @@ func createFiles(t *testing.T, filePath, tmpDir string) {
file
,
err
:=
os
.
Open
(
filePath
)
file
,
err
:=
os
.
Open
(
filePath
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
parser
,
err
:=
NewParser
(
file
,
Config
{})
parser
,
err
:=
NewParser
(
context
.
Background
(),
file
,
Config
{})
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
zipFileName
:=
tmpDir
+
".zip"
zipFileName
:=
tmpDir
+
".zip"
...
...
internal/lsif_transformer/parser/performance_test.go
View file @
1001b660
package
parser
package
parser
import
(
import
(
"context"
"io"
"io"
"io/ioutil"
"io/ioutil"
"os"
"os"
...
@@ -21,7 +22,7 @@ func BenchmarkGenerate(b *testing.B) {
...
@@ -21,7 +22,7 @@ func BenchmarkGenerate(b *testing.B) {
file
,
err
:=
os
.
Open
(
filePath
)
file
,
err
:=
os
.
Open
(
filePath
)
require
.
NoError
(
b
,
err
)
require
.
NoError
(
b
,
err
)
parser
,
err
:=
NewParser
(
file
,
Config
{})
parser
,
err
:=
NewParser
(
context
.
Background
(),
file
,
Config
{})
require
.
NoError
(
b
,
err
)
require
.
NoError
(
b
,
err
)
_
,
err
=
io
.
Copy
(
ioutil
.
Discard
,
parser
)
_
,
err
=
io
.
Copy
(
ioutil
.
Discard
,
parser
)
...
...
internal/upload/rewrite.go
View file @
1001b660
...
@@ -187,7 +187,7 @@ func handleLsifUpload(ctx context.Context, reader io.Reader, tempPath, filename
...
@@ -187,7 +187,7 @@ func handleLsifUpload(ctx context.Context, reader io.Reader, tempPath, filename
TempPath
:
tempPath
,
TempPath
:
tempPath
,
}
}
return
parser
.
NewParser
(
reader
,
parserConfig
)
return
parser
.
NewParser
(
ctx
,
reader
,
parserConfig
)
}
}
func
(
rew
*
rewriter
)
copyPart
(
ctx
context
.
Context
,
name
string
,
p
*
multipart
.
Part
)
error
{
func
(
rew
*
rewriter
)
copyPart
(
ctx
context
.
Context
,
name
string
,
p
*
multipart
.
Part
)
error
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment