Skip to content

Commit 31e203c

Browse files
Merge pull request snowflakedb#3 from Snowflake-Labs/tkommineni_SNOW_plugin
[Snowservices][User Metrics] Metrics Discovery Service
2 parents ff38d33 + cea6848 commit 31e203c

File tree

11 files changed

+859
-30
lines changed

11 files changed

+859
-30
lines changed

user-metrics/mdservice/Dockerfile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
################################
2+
# Build Stage
3+
################################
4+
FROM golang:latest AS build
5+
6+
WORKDIR /app
7+
8+
COPY . .
9+
10+
# Build the Go binary
11+
RUN CGO_ENABLED=0 GOOS=linux go build -o spcs .
12+
13+
################################
14+
# Final Stage
15+
################################
16+
FROM alpine:latest
17+
18+
WORKDIR /app
19+
20+
# Copy only the necessary files from the build stage
21+
COPY --from=build /app/spcs .
22+
COPY --from=build /app/config.yaml .
23+
24+
# Expose port 8080 to the outside world
25+
EXPOSE 8080
26+
27+
# Command to run the executable
28+
CMD ["/app/spcs"]

user-metrics/mdservice/Makefile

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
# Makefile for Golang HTTP server
22

33
# Name of the executable
4-
TARGET = simple-http-server
4+
TARGET = spcs-md-service
55

66
# Go commands
77
GO = go
88
GOCLEAN = $(GO) clean
99
GOTEST = $(GO) test
1010
GOBUILD = $(GO) build
11+
GORUN = $(GO) run
1112

1213
# Source files
13-
SOURCES = main.go
14+
SOURCES = spcs.go
1415

1516
all: clean build run
1617

1718
build:
18-
$(GOBUILD) -o $(TARGET) $(SOURCES)
19+
$(GOBUILD) -o $(TARGET) .
1920

2021
run:
2122
./$(TARGET)
2223

24+
test:
25+
$(GOTEST) -v
26+
2327
clean:
2428
$(GOCLEAN)
2529
rm -f $(TARGET)
26-

user-metrics/mdservice/config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
port: 8080 # Port where the discovery service is hosted

user-metrics/mdservice/go.mod

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
module spcs-md-service
2+
3+
go 1.21.5
4+
5+
require (
6+
github.com/snowflakedb/gosnowflake v1.7.0
7+
github.com/stretchr/testify v1.8.1
8+
gopkg.in/yaml.v2 v2.4.0
9+
)
10+
11+
require (
12+
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
13+
github.com/99designs/keyring v1.2.2 // indirect
14+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 // indirect
15+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect
16+
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 // indirect
17+
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c // indirect
18+
github.com/andybalholm/brotli v1.0.4 // indirect
19+
github.com/apache/arrow/go/v12 v12.0.1 // indirect
20+
github.com/apache/thrift v0.16.0 // indirect
21+
github.com/aws/aws-sdk-go-v2 v1.17.7 // indirect
22+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
23+
github.com/aws/aws-sdk-go-v2/credentials v1.13.18 // indirect
24+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.59 // indirect
25+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 // indirect
26+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 // indirect
27+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.23 // indirect
28+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect
29+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.26 // indirect
30+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25 // indirect
31+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.0 // indirect
32+
github.com/aws/aws-sdk-go-v2/service/s3 v1.31.0 // indirect
33+
github.com/aws/smithy-go v1.13.5 // indirect
34+
github.com/danieljoos/wincred v1.1.2 // indirect
35+
github.com/davecgh/go-spew v1.1.1 // indirect
36+
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
37+
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
38+
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
39+
github.com/goccy/go-json v0.10.0 // indirect
40+
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
41+
github.com/golang/snappy v0.0.4 // indirect
42+
github.com/google/flatbuffers v23.1.21+incompatible // indirect
43+
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
44+
github.com/jmespath/go-jmespath v0.4.0 // indirect
45+
github.com/klauspost/asmfmt v1.3.2 // indirect
46+
github.com/klauspost/compress v1.15.15 // indirect
47+
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
48+
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
49+
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
50+
github.com/mtibben/percent v0.2.1 // indirect
51+
github.com/pierrec/lz4/v4 v4.1.17 // indirect
52+
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
53+
github.com/pmezard/go-difflib v1.0.0 // indirect
54+
github.com/sirupsen/logrus v1.9.0 // indirect
55+
github.com/zeebo/xxh3 v1.0.2 // indirect
56+
golang.org/x/crypto v0.15.0 // indirect
57+
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect
58+
golang.org/x/mod v0.8.0 // indirect
59+
golang.org/x/net v0.18.0 // indirect
60+
golang.org/x/sync v0.1.0 // indirect
61+
golang.org/x/sys v0.14.0 // indirect
62+
golang.org/x/term v0.14.0 // indirect
63+
golang.org/x/text v0.14.0 // indirect
64+
golang.org/x/tools v0.6.0 // indirect
65+
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
66+
gopkg.in/yaml.v3 v3.0.1 // indirect
67+
)

0 commit comments

Comments
 (0)