Skip to content

Commit

Permalink
di模块增加api_v2接口
Browse files Browse the repository at this point in the history
  • Loading branch information
HeGaoYuan authored and gaoyuanhe committed Jun 27, 2024
1 parent 1ab26c6 commit 8ddf331
Show file tree
Hide file tree
Showing 268 changed files with 38,897 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
2 changes: 2 additions & 0 deletions di/commons/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,6 @@ const (
LOG_STORING_KEY = "store_status"
LOG_STORING_COMPLETED = "completed"
LOG_STORING_STORING = "storing"

GoDefaultTimeFormat = "2006-01-02 15:04:05"
)
34 changes: 34 additions & 0 deletions di/commons/logger/v2/logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package v2

import (
"context"
log "github.com/sirupsen/logrus"
"os"
)

const (
RequestIdLogFieldKey string = "X-Request-Id"
OperationLogFieldKey string = "Operation"
)

func GetLogger(context context.Context) *log.Entry {
formatter := new(log.TextFormatter)

l := &log.Logger{
Out: os.Stdout,
Formatter: formatter,
Hooks: make(log.LevelHooks),
Level: log.DebugLevel,
ExitFunc: os.Exit,
// ReportCaller 会把file(调用的具体哪一行)和func(调用的函数)同时打开
ReportCaller: true,
}
entry := log.NewEntry(l)
if v, ok := context.Value(RequestIdLogFieldKey).(string); ok {
entry = entry.WithField(RequestIdLogFieldKey, v)
}
if v, ok := context.Value(OperationLogFieldKey).(string); ok {
entry = entry.WithField(OperationLogFieldKey, v)
}
return entry
}
13 changes: 13 additions & 0 deletions di/commons/logger/v2/logger_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package v2

import (
"context"
"testing"
)

func Test1(t *testing.T) {
ctx := context.WithValue(context.Background(), "X-Request-Id", "xxxyyy111")
log := GetLogger(ctx)
log.Infof("hello, world")
log.Debugf("hello, world")
}
89 changes: 52 additions & 37 deletions di/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,80 @@ require (
github.com/IBM-Bluemix/bluemix-cli-sdk v0.6.7
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.6.7 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
github.com/aws/aws-sdk-go v1.29.11
github.com/aws/aws-sdk-go v1.42.50
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/etcd v3.3.10+incompatible
github.com/coreos/etcd v3.3.13+incompatible
github.com/dre1080/recover v0.0.0-20150930082637-1c296bbb3227
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/go-kit/kit v0.10.0
github.com/go-openapi/errors v0.19.4
github.com/go-openapi/loads v0.19.5
github.com/go-openapi/runtime v0.19.15
github.com/go-openapi/spec v0.19.7
github.com/go-openapi/strfmt v0.19.5
github.com/go-openapi/swag v0.19.8
github.com/go-openapi/validate v0.19.7
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/mock v1.4.3
github.com/golang/protobuf v1.4.1
github.com/google/uuid v1.1.1
github.com/googleapis/gnostic v0.3.1 // indirect
github.com/gorilla/websocket v1.4.0
github.com/go-openapi/errors v0.20.2
github.com/go-openapi/loads v0.21.0
github.com/go-openapi/runtime v0.21.1
github.com/go-openapi/spec v0.20.4
github.com/go-openapi/strfmt v0.21.1
github.com/go-openapi/swag v0.19.15
github.com/go-openapi/validate v0.20.3
github.com/golang/glog v1.0.0
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/jessevdk/go-flags v1.4.0
github.com/jessevdk/go-flags v1.5.0
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/kubeflow/pipelines v0.0.0-20231208180049-c5658f09ec38
github.com/mholt/archiver/v3 v3.3.0
github.com/minio/minio-go/v6 v6.0.57
github.com/modern-go/reflect2 v1.0.1
github.com/modern-go/reflect2 v1.0.2
github.com/ncw/swift v1.0.50
github.com/nicksnyder/go-i18n v1.10.1 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.5.1
github.com/prometheus/common v0.9.1
github.com/sirupsen/logrus v1.5.0
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/common v0.32.1
github.com/sirupsen/logrus v1.8.1
github.com/sony/gobreaker v0.4.1
github.com/spf13/cast v1.3.1
github.com/spf13/cobra v0.0.7
github.com/spf13/viper v1.6.2
github.com/stretchr/testify v1.5.1
github.com/spf13/cast v1.4.1
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.1
github.com/stretchr/testify v1.8.1
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf // indirect
github.com/thoas/go-funk v0.6.0
github.com/tylerb/graceful v1.2.15
github.com/urfave/cli v1.22.4
github.com/ventu-io/go-shortid v0.0.0-20171029131806-771a37caa5cf
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
google.golang.org/grpc v1.28.1
google.golang.org/protobuf v1.25.0
golang.org/x/net v0.21.0
google.golang.org/grpc v1.44.0
google.golang.org/protobuf v1.30.0
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/olivere/elastic.v5 v5.0.85
gopkg.in/yaml.v2 v2.2.8
gopkg.in/yaml.v2 v2.4.0
gorm.io/driver/mysql v1.0.2
gorm.io/gorm v1.20.2
k8s.io/api v0.18.0
k8s.io/apimachinery v0.18.0
k8s.io/client-go v0.0.0-00010101000000-000000000000
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c
k8s.io/api v0.24.3
k8s.io/apimachinery v0.24.3
k8s.io/client-go v0.24.3
k8s.io/kube-openapi v0.0.0-20220627174259-011e075b9cb8
sigs.k8s.io/structured-merge-diff/v3 v3.0.0 // indirect
)

replace k8s.io/client-go => github.com/kubernetes/client-go v0.16.8

replace github.com/googleapis/gnostic/OpenAPIv2 => github.com/googleapis/gnostic/OpenAPIv2 v0.3.1

replace github.com/nicksnyder/go-i18n/i18n => github.com/nicksnyder/go-i18n/i18n v1.10.1
replace (
//由于引入kfp后go-openapi/xxx的版本升级了,但是我们的restapi是用的旧版的go-openapi生成的,有很多函数接口发生变化了
github.com/go-openapi/analysis => github.com/go-openapi/analysis v0.19.7
github.com/go-openapi/errors => github.com/go-openapi/errors v0.19.4
github.com/go-openapi/loads => github.com/go-openapi/loads v0.19.5
github.com/go-openapi/runtime => github.com/go-openapi/runtime v0.19.15
github.com/go-openapi/spec => github.com/go-openapi/spec v0.19.7
github.com/go-openapi/strfmt => github.com/go-openapi/strfmt v0.19.5
github.com/go-openapi/swag => github.com/go-openapi/swag v0.19.8
github.com/go-openapi/validate => github.com/go-openapi/validate v0.19.7
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.3.1
github.com/googleapis/gnostic/OpenAPIv2 => github.com/googleapis/gnostic/OpenAPIv2 v0.3.1
github.com/kubeflow/pipelines v0.0.0-20231208180049-c5658f09ec38 => code.weoa.com/MLSS/MLSS-TRAINERDIPIPELINE v0.0.0-20240527134309-ded58d882198
github.com/nicksnyder/go-i18n/i18n => github.com/nicksnyder/go-i18n/i18n v1.10.1
google.golang.org/grpc => google.golang.org/grpc v1.29.0
k8s.io/api => github.com/kubernetes/api v0.16.8
k8s.io/client-go => github.com/kubernetes/client-go v0.16.8
k8s.io/kubernetes => k8s.io/kubernetes v1.11.1
)
Loading

0 comments on commit 8ddf331

Please sign in to comment.