Skip to content

Commit

Permalink
googlecloud: renamed stackdriver exporter to googlecloud (1 of 2) (#2677
Browse files Browse the repository at this point in the history
)

* git mv stackdriverexporter googlecloudexporter

* Rename stackdriver -> google cloud where applicable

* update CODEOWNERS

* make gendependabot

* fix gendependabot make target
  • Loading branch information
aabmass authored Mar 16, 2021
1 parent fcbe766 commit aa3a2c5
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 54 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ exporter/signalfxexporter/ @open-telemetry/collector-c
exporter/signalfxcorrelationexporter/ @open-telemetry/collector-contrib-approvers @jrcamp @keitwb
exporter/splunkhecexporter/ @open-telemetry/collector-contrib-approvers @atoulme
exporter/stackdriverexporter/ @open-telemetry/collector-contrib-approvers @dashpole
exporter/googlecloudexporter/ @open-telemetry/collector-contrib-approvers @dashpole
exporter/sumologicexporter/ @open-telemetry/collector-contrib-approvers @pmm-sumo @sumo-drosiek
exporter/uptraceexporter/ @open-telemetry/collector-contrib-approvers @vmihailenco

Expand Down
16 changes: 12 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ updates:
directory: "/exporter/f5cloudexporter"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/exporter/googlecloudexporter"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/exporter/honeycombexporter"
schedule:
Expand Down Expand Up @@ -94,10 +98,6 @@ updates:
directory: "/exporter/splunkhecexporter"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/exporter/stackdriverexporter"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/exporter/sumologicexporter"
schedule:
Expand All @@ -122,6 +122,10 @@ updates:
directory: "/extension/observer/k8sobserver"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/internal/aws"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/internal/awsxray"
schedule:
Expand Down Expand Up @@ -158,6 +162,10 @@ updates:
directory: "/pkg/batchperresourceattr"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/pkg/batchpersignal"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/pkg/batchpertrace"
schedule:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ DEPENDABOT_PATH=".github/dependabot.yml"
.PHONY: gendependabot
gendependabot:
@echo "Recreate dependabot.yml file"
@echo "# File generated by \"make gendependabot\"; DO NOT EDIT.\n" > ${DEPENDABOT_PATH}
@echo -e "# File generated by \"make gendependabot\"; DO NOT EDIT.\n" > ${DEPENDABOT_PATH}
@echo "version: 2" >> ${DEPENDABOT_PATH}
@echo "updates:" >> ${DEPENDABOT_PATH}
@echo "Add entry for \"/\""
@echo " - package-ecosystem: \"gomod\"\n directory: \"/\"\n schedule:\n interval: \"weekly\"" >> ${DEPENDABOT_PATH}
@echo -e " - package-ecosystem: \"gomod\"\n directory: \"/\"\n schedule:\n interval: \"weekly\"" >> ${DEPENDABOT_PATH}
@set -e; for dir in $(ALL_MODULES); do \
(echo "Add entry for \"$${dir:1}\"" && \
echo " - package-ecosystem: \"gomod\"\n directory: \"$${dir:1}\"\n schedule:\n interval: \"weekly\"" >> ${DEPENDABOT_PATH}); \
echo -e " - package-ecosystem: \"gomod\"\n directory: \"$${dir:1}\"\n schedule:\n interval: \"weekly\"" >> ${DEPENDABOT_PATH}); \
done

