profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/jpkrohling/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Juraci Paixão Kröhling jpkrohling Red Hat Berlin, Germany https://kroehling.de

jaegertracing/jaeger-client-java 468

Jaeger Bindings for Java OpenTracing API

jaegertracing/jaeger-kubernetes 415

Support for deploying Jaeger into Kubernetes

jaegertracing/jaeger-openshift 54

Support for deploying Jaeger into OpenShift

jaegertracing/jaeger-performance 15

Home of the Jaeger Performance tests

jaegertracing/legacy-client-java 4

Legacy com.uber.jaeger java client

harshita19244/opentelemetry-java-benchmarks 2

This repository contains a set of benchmark tests to compare the performance of the Opentelemetry and OpenTracing instrumentation libraries created using Java Microbenchmark harness (JMH) as a part of my Outreachy internship with CNCF Tracing.

IssuesEvent

issue commentopen-telemetry/opentelemetry-collector

Auth-related tasks

I have to agree: right now, given that we haven't made progress with #3745, I would be a bit concerned about having a GA without understanding what needs to be changed to accommodate that PR.

@bogdandrutu, when you have some time, can we do a pair programming session and get that sorted out?

jpkrohling

comment created time in 7 days

PullRequestReviewEvent

push eventopen-telemetry/opentelemetry-collector-releases

Juraci Paixão Kröhling

commit sha 87bccd28396752e70cf11859954e694f858b536d

