Skip to content

Commit

Permalink
Upgreade triple pb generate tool (#1549)
Browse files Browse the repository at this point in the history
* fix: update protoc-gen-go-triple

* fix: remove unused file

* fix: metrics update

* fix: linter
  • Loading branch information
LaurenceLiZhixin authored Oct 30, 2021
1 parent 7f1521c commit 669ab0a
Show file tree
Hide file tree
Showing 23 changed files with 401 additions and 499 deletions.
2 changes: 1 addition & 1 deletion common/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func InitLogger(conf *Config) {
EncodeCaller: zapcore.ShortCallerEncoder,
}
config.ZapConfig = &zap.Config{
Level: zap.NewAtomicLevelAt(zap.DebugLevel),
Level: zap.NewAtomicLevelAt(zap.InfoLevel),
Development: false,
Encoding: "console",
EncoderConfig: zapLoggerEncoderConfig,
Expand Down
2 changes: 1 addition & 1 deletion config/application_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ApplicationConfig struct {
Organization string `default:"dubbo-go" yaml:"organization" json:"organization,omitempty" property:"organization"`
Name string `default:"dubbo.io" yaml:"name" json:"name,omitempty" property:"name"`
Module string `default:"sample" yaml:"module" json:"module,omitempty" property:"module"`
Version string `default:"0.0.1" yaml:"version" json:"version,omitempty" property:"version"`
Version string `default:"3.0.0" yaml:"version" json:"version,omitempty" property:"version"`
Owner string `default:"dubbo-go" yaml:"owner" json:"owner,omitempty" property:"owner"`
Environment string `default:"dev" yaml:"environment" json:"environment,omitempty" property:"environment"`
// the metadata type. remote or local
Expand Down
156 changes: 0 additions & 156 deletions config/config_api_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion config/config_center_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (c *CenterConfig) GetDynamicConfiguration() (config_center.DynamicConfigura
}
dynamicConfig, err := c.CreateDynamicConfiguration()
if err != nil {
logger.Errorf("Create dynamic configuration error , error message is %v", err)
logger.Warnf("Create dynamic configuration error , error message is %v", err)
return nil, errors.WithStack(err)
}
c.DynamicConfiguration = dynamicConfig
Expand Down
2 changes: 2 additions & 0 deletions config/config_center_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ package config
import (
"testing"
)

import (
"github.com/stretchr/testify/assert"
)

import (
_ "dubbo.apache.org/dubbo-go/v3/config_center/apollo"
)
Expand Down
2 changes: 1 addition & 1 deletion config/consumer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (cc *ConsumerConfig) Load() {
checkok = false
count++
if count > maxWait {
errMsg := fmt.Sprintf("Request timed out, please check configuration, Failed to check the status of the service %v. No provider available for the service to the consumer use dubbo version %v", refconfig.InterfaceName, constant.Version)
errMsg := fmt.Sprintf("No provider available of the service %v.please check configuration.", refconfig.InterfaceName)
logger.Error(errMsg)
panic(errMsg)
}
Expand Down
2 changes: 1 addition & 1 deletion config/graceful_shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import (
*/
const defaultShutDownTime = time.Second * 60

// nolint
// GracefulShutdownInit todo GracefulShutdownInit in 3.0 should be discusesed.
func GracefulShutdownInit() {
signals := make(chan os.Signal, 1)

Expand Down
2 changes: 1 addition & 1 deletion config/logger_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
)

type ZapConfig struct {
Level string `default:"debug" json:"level,omitempty" yaml:"level" property:"level"`
Level string `default:"info" json:"level,omitempty" yaml:"level" property:"level"`
Development bool `default:"false" json:"development,omitempty" yaml:"development" property:"development"`
DisableCaller bool `default:"false" json:"disable-caller,omitempty" yaml:"disable-caller" property:"disable-caller"`
DisableStacktrace bool `default:"false" json:"disable-stacktrace,omitempty" yaml:"disable-stacktrace" property:"disable-stacktrace"`
Expand Down
25 changes: 10 additions & 15 deletions config/metadata_report_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ import (

// MetadataReportConfig is app level configuration
type MetadataReportConfig struct {
Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty"`
Address string `required:"true" yaml:"address" json:"address"`
Username string `yaml:"username" json:"username,omitempty"`
Password string `yaml:"password" json:"password,omitempty"`
Timeout string `yaml:"timeout" json:"timeout,omitempty"`
Group string `yaml:"group" json:"group,omitempty"`
MetadataType string `default:"local" yaml:"metadata-type" json:"metadata-type"`
Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty"`
Address string `required:"true" yaml:"address" json:"address"`
Username string `yaml:"username" json:"username,omitempty"`
Password string `yaml:"password" json:"password,omitempty"`
Timeout string `yaml:"timeout" json:"timeout,omitempty"`
Group string `yaml:"group" json:"group,omitempty"`
// metadataType of this application is defined by application config, local or remote
metadataType string
}

// Prefix dubbo.consumer
Expand All @@ -49,7 +50,7 @@ func (mc *MetadataReportConfig) Init(rc *RootConfig) error {
if mc == nil {
return nil
}
mc.MetadataType = rc.Application.MetadataType
mc.metadataType = rc.Application.MetadataType
return mc.StartMetadataReport()
}

Expand All @@ -59,7 +60,7 @@ func (mc *MetadataReportConfig) ToUrl() (*common.URL, error) {
common.WithPassword(mc.Password),
common.WithLocation(mc.Address),
common.WithProtocol(mc.Protocol),
common.WithParamsValue(constant.METADATATYPE_KEY, mc.MetadataType),
common.WithParamsValue(constant.METADATATYPE_KEY, mc.metadataType),
)
if err != nil || len(res.Protocol) == 0 {
return nil, perrors.New("Invalid MetadataReport Config.")
Expand Down Expand Up @@ -171,12 +172,6 @@ func (mrcb *MetadataReportConfigBuilder) SetGroup(group string) *MetadataReportC
return mrcb
}

// nolint
func (mrcb *MetadataReportConfigBuilder) SetMetadataType(metadataType string) *MetadataReportConfigBuilder {
mrcb.metadataReportConfig.MetadataType = metadataType
return mrcb
}

// nolint
func (mrcb *MetadataReportConfigBuilder) Build() *MetadataReportConfig {
// TODO Init
Expand Down
9 changes: 0 additions & 9 deletions config/method_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,3 @@ func (mc *MethodConfig) check() error {
}
return verify(mc)
}

// UnmarshalYAML unmarshals the MethodConfig by @unmarshal function
//func (c *MethodConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
// if err := defaults.Set(c); err != nil {
// return err
// }
// type plain MethodConfig
// return unmarshal((*plain)(c))
//}
27 changes: 0 additions & 27 deletions config/metric_config_test.go

This file was deleted.

1 change: 0 additions & 1 deletion config_center/apollo/mockDubbogo.yaml.json

This file was deleted.

6 changes: 0 additions & 6 deletions filter/metrics/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ func init() {
}

// Filter will calculate the invocation's duration and the report to the reporters
// If you want to use this filter to collect the metrics,
// Adding this into your configuration file, like:
// filter: "metrics"
// metrics:
// reporter:
// - "your reporter" # here you should specify the reporter, for example 'prometheus'
// more info please take a look at dubbo-samples projects
type Filter struct {
reporters []metrics.Reporter
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/creasty/defaults v1.5.2
github.com/dubbogo/go-zookeeper v1.0.3
github.com/dubbogo/gost v1.11.19
github.com/dubbogo/triple v1.0.8
github.com/dubbogo/triple v1.0.9
github.com/emicklei/go-restful/v3 v3.7.1
github.com/fsnotify/fsnotify v1.5.1
github.com/ghodss/yaml v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ github.com/dubbogo/gost v1.11.19/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZT
github.com/dubbogo/jsonparser v1.0.1/go.mod h1:tYAtpctvSP/tWw4MeelsowSPgXQRVHHWbqL6ynps8jU=
github.com/dubbogo/net v0.0.4 h1:Rn9aMPZwOiRE22YhtxmDEE3H0Q3cfVRNhuEjNMelJ/8=
github.com/dubbogo/net v0.0.4/go.mod h1:1CGOnM7X3he+qgGNqjeADuE5vKZQx/eMSeUkpU3ujIc=
github.com/dubbogo/triple v1.0.8 h1:M3p2t+Bx6z1RbVMm4GjrZKFpe8Ar0g6J0m/6fYU46tQ=
github.com/dubbogo/triple v1.0.8/go.mod h1:1t9me4j4CTvNDcsMZy6/OGarbRyAUSY0tFXGXHCp7Iw=
github.com/dubbogo/triple v1.0.9 h1:piScEoTxmowYYFtLqPuYa0SojdSqe/+WNeGbMNkIXn4=
github.com/dubbogo/triple v1.0.9/go.mod h1:1t9me4j4CTvNDcsMZy6/OGarbRyAUSY0tFXGXHCp7Iw=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
Expand Down
Loading

0 comments on commit 669ab0a

Please sign in to comment.