mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-28 21:09:17 +02:00
b33edaa552
* OTLP metrics gRPC exporter * add newline * address comments
44 lines
1.8 KiB
Go
44 lines
1.8 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
//
|
|
// Licensed 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 otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric"
|
|
|
|
import (
|
|
"context"
|
|
|
|
metricpb "go.opentelemetry.io/proto/otlp/metrics/v1"
|
|
)
|
|
|
|
// Client manages connections to the collector, handles the
|
|
// transformation of data into wire format, and the transmission of that
|
|
// data to the collector.
|
|
type Client interface {
|
|
// Start should establish connection(s) to endpoint(s). It is
|
|
// called just once by the exporter, so the implementation
|
|
// does not need to worry about idempotence and locking.
|
|
Start(ctx context.Context) error
|
|
// Stop should close the connections. The function is called
|
|
// only once by the exporter, so the implementation does not
|
|
// need to worry about idempotence, but it may be called
|
|
// concurrently with UploadMetrics, so proper
|
|
// locking is required. The function serves as a
|
|
// synchronization point - after the function returns, the
|
|
// process of closing connections is assumed to be finished.
|
|
Stop(ctx context.Context) error
|
|
// UploadMetrics should transform the passed metrics to the
|
|
// wire format and send it to the collector. May be called
|
|
// concurrently.
|
|
UploadMetrics(ctx context.Context, protoMetrics []*metricpb.ResourceMetrics) error
|
|
}
|