GOMODULES = $(ALL_MODULES) $(PWD)
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcontribcol/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dynatraceexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/f5cloudexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/googlecloudexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/honeycombexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerthrifthttpexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter"
Expand All @@ -39,7 +40,6 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sentryexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/signalfxexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/stackdriverexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sumologicexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/httpforwarder"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/hostobserver"
Expand Down Expand Up @@ -140,6 +140,7 @@ func components() (component.Factories, error) {
dynatraceexporter.NewFactory(),
elasticexporter.NewFactory(),
f5cloudexporter.NewFactory(),
googlecloudexporter.NewFactory(),
honeycombexporter.NewFactory(),
jaegerthrifthttpexporter.NewFactory(),
loadbalancingexporter.NewFactory(),
Expand All @@ -150,7 +151,6 @@ func components() (component.Factories, error) {
sentryexporter.NewFactory(),
signalfxexporter.NewFactory(),
splunkhecexporter.NewFactory(),
stackdriverexporter.NewFactory(),
sumologicexporter.NewFactory(),
}
for _, exp := range factories.Exporters {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Stackdriver Exporter
# Google Cloud Exporter

This exporter can be used to send metrics and traces to Google Cloud Monitoring and Trace (formerly known as Stackdriver) respectively.

Expand All @@ -10,7 +10,7 @@ The following configuration options are supported:
- `use_insecure` (optional): If true. use gRPC as their communication transport. Only has effect if Endpoint is not "".
- `timeout` (optional): Timeout for all API calls. If not set, defaults to 12 seconds.
- `number_of_workers` (optional): NumberOfWorkers sets the number of go rountines that send requests. The minimum number of workers is 1.
- `resource_mappings` (optional): ResourceMapping defines mapping of resources from source (OpenCensus) to target (Stackdriver).
- `resource_mappings` (optional): ResourceMapping defines mapping of resources from source (OpenCensus) to target (Google Cloud).
- `label_mappings` (optional): Optional flag signals whether we can proceed with transformation if a label is missing in the resource.
- `retry_on_failure` (optional): Configuration for how to handle retries when sending data to Google Cloud fails.
- `enabled` (default = true)
Expand All @@ -29,14 +29,14 @@ Note: These `retry_on_failure` and `sending_queue` are provided (and documented)

Additional configuration for the metric exporter:

- `metric.prefix` (optional): MetricPrefix overrides the prefix / namespace of the Stackdriver metric type identifier. If not set, defaults to "custom.googleapis.com/opencensus/"
- `metric.prefix` (optional): MetricPrefix overrides the prefix / namespace of the Google Cloud metric type identifier. If not set, defaults to "custom.googleapis.com/opencensus/"
- `metric.skip_create_descriptor` (optional): Whether to skip creating the metric descriptor.

Example:

```yaml
exporters:
stackdriver:
googlecloud:
project: my-project
endpoint: test-endpoint
user_agent: my-collector {{version}}
Expand All @@ -48,7 +48,7 @@ exporters:
- source_type: source.resource1
target_type: target-resource1
label_mappings:
- source_key: contrib.opencensus.io/exporter/stackdriver/project_id
- source_key: contrib.opencensus.io/exporter/googlecloud/project_id
target_key: project_id
optional: true
- source_key: source.label1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package stackdriverexporter
package googlecloudexporter

import (
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"google.golang.org/api/option"
)

// Config defines configuration for Stackdriver exporter.
// Config defines configuration for Google Cloud exporter.
type Config struct {
configmodels.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
ProjectID string `mapstructure:"project"`
Expand Down Expand Up @@ -49,7 +49,7 @@ type MetricConfig struct {
SkipCreateMetricDescriptor bool `mapstructure:"skip_create_descriptor"`
}

// ResourceMapping defines mapping of resources from source (OpenCensus) to target (Stackdriver).
// ResourceMapping defines mapping of resources from source (OpenCensus) to target (Google Cloud).
type ResourceMapping struct {
SourceType string `mapstructure:"source_type"`
TargetType string `mapstructure:"target_type"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package stackdriverexporter
package googlecloudexporter

import (
"path"
Expand Down Expand Up @@ -42,13 +42,13 @@ func TestLoadConfig(t *testing.T) {

assert.Equal(t, len(cfg.Exporters), 2)

r0 := cfg.Exporters["stackdriver"]
r0 := cfg.Exporters["googlecloud"]
assert.Equal(t, r0, factory.CreateDefaultConfig())

r1 := cfg.Exporters["stackdriver/customname"].(*Config)
r1 := cfg.Exporters["googlecloud/customname"].(*Config)
assert.Equal(t, r1,
&Config{
ExporterSettings: configmodels.ExporterSettings{TypeVal: configmodels.Type(typeStr), NameVal: "stackdriver/customname"},
ExporterSettings: configmodels.ExporterSettings{TypeVal: configmodels.Type(typeStr), NameVal: "googlecloud/customname"},
ProjectID: "my-project",
UserAgent: "opentelemetry-collector-contrib {{version}}",
Endpoint: "test-endpoint",
Expand All @@ -62,7 +62,7 @@ func TestLoadConfig(t *testing.T) {
TargetType: "target-resource1",
LabelMappings: []LabelMapping{
{
SourceKey: "contrib.opencensus.io/exporter/stackdriver/project_id",
SourceKey: "contrib.opencensus.io/exporter/googlecloud/project_id",
TargetKey: "project_id",
Optional: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package stackdriverexporter
package googlecloudexporter

import (
"context"
Expand All @@ -27,13 +27,13 @@ import (

const (
// The value of "type" key in configuration.
typeStr = "stackdriver"
typeStr = "googlecloud"
defaultTimeout = 12 * time.Second // Consistent with Cloud Monitoring's timeout
)

var once sync.Once

// NewFactory creates a factory for the stackdriver exporter
// NewFactory creates a factory for the googlecloud exporter
func NewFactory() component.ExporterFactory {
// register view for self-observability
once.Do(func() {
Expand Down Expand Up @@ -68,7 +68,7 @@ func createTraceExporter(
params component.ExporterCreateParams,
cfg configmodels.Exporter) (component.TracesExporter, error) {
eCfg := cfg.(*Config)
return newStackdriverTraceExporter(eCfg, params)
return newGoogleCloudTraceExporter(eCfg, params)
}

// createMetricsExporter creates a metrics exporter based on this config.
Expand All @@ -77,5 +77,5 @@ func createMetricsExporter(
params component.ExporterCreateParams,
cfg configmodels.Exporter) (component.MetricsExporter, error) {
eCfg := cfg.(*Config)
return newStackdriverMetricsExporter(eCfg, params)
return newGoogleCloudMetricsExporter(eCfg, params)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package stackdriverexporter
package googlecloudexporter

import (
"context"
Expand All @@ -34,7 +34,7 @@ func TestCreateDefaultConfig(t *testing.T) {

func TestCreateExporter(t *testing.T) {
if os.Getenv("GOOGLE_APPLICATION_CREDENTIALS") == "" {
t.Skip("Default credentials not set, skip creating Stackdriver exporter")
t.Skip("Default credentials not set, skip creating Google Cloud exporter")
}
ctx := context.Background()
factory := NewFactory()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/stackdriverexporter
module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/googlecloudexporter

go 1.14

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package stackdriverexporter contains the wrapper for OpenTelemetry-Stackdriver
// Package googlecloudexporter contains the wrapper for OpenTelemetry-GoogleCloud
// exporter to be used in opentelemetry-collector.
package stackdriverexporter
package googlecloudexporter

import (
"context"
Expand Down Expand Up @@ -87,7 +87,7 @@ func generateClientOptions(cfg *Config) ([]option.ClientOption, error) {
return copts, nil
}

func newStackdriverTraceExporter(cfg *Config, params component.ExporterCreateParams) (component.TracesExporter, error) {
func newGoogleCloudTraceExporter(cfg *Config, params component.ExporterCreateParams) (component.TracesExporter, error) {
setVersionInUserAgent(cfg, params.ApplicationStartInfo.Version)

topts := []cloudtrace.Option{
Expand All @@ -103,7 +103,7 @@ func newStackdriverTraceExporter(cfg *Config, params component.ExporterCreatePar

exp, err := cloudtrace.NewExporter(topts...)
if err != nil {
return nil, fmt.Errorf("error creating Stackdriver Trace exporter: %w", err)
return nil, fmt.Errorf("error creating GoogleCloud Trace exporter: %w", err)
}

tExp := &traceExporter{texporter: exp}
Expand All @@ -120,11 +120,11 @@ func newStackdriverTraceExporter(cfg *Config, params component.ExporterCreatePar
exporterhelper.WithRetry(cfg.RetrySettings))
}

func newStackdriverMetricsExporter(cfg *Config, params component.ExporterCreateParams) (component.MetricsExporter, error) {
func newGoogleCloudMetricsExporter(cfg *Config, params component.ExporterCreateParams) (component.MetricsExporter, error) {
setVersionInUserAgent(cfg, params.ApplicationStartInfo.Version)

// TODO: For each ProjectID, create a different exporter
// or at least a unique Stackdriver client per ProjectID.
// or at least a unique Google Cloud client per ProjectID.
options := stackdriver.Options{
// If the project ID is an empty string, it will be set by default based on
// the project this is running on in GCP.
Expand Down Expand Up @@ -162,7 +162,7 @@ func newStackdriverMetricsExporter(cfg *Config, params component.ExporterCreateP

sde, serr := stackdriver.NewExporter(options)
if serr != nil {
return nil, fmt.Errorf("cannot configure Stackdriver metric exporter: %w", serr)
return nil, fmt.Errorf("cannot configure Google Cloud metric exporter: %w", serr)
}
mExp := &metricsExporter{mexporter: sde}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package stackdriverexporter
package googlecloudexporter

import (
"context"
Expand Down Expand Up @@ -55,7 +55,7 @@ func (ts *testServer) CreateSpan(context.Context, *cloudtracepb.Span) (*cloudtra
return nil, nil
}

func TestStackdriverTraceExport(t *testing.T) {
func TestGoogleCloudTraceExport(t *testing.T) {
type testCase struct {
name string
cfg *Config
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestStackdriverTraceExport(t *testing.T) {
go srv.Serve(lis)

createParams := component.ExporterCreateParams{Logger: zap.NewNop(), ApplicationStartInfo: component.ApplicationStartInfo{Version: "v0.0.1"}}
sde, err := newStackdriverTraceExporter(test.cfg, createParams)
sde, err := newGoogleCloudTraceExporter(test.cfg, createParams)
if test.expectedErr != "" {
assert.EqualError(t, err, test.expectedErr)
return
Expand Down Expand Up @@ -164,7 +164,7 @@ func (ms *mockMetricServer) CreateTimeSeries(ctx context.Context, req *cloudmoni
return &emptypb.Empty{}, nil
}

func TestStackdriverMetricExport(t *testing.T) {
func TestGoogleCloudMetricExport(t *testing.T) {
srv := grpc.NewServer()

descriptorReqCh := make(chan *requestWithMetadata)
Expand All @@ -185,7 +185,7 @@ func TestStackdriverMetricExport(t *testing.T) {
option.WithTelemetryDisabled(),
}

sde, err := newStackdriverMetricsExporter(&Config{
sde, err := newGoogleCloudMetricsExporter(&Config{
ProjectID: "idk",
Endpoint: "127.0.0.1:8080",
UserAgent: "MyAgent {{version}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package stackdriverexporter
package googlecloudexporter

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package stackdriverexporter
package googlecloudexporter

import (
"contrib.go.opencensus.io/exporter/stackdriver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package stackdriverexporter
package googlecloudexporter

import (
"testing"
Expand Down
Loading

0 comments on commit aa3a2c5

Please sign in to comment.