diff --git a/Makefile b/Makefile index a2120dad4..862743f7d 100755 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ unit-tests-dig: cd platform/view/sdk/dig; go test -cover ./... cd platform/fabric/sdk/dig; go test -cover ./... -run-optl: +run-otlp: cd platform/view/services/tracing; docker-compose up -d INTEGRATION_TARGETS = diff --git a/docs/configuration.md b/docs/configuration.md index dbe88d1c8..583687714 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -157,14 +157,14 @@ fsc: # ------------------- Tracing Configuration ------------------------- tracing: - # Type of provider to be used: none (default), file, optl, console - provider: optl + # Type of provider to be used: none (default), file, otlp, console + provider: otlp # Tracer configuration when provider == 'file' file: # The file where the traces are going to be stored path: /path/to/client/trace.out - # Tracer configuration when provider == 'optl' - optl: + # Tracer configuration when provider == 'otlp' + otlp: # The address of collector where we should send the traces address: 127.0.0.1:8125 sampling: @@ -432,7 +432,7 @@ CORE_LOGGING_LEVEL=debug CORE_FSC_P2P_LISTENADDRESS=/ip4/0.0.0.0/tcp/9001 CORE_FSC_IDENTITY_KEY_FILE=/my/private.key CORE_FSC_KVS_PERSISTENCE_OPTS_DATASOURCE=/mydb.sqlite -CORE_FSC_TRACING_OPTL_ADDRESS=jaeger.example.com:4318 +CORE_FSC_TRACING_OTLP_ADDRESS=jaeger.example.com:4318 CORE_FABRIC_MYNETWORK_KEEPALIVE_TIMEOUT=120s ``` diff --git a/docs/platform/view/monitoring.md b/docs/platform/view/monitoring.md index bcd409b0d..0e7338a0e 100644 --- a/docs/platform/view/monitoring.md +++ b/docs/platform/view/monitoring.md @@ -148,7 +148,7 @@ FSC defines the following implementations, although custom implementations can b * **NoOp:** Disables the tracer, when `fsc.tracing.provider = none` * **Console:** Exports (prints) the traces on the console, when `fsc.tracing.provider = console` * **File:** Exports (stores) the traces into the file `fsc.tracing.file.path`, when `fsc.tracing.provider = file` -* **OTPL:** Exports (sends) the traces to an OTPL collector that listens on the port `fsc.tracing.optl.address` when `fsc.tracing.provider = optl` +* **OTLP:** Exports (sends) the traces to an OTLP collector that listens on the port `fsc.tracing.otlp.address` when `fsc.tracing.provider = otlp` These supported tracer providers can be instantiated using `tracing.NewTracerProviderFromConfig`. Using this constructor, along with the type of the exporter, we can also specify other parameters, like the sampling rate. @@ -159,7 +159,7 @@ Whenever we start spans, we keep track of the count and the duration of the oper ### Adding traces -The base unit of the traces are the spans. A span represents a unit of work. In our code, we only start new spans and then these spans are linked to compose traces by the remote agent (in case we use OTPL as provider). +The base unit of the traces are the spans. A span represents a unit of work. In our code, we only start new spans and then these spans are linked to compose traces by the remote agent (in case we use OTLP as provider). 1. For instance, in the case of a transfer, the transfer operation is conceptually a trace. The first span of this trace can be created on the end user that initiates the client (e.g. alice). 2. When the request arrives to the recipient (e.g. bob), another span can be initiated when the corresponding view is invoked. @@ -300,5 +300,5 @@ Reading single spans from the console or a file is cumbersome and this is why we * visualize the traces on a UI Although these components are separate and have distinct responsibilities, there is a docker image that combines all of them: `jaegertracing/all-in-one:latest`. -The `jaeger_collector` sub-image listens on a port for new spans. The application exports (sends) the spans to that endpoint (defined in `fsc.tracing.optl.address`). +The `jaeger_collector` sub-image listens on a port for new spans. The application exports (sends) the spans to that endpoint (defined in `fsc.tracing.otlp.address`). The `jaeger_ui` serves an application with querying and trace-visualization capabilities. diff --git a/integration/fabric/iou/topology.go b/integration/fabric/iou/topology.go index 46966350e..df334bcda 100644 --- a/integration/fabric/iou/topology.go +++ b/integration/fabric/iou/topology.go @@ -43,7 +43,7 @@ func Topology(opts *Opts) []api.Topology { // fscTopology.SetLogging("debug", "") // fscTopology.SetLogging("debug", "") - fscTopology.EnableTracing(tracing.Otpl) + fscTopology.EnableTracing(tracing.Otlp) // Add the approver FSC node. fscTopology.AddNodeByName("approver1"). @@ -88,7 +88,7 @@ func Topology(opts *Opts) []api.Topology { // Monitoring monitoringTopology := monitoring.NewTopology() monitoringTopology.EnablePrometheusGrafana() - monitoringTopology.EnableOPTL() + monitoringTopology.EnableOTLP() // Add Fabric SDK to FSC Nodes fscTopology.AddSDK(opts.SDK) diff --git a/integration/fabricx/iou/topology.go b/integration/fabricx/iou/topology.go index eb66a0f6a..9fee807eb 100644 --- a/integration/fabricx/iou/topology.go +++ b/integration/fabricx/iou/topology.go @@ -34,7 +34,7 @@ func Topology(sdk node.SDK, commType fsc.P2PCommunicationType, replicationOpts * fscTopology.SetLogging("grpc=error:fabricx=info:info", "") // fscTopology.SetLogging("debug", "") - // fscTopology.EnableOPTLTracing() + // fscTopology.EnableOTLPTracing() // Add the approver FSC node. fscTopology.AddNodeByName("approver1"). @@ -76,7 +76,7 @@ func Topology(sdk node.SDK, commType fsc.P2PCommunicationType, replicationOpts * // Monitoring // monitoringTopology := monitoring.NewTopology() - // monitoringTopology.EnableOPTL() + // monitoringTopology.EnableOTLP() // Add Fabric SDK to FSC Nodes fscTopology.AddSDK(sdk) diff --git a/integration/fsc/stoprestart/topology.go b/integration/fsc/stoprestart/topology.go index e0e5c4fc5..47dc7a48d 100644 --- a/integration/fsc/stoprestart/topology.go +++ b/integration/fsc/stoprestart/topology.go @@ -19,7 +19,7 @@ func Topology(commType fsc.P2PCommunicationType, replicationOpts *integration.Re // Create an empty FSC topology topology := fsc.NewTopology() topology.P2PCommunicationType = commType - topology.EnableTracing(tracing.Otpl) + topology.EnableTracing(tracing.Otlp) topology.EnablePrometheusMetrics() topology.AddNodeByName("alice"). @@ -35,7 +35,7 @@ func Topology(commType fsc.P2PCommunicationType, replicationOpts *integration.Re monitoringTopology := monitoring.NewTopology() // monitoringTopology.EnablePrometheusGrafana() - monitoringTopology.EnableOPTL() + monitoringTopology.EnableOTLP() return []api.Topology{topology, monitoringTopology} } diff --git a/integration/nwo/fsc/fsc.go b/integration/nwo/fsc/fsc.go index b3ea57d71..307fe5db4 100755 --- a/integration/nwo/fsc/fsc.go +++ b/integration/nwo/fsc/fsc.go @@ -29,7 +29,7 @@ import ( runner2 "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/common/runner" "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc/commands" node2 "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc/node" - "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/optl" + "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/otlp" "github.com/hyperledger-labs/fabric-smart-client/platform/common/services/logging" "github.com/hyperledger-labs/fabric-smart-client/platform/common/utils" "github.com/hyperledger-labs/fabric-smart-client/platform/common/utils/collections" @@ -243,8 +243,8 @@ func (p *Platform) PostRun(bool) { File: tracing2.FileConfig{ Path: "./client-trace.out", }, - Otpl: tracing2.OtplConfig{ - Address: fmt.Sprintf("0.0.0.0:%d", optl.JaegerCollectorPort), + Otlp: tracing2.OtlpConfig{ + Address: fmt.Sprintf("0.0.0.0:%d", otlp.JaegerCollectorPort), }, }) if err != nil { @@ -528,7 +528,7 @@ func (p *Platform) GenerateCoreConfig(peer *node2.Replica) { "Resolvers": func() []*Resolver { return resolvers }, "WebEnabled": func() bool { return p.Topology.WebEnabled }, "TracingEndpoint": func() string { - return utils.DefaultString(p.Topology.Monitoring.TracingEndpoint, fmt.Sprintf("0.0.0.0:%d", optl.JaegerCollectorPort)) + return utils.DefaultString(p.Topology.Monitoring.TracingEndpoint, fmt.Sprintf("0.0.0.0:%d", otlp.JaegerCollectorPort)) }, "SamplingRatio": func() float64 { return p.Topology.Monitoring.TracingSamplingRatio }, }). diff --git a/integration/nwo/fsc/node/core_template.go b/integration/nwo/fsc/node/core_template.go index 7d377feca..f496bbcf2 100755 --- a/integration/nwo/fsc/node/core_template.go +++ b/integration/nwo/fsc/node/core_template.go @@ -137,14 +137,14 @@ fsc: files: - {{ .NodeLocalTLSDir Peer }}/ca.crt tracing: - # Type of provider to be used: none (default), file, optl, console + # Type of provider to be used: none (default), file, otlp, console provider: {{ Topology.Monitoring.TracingType }} # Tracer configuration when provider == 'file' file: # The file where the traces are going to be stored path: {{ .NodeDir Replica }}/trace.out - # Tracer configuration when provider == 'optl' - optl: + # Tracer configuration when provider == 'otlp' + otlp: # The address of collector where we should send the traces address: {{ TracingEndpoint }} sampling: diff --git a/integration/nwo/monitoring/optl/config.go b/integration/nwo/monitoring/otlp/config.go similarity index 98% rename from integration/nwo/monitoring/optl/config.go rename to integration/nwo/monitoring/otlp/config.go index 20600dfd7..5d345d282 100644 --- a/integration/nwo/monitoring/optl/config.go +++ b/integration/nwo/monitoring/otlp/config.go @@ -4,7 +4,7 @@ Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -package optl +package otlp const ConfigTemplate = `receivers: otlp: diff --git a/integration/nwo/monitoring/optl/docker-compose.yaml b/integration/nwo/monitoring/otlp/docker-compose.yaml similarity index 100% rename from integration/nwo/monitoring/optl/docker-compose.yaml rename to integration/nwo/monitoring/otlp/docker-compose.yaml diff --git a/integration/nwo/monitoring/optl/docker.go b/integration/nwo/monitoring/otlp/docker.go similarity index 97% rename from integration/nwo/monitoring/optl/docker.go rename to integration/nwo/monitoring/otlp/docker.go index 8821c3b59..8b0b543d7 100644 --- a/integration/nwo/monitoring/optl/docker.go +++ b/integration/nwo/monitoring/otlp/docker.go @@ -4,7 +4,7 @@ Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -package optl +package otlp import ( "context" @@ -91,5 +91,5 @@ func (n *Extension) startJaeger() { gomega.Expect(cli.ContainerStart(ctx, resp.ID, container.StartOptions{})).ToNot(gomega.HaveOccurred()) logger.Infof("Follow the traces on localhost:%d", JaegerUIPort) - gomega.Expect(docker.StartLogs(cli, resp.ID, "monitoring.optl.jaegertracing.container")).ToNot(gomega.HaveOccurred()) + gomega.Expect(docker.StartLogs(cli, resp.ID, "monitoring.otlp.jaegertracing.container")).ToNot(gomega.HaveOccurred()) } diff --git a/integration/nwo/monitoring/optl/optl.go b/integration/nwo/monitoring/otlp/optl.go similarity index 87% rename from integration/nwo/monitoring/optl/optl.go rename to integration/nwo/monitoring/otlp/optl.go index f991bdf19..eae444561 100644 --- a/integration/nwo/monitoring/optl/optl.go +++ b/integration/nwo/monitoring/otlp/optl.go @@ -4,7 +4,7 @@ Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -package optl +package otlp import ( "os" @@ -21,8 +21,8 @@ type Platform interface { GetContext() api.Context ConfigDir() string NetworkID() string - OPTL() bool - OPTLPort() int + OTLP() bool + OTLPPort() int } type Extension struct { @@ -36,13 +36,13 @@ func NewExtension(platform Platform) *Extension { } func (n *Extension) CheckTopology() { - if !n.platform.OPTL() { + if !n.platform.OTLP() { return } } func (n *Extension) GenerateArtifacts() { - if !n.platform.OPTL() { + if !n.platform.OTLP() { return } @@ -52,7 +52,7 @@ func (n *Extension) GenerateArtifacts() { } func (n *Extension) PostRun(bool) { - if !n.platform.OPTL() { + if !n.platform.OTLP() { return } @@ -63,12 +63,12 @@ func (n *Extension) PostRun(bool) { func (n *Extension) configFileDir() string { return filepath.Join( n.platform.ConfigDir(), - "optl", + "otlp", ) } func (n *Extension) configFilePath() string { - return filepath.Join(n.configFileDir(), "optl-collector-config.yaml") + return filepath.Join(n.configFileDir(), "otlp-collector-config.yaml") } func (n *Extension) jaegerHostsPath() string { diff --git a/integration/nwo/monitoring/optl/otel-collector-config.yaml b/integration/nwo/monitoring/otlp/otel-collector-config.yaml similarity index 100% rename from integration/nwo/monitoring/optl/otel-collector-config.yaml rename to integration/nwo/monitoring/otlp/otel-collector-config.yaml diff --git a/integration/nwo/monitoring/platform.go b/integration/nwo/monitoring/platform.go index 9fc5cd898..d3a751f95 100644 --- a/integration/nwo/monitoring/platform.go +++ b/integration/nwo/monitoring/platform.go @@ -16,7 +16,7 @@ import ( "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/common/docker" "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/hle" "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/monitoring" - "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/optl" + "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/otlp" "github.com/hyperledger-labs/fabric-smart-client/integration/reporting/jaeger" "github.com/hyperledger-labs/fabric-smart-client/integration/reporting/prometheus" "github.com/hyperledger-labs/fabric-smart-client/platform/common/services/logging" @@ -75,7 +75,7 @@ func New(reg api.Context, topology *Topology) *Platform { } p.AddExtension(hle.NewExtension(p)) p.AddExtension(monitoring.NewExtension(p)) - p.AddExtension(optl.NewExtension(p)) + p.AddExtension(otlp.NewExtension(p)) return p } @@ -180,10 +180,10 @@ func (p *Platform) GrafanaPort() int { return p.topology.GrafanaPort } -func (p *Platform) OPTL() bool { - return p.topology.OPTL +func (p *Platform) OTLP() bool { + return p.topology.OTLP } -func (p *Platform) OPTLPort() int { - return p.topology.OPTLPort +func (p *Platform) OTLPPort() int { + return p.topology.OTLPPort } diff --git a/integration/nwo/monitoring/topology.go b/integration/nwo/monitoring/topology.go index 66a77e50d..0e64b9425 100755 --- a/integration/nwo/monitoring/topology.go +++ b/integration/nwo/monitoring/topology.go @@ -8,7 +8,7 @@ package monitoring import ( "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/monitoring" - "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/optl" + "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/otlp" ) type Topology struct { @@ -19,8 +19,8 @@ type Topology struct { PrometheusGrafana bool `yaml:"prometheus-grafana,omitempty"` PrometheusPort int `yaml:"prometheus-port,omitempty"` GrafanaPort int `yaml:"grafana-port,omitempty"` - OPTL bool `yaml:"optl,omitempty"` - OPTLPort int `yaml:"optl-port,omitempty"` + OTLP bool `yaml:"otlp,omitempty"` + OTLPPort int `yaml:"otlp-port,omitempty"` JaegerQueryPort int `yaml:"jaeger-query-port"` } @@ -31,8 +31,8 @@ func NewTopology() *Topology { HyperledgerExplorerPort: 8080, PrometheusPort: monitoring.PrometheusPort, GrafanaPort: 3000, - OPTLPort: 4319, - JaegerQueryPort: optl.JaegerQueryPort, + OTLPPort: 4319, + JaegerQueryPort: otlp.JaegerQueryPort, } } @@ -64,10 +64,10 @@ func (t *Topology) SetGrafanaPort(port int) { t.GrafanaPort = port } -func (t *Topology) EnableOPTL() { - t.OPTL = true +func (t *Topology) EnableOTLP() { + t.OTLP = true } -func (t *Topology) SetOPTLPort(port int) { - t.OPTLPort = port +func (t *Topology) SetOTLPPort(port int) { + t.OTLPPort = port } diff --git a/integration/reporting/jaeger/client.go b/integration/reporting/jaeger/client.go index e714a427f..5ecd94543 100644 --- a/integration/reporting/jaeger/client.go +++ b/integration/reporting/jaeger/client.go @@ -10,7 +10,7 @@ import ( "context" "fmt" - "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/optl" + "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/monitoring/otlp" "github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors" "github.com/hyperledger-labs/fabric-smart-client/platform/common/utils/collections/iterators" "github.com/jaegertracing/jaeger-idl/proto-gen/api_v2" @@ -25,7 +25,7 @@ type Reporter interface { } func NewLocalReporter() (*reporter, error) { - return NewReporter(fmt.Sprintf("0.0.0.0:%d", optl.JaegerQueryPort)) + return NewReporter(fmt.Sprintf("0.0.0.0:%d", otlp.JaegerQueryPort)) } func NewReporter(address string) (*reporter, error) { diff --git a/platform/view/services/tracing/impl.go b/platform/view/services/tracing/impl.go index 735ce650d..04e99dac9 100755 --- a/platform/view/services/tracing/impl.go +++ b/platform/view/services/tracing/impl.go @@ -29,7 +29,7 @@ type TracerType string const ( None TracerType = "none" - Otpl TracerType = "otpl" + Otlp TracerType = "otlp" File TracerType = "file" Console TracerType = "console" ServiceName = "FSC" @@ -40,7 +40,7 @@ var NoOp = Config{Provider: None} type Config struct { Provider TracerType `mapstructure:"provider"` File FileConfig `mapstructure:"file"` - Otpl OtplConfig `mapstructure:"optl"` + Otlp OtlpConfig `mapstructure:"otlp"` Sampling SamplingConfig `mapstructure:"sampling"` } @@ -52,7 +52,7 @@ type FileConfig struct { Path string `mapstructure:"path"` } -type OtplConfig struct { +type OtlpConfig struct { Address string `mapstructure:"address"` } @@ -74,9 +74,9 @@ func newProviderFromConfig(c Config, serviceName string) (Provider, error) { var exporter sdktrace.SpanExporter var err error switch c.Provider { - case Otpl: - logger.Debugf("OPTL tracer provider selected") - exporter, err = grpcExporter(&c.Otpl) + case Otlp: + logger.Debugf("OTLP tracer provider selected") + exporter, err = grpcExporter(&c.Otlp) case File: logger.Debugf("File tracing provider selected") exporter, err = fileExporter(&c.File) @@ -107,11 +107,11 @@ func fileExporter(c *FileConfig) (sdktrace.SpanExporter, error) { return stdouttrace.New(stdouttrace.WithPrettyPrint(), stdouttrace.WithWriter(f)) } -func grpcExporter(c *OtplConfig) (sdktrace.SpanExporter, error) { +func grpcExporter(c *OtlpConfig) (sdktrace.SpanExporter, error) { if c == nil || len(c.Address) == 0 { return nil, errors.New("empty url") } - logger.Debugf("Tracing enabled: optl") + logger.Debugf("Tracing enabled: otlp") return otlptrace.New(context.Background(), otlptracegrpc.NewClient(otlptracegrpc.WithInsecure(), otlptracegrpc.WithEndpoint(c.Address))) }