Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
664e03f
refact metadata
FoghostCn Nov 22, 2023
bf150ce
fix cycle import
FoghostCn Nov 24, 2023
54116b3
Initially completed
FoghostCn Nov 25, 2023
dda0ba8
register success
FoghostCn Nov 28, 2023
f2134b4
refect serviceDiscoveryRegistry Server size api
FoghostCn Nov 29, 2023
20d02c0
move customizer to service discovery dir
FoghostCn Nov 29, 2023
d13afea
client call success
FoghostCn Dec 2, 2023
77983e5
mv metadata client to metadata dir
FoghostCn Dec 2, 2023
41f7474
refactor
FoghostCn Dec 5, 2023
5eadaae
refactor metadata exporter
FoghostCn Dec 11, 2023
2ac1b8e
mv metadata client to metadata dir
FoghostCn Dec 11, 2023
6b2fd9d
mv metadata info to metadata module
FoghostCn Dec 11, 2023
157e9c2
associate metadataReport with registry
FoghostCn Jan 2, 2024
8ab3557
unit test not done
FoghostCn Jan 4, 2024
a179a3d
update warn log
FoghostCn Jan 5, 2024
1a11af1
unit test tmp fix
FoghostCn Jan 5, 2024
c29963b
fix integrate_test
FoghostCn Jan 5, 2024
25d8711
fix some logic
FoghostCn Jan 8, 2024
e3ef66e
change RegistryType default value
FoghostCn Jan 9, 2024
88a537d
code review fix
FoghostCn Jan 15, 2024
328eeeb
change metadata to options style
FoghostCn Jan 16, 2024
d7097b1
fix unit test
FoghostCn Jan 16, 2024
5c6e8d7
fix integration test
FoghostCn Jan 16, 2024
e461a39
add doc for metadata report option WithAddress
FoghostCn Jan 22, 2024
ee77794
Merge branch 'main' into refect-metadata
FoghostCn Jan 23, 2024
b0c75a5
modify README.md (#2585)
FinalT Jan 26, 2024
a134e1b
feat:add internal service extension (#2577)
FinalT Jan 26, 2024
23bdc04
Merge remote-tracking branch 'origin/main' into refect-metadata
FoghostCn Jan 29, 2024
38a1cf0
Merge branch 'main' into refect-metadata
FoghostCn Jan 29, 2024
e283246
Merge branch 'dev-3.3' into refect-metadata
FoghostCn Feb 18, 2024
da7de7f
Merge branch 'dev-3.3' into refect-metadata
chickenlj Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move customizer to service discovery dir
add host port customizer
add licence
  • Loading branch information
FoghostCn committed Jan 16, 2024
commit 20d02c09aad530fa47568c8d339de2be20e90aad
17 changes: 17 additions & 0 deletions metadata/exporter/service_exporter.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package exporter

import (
Expand Down
17 changes: 17 additions & 0 deletions metadata/info/metadata_info_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package info

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package event
package customizer

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package event
package customizer

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package event
package customizer

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package customizer

import (
"dubbo.apache.org/dubbo-go/v3/common/extension"
"dubbo.apache.org/dubbo-go/v3/registry"
"strconv"
)

func init() {
extension.AddCustomizers(&hostPortCustomizer{})
}

type hostPortCustomizer struct{}

// GetPriority will return 1 so that it will be invoked in front of user defining Customizer
func (e *hostPortCustomizer) GetPriority() int {
return 1
}

// Customize calculate the revision for exported urls and then put it into instance metadata
func (e *hostPortCustomizer) Customize(instance registry.ServiceInstance) {
if instance.GetPort() > 0 {
return
}
if instance.GetServiceMetadata() == nil || len(instance.GetServiceMetadata().GetExportedServiceURLs()) == 0 {
return
}
for _, url := range instance.GetServiceMetadata().GetExportedServiceURLs() {
if ins, ok := instance.(*registry.DefaultServiceInstance); ok {
ins.Host = url.Ip
p, err := strconv.Atoi(url.Port)
if err == nil {
ins.Port = p
}
break
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package event
package customizer

import (
"fmt"
Expand Down
6 changes: 3 additions & 3 deletions registry/servicediscovery/service_discovery_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ import (
"dubbo.apache.org/dubbo-go/v3/metadata/mapping"
"dubbo.apache.org/dubbo-go/v3/metadata/report/instance"
"dubbo.apache.org/dubbo-go/v3/metrics"
metricMetadata "dubbo.apache.org/dubbo-go/v3/metrics/metadata"
metricsMetadata "dubbo.apache.org/dubbo-go/v3/metrics/metadata"
metricsRegistry "dubbo.apache.org/dubbo-go/v3/metrics/registry"
"dubbo.apache.org/dubbo-go/v3/registry"
_ "dubbo.apache.org/dubbo-go/v3/registry/event"
_ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery/customizer"
"dubbo.apache.org/dubbo-go/v3/registry/servicediscovery/synthesizer"
)

Expand Down Expand Up @@ -243,7 +243,7 @@ func (s *serviceDiscoveryRegistry) SubscribeURL(url *common.URL, notify registry
}
s.serviceListeners[serviceNamesKey] = listener
listener.AddListenerAndNotify(protocolServiceKey, notify)
event := metricMetadata.NewMetadataMetricTimeEvent(metricMetadata.SubscribeServiceRt)
event := metricsMetadata.NewMetadataMetricTimeEvent(metricsMetadata.SubscribeServiceRt)

logger.Infof("Start subscribing to registry for applications :%s with a new go routine.", serviceNamesKey)
go func() {
Expand Down
17 changes: 17 additions & 0 deletions registry/servicediscovery/service_metadata.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package servicediscovery

import (
Expand Down