Allow customization of properties (#19) Fixes #18 Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>

view details

push time in 7 days

issue closedopen-telemetry/opentelemetry-collector-releases

Allow customization of properties

The script that generates go-releaser files makes assumptions that are not always true. For instance, the container image for the core distribution defaults to "otel/otelcol:v0.35.0", when it should in fact use "otel/opentelemetry-collector:0.35.0"

closed time in 7 days

jpkrohling

issue commentopen-telemetry/opentelemetry-collector-releases

Allow customization of properties

I think people tried to get handle of that org on Docker Hub but were unable to do so: https://github.com/open-telemetry/community/issues/164

jpkrohling

comment created time in 7 days

issue commentopen-telemetry/opentelemetry-collector

Inconsistency in config for TLS vs Auth

Agree, consistency FTW!

bogdandrutu

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentopen-telemetry/opentelemetry-collector

Start using the configuration for service telemetry logs

+// 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 telemetrylogs++import (+	"flag"+	"fmt"++	"go.uber.org/zap"+	"go.uber.org/zap/zapcore"++	"go.opentelemetry.io/collector/config"+)++const (+	logLevelCfg   = "log-level"+	logProfileCfg = "log-profile"+	logFormatCfg  = "log-format"+)++var (+	// Command line pointer to logger level flag configuration.+	loggerLevelPtr   *string+	loggerProfilePtr *string+	loggerFormatPtr  *string+)++// Flags adds flags related to service telemetry logs to the given flagset.+// Deprecated: keep this flag for preventing the breaking change. Use `service::telemetry::logs` in config instead.+func Flags(flags *flag.FlagSet) {+	loggerLevelPtr = flags.String(logLevelCfg, "deprecated", "Deprecated, DO NOT USE")++	loggerProfilePtr = flags.String(logProfileCfg, "deprecated", "Deprecated, DO NOT USE")++	// Note: we use "console" by default for more human-friendly mode of logging (tab delimited, formatted timestamps).+	loggerFormatPtr = flags.String(logFormatCfg, "deprecated", "Deprecated, DO NOT USE")+}++func NewLogger(cfg config.ServiceTelemetryLogs, options []zap.Option) (*zap.Logger, error) {+	// Copied from NewProductionConfig.+	zapCfg := &zap.Config{+		Level:       zap.NewAtomicLevelAt(zap.InfoLevel),+		Development: false,+		Sampling: &zap.SamplingConfig{+			Initial:    100,+			Thereafter: 100,+		},+		Encoding:         "json",+		EncoderConfig:    zap.NewProductionEncoderConfig(),+		OutputPaths:      []string{"stderr"},+		ErrorOutputPaths: []string{"stderr"},+	}++	// Check flags in the same order as before, the default configuration starts from "prod" profile.+	if *loggerProfilePtr != "deprecated" {+		switch *loggerProfilePtr {+		case "dev":+			cfg.Level = zap.DebugLevel+			cfg.Development = false+			// Copied from NewDevelopmentConfig.+			zapCfg = &zap.Config{+				Level:            zap.NewAtomicLevelAt(zap.DebugLevel),+				Development:      true,+				Encoding:         "console",+				EncoderConfig:    zap.NewDevelopmentEncoderConfig(),+				OutputPaths:      []string{"stderr"},+				ErrorOutputPaths: []string{"stderr"},+			}+		case "prod":+			cfg.Level = zap.InfoLevel+			cfg.Development = true+		default:+			return nil, fmt.Errorf("invalid value %s for %s flag", *loggerProfilePtr, logProfileCfg)

For keys, it's OK to have %s, but for values, it might be useful to wrap in quotes, especially if the value has a space in it.

bogdandrutu

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentopen-telemetry/opentelemetry-collector-contrib

add per_cpu option to load scraper for hostmetricsreceiver

 func TestScrape(t *testing.T) {  	for _, test := range testCases { 		t.Run(test.name, func(t *testing.T) {-			scraper := newLoadScraper(context.Background(), zap.NewNop(), &Config{})+			scraper := newLoadScraper(context.Background(), zap.NewNop(), &Config{PerCPU: test.perCPU})

Kind of: the fact that your test didn't catch the bug about using the multiplier operator instead of divider proves that the test wasn't sufficient.

xp-1000

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentopen-telemetry/opentelemetry-collector

Start using the configuration for service telemetry logs

+// 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 telemetrylogs++import (+	"flag"+	"fmt"++	"go.uber.org/zap"+	"go.uber.org/zap/zapcore"++	"go.opentelemetry.io/collector/config"+)++const (+	logLevelCfg   = "log-level"+	logProfileCfg = "log-profile"+	logFormatCfg  = "log-format"+)++var (+	// Command line pointer to logger level flag configuration.+	loggerLevelPtr   *string+	loggerProfilePtr *string+	loggerFormatPtr  *string+)++// Flags adds flags related to service telemetry logs to the given flagset.+// Deprecated: keep this flag for preventing the breaking change. Use `service::telemetry::logs` in config instead.+func Flags(flags *flag.FlagSet) {+	loggerLevelPtr = flags.String(logLevelCfg, "deprecated", "Deprecated, DO NOT USE")++	loggerProfilePtr = flags.String(logProfileCfg, "deprecated", "Deprecated, DO NOT USE")++	// Note: we use "console" by default for more human-friendly mode of logging (tab delimited, formatted timestamps).+	loggerFormatPtr = flags.String(logFormatCfg, "deprecated", "Deprecated, DO NOT USE")+}++func NewLogger(cfg config.ServiceTelemetryLogs, options []zap.Option) (*zap.Logger, error) {+	// Copied from NewProductionConfig.+	zapCfg := &zap.Config{+		Level:       zap.NewAtomicLevelAt(zap.InfoLevel),+		Development: false,+		Sampling: &zap.SamplingConfig{+			Initial:    100,+			Thereafter: 100,+		},+		Encoding:         "json",+		EncoderConfig:    zap.NewProductionEncoderConfig(),+		OutputPaths:      []string{"stderr"},+		ErrorOutputPaths: []string{"stderr"},+	}++	// Check flags in the same order as before, the default configuration starts from "prod" profile.+	if *loggerProfilePtr != "deprecated" {+		switch *loggerProfilePtr {+		case "dev":+			cfg.Level = zap.DebugLevel+			cfg.Development = false+			// Copied from NewDevelopmentConfig.+			zapCfg = &zap.Config{+				Level:            zap.NewAtomicLevelAt(zap.DebugLevel),+				Development:      true,+				Encoding:         "console",+				EncoderConfig:    zap.NewDevelopmentEncoderConfig(),+				OutputPaths:      []string{"stderr"},+				ErrorOutputPaths: []string{"stderr"},+			}+		case "prod":+			cfg.Level = zap.InfoLevel+			cfg.Development = true

This is confusing. When the logging profile is dev, the config Development flag is false? And when the logging profile is prod, development is true?

bogdandrutu

comment created time in 8 days

Pull request review commentopen-telemetry/opentelemetry-collector

Start using the configuration for service telemetry logs

 func (col *Collector) setupConfigurationComponents(ctx context.Context) error { 		return fmt.Errorf("invalid configuration: %w", err) 	} +	if col.logger, err = telemetrylogs.NewLogger(cfg.Service.Telemetry.Logs, col.set.LoggingOptions); err != nil {+		return fmt.Errorf("failed to get logger: %w", err)

Anything against using errors.Wrap?

bogdandrutu

comment created time in 8 days

Pull request review commentopen-telemetry/opentelemetry-collector

Start using the configuration for service telemetry logs

+// 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 telemetrylogs++import (+	"flag"+	"fmt"++	"go.uber.org/zap"+	"go.uber.org/zap/zapcore"++	"go.opentelemetry.io/collector/config"+)++const (+	logLevelCfg   = "log-level"+	logProfileCfg = "log-profile"+	logFormatCfg  = "log-format"+)++var (+	// Command line pointer to logger level flag configuration.+	loggerLevelPtr   *string+	loggerProfilePtr *string+	loggerFormatPtr  *string+)++// Flags adds flags related to service telemetry logs to the given flagset.+// Deprecated: keep this flag for preventing the breaking change. Use `service::telemetry::logs` in config instead.+func Flags(flags *flag.FlagSet) {+	loggerLevelPtr = flags.String(logLevelCfg, "deprecated", "Deprecated, DO NOT USE")

Point the user to the right direction:

	loggerLevelPtr = flags.String(logLevelCfg, "deprecated", "Deprecated. Define the logging configuration as part of the configuration file, under the 'service' section.")
bogdandrutu

comment created time in 8 days

Pull request review commentopen-telemetry/opentelemetry-collector

Start using the configuration for service telemetry logs

+// 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 telemetrylogs++import (+	"flag"+	"fmt"++	"go.uber.org/zap"+	"go.uber.org/zap/zapcore"++	"go.opentelemetry.io/collector/config"+)++const (+	logLevelCfg   = "log-level"+	logProfileCfg = "log-profile"+	logFormatCfg  = "log-format"+)++var (+	// Command line pointer to logger level flag configuration.+	loggerLevelPtr   *string+	loggerProfilePtr *string+	loggerFormatPtr  *string+)++// Flags adds flags related to service telemetry logs to the given flagset.+// Deprecated: keep this flag for preventing the breaking change. Use `service::telemetry::logs` in config instead.+func Flags(flags *flag.FlagSet) {+	loggerLevelPtr = flags.String(logLevelCfg, "deprecated", "Deprecated, DO NOT USE")++	loggerProfilePtr = flags.String(logProfileCfg, "deprecated", "Deprecated, DO NOT USE")++	// Note: we use "console" by default for more human-friendly mode of logging (tab delimited, formatted timestamps).+	loggerFormatPtr = flags.String(logFormatCfg, "deprecated", "Deprecated, DO NOT USE")+}++func NewLogger(cfg config.ServiceTelemetryLogs, options []zap.Option) (*zap.Logger, error) {+	// Copied from NewProductionConfig.+	zapCfg := &zap.Config{+		Level:       zap.NewAtomicLevelAt(zap.InfoLevel),+		Development: false,+		Sampling: &zap.SamplingConfig{+			Initial:    100,+			Thereafter: 100,+		},+		Encoding:         "json",+		EncoderConfig:    zap.NewProductionEncoderConfig(),+		OutputPaths:      []string{"stderr"},+		ErrorOutputPaths: []string{"stderr"},+	}++	// Check flags in the same order as before, the default configuration starts from "prod" profile.+	if *loggerProfilePtr != "deprecated" {+		switch *loggerProfilePtr {+		case "dev":+			cfg.Level = zap.DebugLevel+			cfg.Development = false+			// Copied from NewDevelopmentConfig.+			zapCfg = &zap.Config{+				Level:            zap.NewAtomicLevelAt(zap.DebugLevel),+				Development:      true,+				Encoding:         "console",+				EncoderConfig:    zap.NewDevelopmentEncoderConfig(),+				OutputPaths:      []string{"stderr"},+				ErrorOutputPaths: []string{"stderr"},+			}+		case "prod":+			cfg.Level = zap.InfoLevel+			cfg.Development = true+		default:+			return nil, fmt.Errorf("invalid value %s for %s flag", *loggerProfilePtr, logProfileCfg)
			return nil, fmt.Errorf("invalid value %q for %s flag", *loggerProfilePtr, logProfileCfg)
bogdandrutu

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentopen-telemetry/opentelemetry-collector

Start using the configuration for service telemetry logs

+// 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 telemetrylogs++import (+	"flag"+	"fmt"++	"go.uber.org/zap"+	"go.uber.org/zap/zapcore"++	"go.opentelemetry.io/collector/config"+)++const (+	logLevelCfg   = "log-level"+	logProfileCfg = "log-profile"+	logFormatCfg  = "log-format"+)++var (+	// Command line pointer to logger level flag configuration.+	loggerLevelPtr   *string+	loggerProfilePtr *string+	loggerFormatPtr  *string+)++// Flags adds flags related to service telemetry logs to the given flagset.+// Deprecated: keep this flag for preventing the breaking change. Use `service::telemetry::logs` in config instead.+func Flags(flags *flag.FlagSet) {+	loggerLevelPtr = flags.String(logLevelCfg, "deprecated", "Deprecated, DO NOT USE")++	loggerProfilePtr = flags.String(logProfileCfg, "deprecated", "Deprecated, DO NOT USE")++	// Note: we use "console" by default for more human-friendly mode of logging (tab delimited, formatted timestamps).+	loggerFormatPtr = flags.String(logFormatCfg, "deprecated", "Deprecated, DO NOT USE")+}++func NewLogger(cfg config.ServiceTelemetryLogs, options []zap.Option) (*zap.Logger, error) {+	// Copied from NewProductionConfig.+	zapCfg := &zap.Config{+		Level:       zap.NewAtomicLevelAt(zap.InfoLevel),+		Development: false,+		Sampling: &zap.SamplingConfig{+			Initial:    100,+			Thereafter: 100,+		},+		Encoding:         "json",+		EncoderConfig:    zap.NewProductionEncoderConfig(),+		OutputPaths:      []string{"stderr"},

stdout?

bogdandrutu

comment created time in 8 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentopen-telemetry/opentelemetry-collector-contrib

initial structure for MongoDB Atlas recevier

+// Copyright  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 mongodbatlasreceiver++import (+	"context"+	"fmt"++	"go.opentelemetry.io/collector/component"+	"go.opentelemetry.io/collector/config"+	"go.opentelemetry.io/collector/consumer"+	"go.opentelemetry.io/collector/receiver/receiverhelper"+)++const (+	typeStr            = "mongodbatlas"+	defaultGranularity = "PT1M" // 1-minute, as per https://docs.atlas.mongodb.com/reference/api/process-measurements/+)++// NewFactory creates a factory for MongoDB Atlas receiver+func NewFactory() component.ReceiverFactory {+	return receiverhelper.NewFactory(+		typeStr,+		createDefaultConfig,+		receiverhelper.WithMetrics(createMetricsReceiver))+}++func createMetricsReceiver(+	ctx context.Context,+	params component.ReceiverCreateSettings,+	rConf config.Receiver,+	consumer consumer.Metrics,+) (component.MetricsReceiver, error) {+	cfg := rConf.(*Config)+	ms, err := newMongoDBAtlasReceiver(ctx, params.Logger, cfg, consumer)+	if err != nil {+		return nil, fmt.Errorf("Unable to create a MongoDB Atlas Receiver instance: %w", err)
		return nil, errors.Wrap(err, "unable to create a MongoDB Atlas Receiver instance")
zenmoto

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentopen-telemetry/opentelemetry-collector-contrib

initial structure for MongoDB Atlas recevier

+// Copyright  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 internal++import (+	"context"+	"fmt"++	"github.com/mongodb-forks/digest"+	"go.mongodb.org/atlas/mongodbatlas"+	"go.uber.org/zap"+)++// This struct wraps the official MongoDB Atlas client to manage pagination+// and mapping to OpenTelmetry metric and log structures.+type MongoDBAtlasClient struct {+	log    *zap.Logger+	client *mongodbatlas.Client+}++func NewMongoDBAtlasClient(+	publicKey string,+	privateKey string,+	log *zap.Logger,+) (*MongoDBAtlasClient, error) {+	t := digest.NewTransport(publicKey, privateKey)+	tc, err := t.Client()+	if err != nil {+		return nil, fmt.Errorf("Could not create MongoDB Atlas transport HTTP client: %w", err)+	}+	client := mongodbatlas.NewClient(tc)+	return &MongoDBAtlasClient{+		log,+		client,+	}, nil+}++// Check both the returned error and the status of the HTTP response+func checkMongoDBClientErr(err error, response *mongodbatlas.Response) error {+	if err != nil {+		return err+	}+	if response != nil {+		return mongodbatlas.CheckResponse(response.Response)+	}+	return nil+}++func hasNext(links []*mongodbatlas.Link) bool {+	for _, link := range links {+		if link.Rel == "next" {+			return true+		}+	}+	return false+}++// Return a list of all organizations available with the supplied credentials+func (s *MongoDBAtlasClient) Organizations(ctx context.Context) []*mongodbatlas.Organization {+	allOrgs := make([]*mongodbatlas.Organization, 0)+	page := 1++	for {+		orgs, hasNext, err := s.getOrganizationsPage(ctx, page)+		page+++		if err != nil {+			// TODO: Add error to a metric+			s.log.Debug("Error retrieving organizations from MongoDB Atlas API", zap.Error(err))+			break // Stop, returning what we have (probably empty slice)+		}+		allOrgs = append(allOrgs, orgs...)+		if !hasNext {+			break+		}+	}+	return allOrgs+}++func (s *MongoDBAtlasClient) getOrganizationsPage(+	ctx context.Context,+	pageNum int,+) ([]*mongodbatlas.Organization, bool, error) {+	orgs, response, err := s.client.Organizations.List(ctx, &mongodbatlas.OrganizationsListOptions{+		ListOptions: mongodbatlas.ListOptions{+			PageNum: pageNum,+		},+	})+	err = checkMongoDBClientErr(err, response)+	if err != nil {+		return nil, false, fmt.Errorf("Error in retrieving organizations: %w", err)
		return nil, false, errors.Wrap(err, "error in retrieving organizations")
zenmoto

comment created time in 8 days

Pull request review commentopen-telemetry/opentelemetry-collector-contrib

initial structure for MongoDB Atlas recevier

+// Copyright  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 internal++import (+	"context"+	"fmt"++	"github.com/mongodb-forks/digest"+	"go.mongodb.org/atlas/mongodbatlas"+	"go.uber.org/zap"+)++// This struct wraps the official MongoDB Atlas client to manage pagination+// and mapping to OpenTelmetry metric and log structures.+type MongoDBAtlasClient struct {+	log    *zap.Logger+	client *mongodbatlas.Client+}++func NewMongoDBAtlasClient(+	publicKey string,+	privateKey string,+	log *zap.Logger,+) (*MongoDBAtlasClient, error) {+	t := digest.NewTransport(publicKey, privateKey)+	tc, err := t.Client()+	if err != nil {+		return nil, fmt.Errorf("Could not create MongoDB Atlas transport HTTP client: %w", err)
		return nil, errors.Wrap(err, "Could not create MongoDB Atlas transport HTTP client")
zenmoto

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentopen-telemetry/opentelemetry-collector-contrib

initial structure for MongoDB Atlas recevier

+// Copyright  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 internal++import (+	"context"++	"github.com/mongodb-forks/digest"+	"go.mongodb.org/atlas/mongodbatlas"+	"go.uber.org/zap"+)++// This struct wraps the official MongoDB Atlas client to manage pagination+// and mapping to OpenTelmetry metric and log structures.+type MongoDBAtlasClient struct {+	log    *zap.Logger+	client *mongodbatlas.Client+}++func NewMongoDBAtlasClient(+	publicKey string,+	privateKey string,+	log *zap.Logger,+) (*MongoDBAtlasClient, error) {+	t := digest.NewTransport(publicKey, privateKey)+	tc, err := t.Client()+	if err != nil {+		return nil, err+	}+	client := mongodbatlas.NewClient(tc)+	return &MongoDBAtlasClient{+		log,+		client,+	}, nil+}++// Check both the returned error and the status of the HTTP response+func checkMongoDBClientErr(err error, response *mongodbatlas.Response) error {+	if err != nil {+		return err+	}+	if response != nil {+		return mongodbatlas.CheckResponse(response.Response)+	}+	return nil+}++func hasNext(links []*mongodbatlas.Link) bool {+	for _, link := range links {+		if link.Rel == "next" {+			return true+		}+	}+	return false+}++// Return a list of all organizations available with the supplied credentials+func (s *MongoDBAtlasClient) Organizations(ctx context.Context) []*mongodbatlas.Organization {+	allOrgs := make([]*mongodbatlas.Organization, 0)+	page := 1++	for {+		orgs, hasNext, err := s.getOrganizationsPage(ctx, page)+		page+++		if err != nil {+			// Error was reported in getOrganizationsPage+			break // Stop, returning what we have (probably empty slice)

Just keep this as a todo somewhere, as I'm not sure we have sorted out observability for the collector yet (or have we, @bogdandrutu?)

zenmoto

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentopen-telemetry/opentelemetry-collector-contrib

add per_cpu option to load scraper for hostmetricsreceiver

 func (s *scraper) scrape(_ context.Context) (pdata.MetricSlice, error) { 		return metrics, scrapererror.NewPartialScrapeError(err, metricsLen) 	} +	if s.config.PerCPU {+		divisor := float64(runtime.NumCPU())+		avgLoadValues.Load1 = avgLoadValues.Load1 * divisor

Shouldn't you be dividing, instead of multiplying?

xp-1000

comment created time in 8 days