-
Notifications
You must be signed in to change notification settings - Fork 929
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into router-enhance
- Loading branch information
Showing
64 changed files
with
2,212 additions
and
1,873 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* 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 constant | ||
|
||
// metrics type | ||
const ( | ||
MetricsRegistry = "dubbo.metrics.registry" | ||
MetricsMetadata = "dubbo.metrics.metadata" | ||
MetricsApp = "dubbo.metrics.app" | ||
MetricsConfigCenter = "dubbo.metrics.configCenter" | ||
MetricsRpc = "dubbo.metrics.rpc" | ||
) | ||
|
||
const ( | ||
TagApplicationName = "application_name" | ||
TagApplicationVersion = "application_version" | ||
TagHostname = "hostname" | ||
TagIp = "ip" | ||
TagGitCommitId = "git_commit_id" | ||
TagConfigCenter = "config_center" | ||
TagChangeType = "change_type" | ||
TagKey = "key" | ||
TagPid = "pid" | ||
TagInterface = "interface" | ||
TagMethod = "method" | ||
TagGroup = "group" | ||
TagVersion = "version" | ||
TagErrorCode = "error" | ||
) | ||
const ( | ||
MetricNamespace = "dubbo" | ||
ProtocolPrometheus = "prometheus" | ||
ProtocolDefault = ProtocolPrometheus | ||
AggregationCollectorKey = "aggregation" | ||
AggregationDefaultBucketNum = 10 | ||
AggregationDefaultTimeWindowSeconds = 120 | ||
PrometheusDefaultMetricsPath = "/metrics" | ||
PrometheusDefaultMetricsPort = "9090" | ||
PrometheusDefaultPushInterval = 30 | ||
PrometheusDefaultJobName = "default_dubbo_job" | ||
MetricFilterStartTime = "metric_filter_start_time" | ||
) | ||
|
||
const ( | ||
SideProvider = "provider" | ||
SideConsumer = "consumer" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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 extension | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
import ( | ||
"dubbo.apache.org/dubbo-go/v3/otel/trace" | ||
) | ||
|
||
import ( | ||
"github.com/dubbogo/gost/log/logger" | ||
) | ||
|
||
var traceExporterMap = make(map[string]func(config *trace.ExporterConfig) (trace.Exporter, error), 4) | ||
|
||
func SetTraceExporter(name string, createFunc func(config *trace.ExporterConfig) (trace.Exporter, error)) { | ||
traceExporterMap[name] = createFunc | ||
} | ||
|
||
func GetTraceExporter(name string, config *trace.ExporterConfig) (trace.Exporter, error) { | ||
createFunc, ok := traceExporterMap[name] | ||
if !ok { | ||
panic("Cannot find the trace provider with name " + name) | ||
} | ||
return createFunc(config) | ||
} | ||
|
||
func GetTraceShutdownCallback() func() { | ||
return func() { | ||
for name, createFunc := range traceExporterMap { | ||
if exporter, err := createFunc(nil); err == nil { | ||
if err := exporter.GetTracerProvider().Shutdown(context.Background()); err != nil { | ||
logger.Errorf("Graceful shutdown --- Failed to shutdown trace provider %s, error: %s", name, err.Error()) | ||
} else { | ||
logger.Infof("Graceful shutdown --- Tracer provider of %s", name) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.