Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- [ENHANCEMENT] The Grafana Agent Operator will now default to deploying
the matching release version of the Grafana Agent instead of v0.14.0.
(@rfratto)

- [ENHANCEMENT] Update OTel dependency to v0.29.0 (@mapno)

# v0.16.1 (2021-06-22)

Expand Down
39 changes: 22 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/grafana/agent
go 1.16

require (
contrib.go.opencensus.io/exporter/prometheus v0.2.0
contrib.go.opencensus.io/exporter/prometheus v0.3.0
github.com/cortexproject/cortex v1.8.2-0.20210428155238-d382e1d80eaf
github.com/drone/envsubst v1.0.2
github.com/fatih/structs v0.0.0-20180123065059-ebf56d35bba7
github.com/fatih/structs v1.1.0
github.com/go-kit/kit v0.10.0
github.com/go-logfmt/logfmt v0.5.0
github.com/go-logr/logr v0.4.0
Expand All @@ -25,37 +25,36 @@ require (
github.com/oklog/run v1.1.0
github.com/olekukonko/tablewriter v0.0.2
github.com/oliver006/redis_exporter v1.15.0
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.21.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanmetricsprocessor v0.21.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.21.0
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.29.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanmetricsprocessor v0.29.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.29.0
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e
github.com/opentracing/opentracing-go v1.2.0
github.com/pkg/errors v0.9.1
github.com/prometheus-community/windows_exporter v0.0.0-00010101000000-000000000000
github.com/prometheus-operator/prometheus-operator v0.47.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.47.0
github.com/prometheus/client_golang v1.10.0
github.com/prometheus/common v0.23.0
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/common v0.29.0
github.com/prometheus/consul_exporter v0.7.2-0.20210127095228-584c6de19f23
github.com/prometheus/memcached_exporter v0.8.0
github.com/prometheus/mysqld_exporter v0.0.0-00010101000000-000000000000
github.com/prometheus/node_exporter v1.0.1
github.com/prometheus/procfs v0.6.1-0.20210313121648-b565fefb1664
github.com/prometheus/prometheus v1.8.2-0.20210421143221-52df5ef7a3be
github.com/prometheus/statsd_exporter v0.18.1-0.20201124082027-8b2b4c1a2b49
github.com/prometheus/prometheus v1.8.2-0.20210621150501-ff58416a0b02
github.com/prometheus/statsd_exporter v0.21.0
github.com/sirupsen/logrus v1.7.0
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/uber/jaeger-client-go v2.28.0+incompatible
github.com/uber/jaeger-client-go v2.29.1+incompatible
github.com/weaveworks/common v0.0.0-20210419092856-009d1eebd624
github.com/wrouesnel/postgres_exporter v0.0.0-00010101000000-000000000000
go.opencensus.io v0.23.0
go.opentelemetry.io/collector v0.21.0
go.uber.org/atomic v1.7.0
go.uber.org/zap v1.16.0
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6
google.golang.org/grpc v1.37.0
go.opentelemetry.io/collector v0.29.0
go.uber.org/atomic v1.8.0
go.uber.org/zap v1.17.0
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273
google.golang.org/grpc v1.38.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
Expand Down Expand Up @@ -109,4 +108,10 @@ exclude google.golang.org/grpc/examples v0.0.0-20200728065043-dfc0c05b2da9
replace github.com/weaveworks/common => github.com/rfratto/weaveworks-common v0.0.0-20210326192855-c95210d58ba7

// loadbalancingexporter uses non-fixed version of batchpertrace which fetches latest and causes problems
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpertrace => github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpertrace v0.21.0
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal => github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.29.0

replace go.opentelemetry.io/collector => github.com/grafana/opentelemetry-collector v0.4.1-0.20210625154936-5ed8906327ca
Comment thread
mapno marked this conversation as resolved.
Resolved

replace github.com/prometheus/common => github.com/prometheus/common v0.23.0

replace github.com/prometheus/statsd_exporter => github.com/prometheus/statsd_exporter v0.18.1-0.20201124082027-8b2b4c1a2b49
267 changes: 143 additions & 124 deletions go.sum

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions pkg/tempo/automaticloggingprocessor/automaticloggingprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
)

type automaticLoggingProcessor struct {
nextConsumer consumer.TracesConsumer
nextConsumer consumer.Traces

cfg *AutomaticLoggingConfig
logToStdout bool
Expand All @@ -50,7 +50,7 @@ type automaticLoggingProcessor struct {
logger log.Logger
}

func newTraceProcessor(nextConsumer consumer.TracesConsumer, cfg *AutomaticLoggingConfig) (component.TracesProcessor, error) {
func newTraceProcessor(nextConsumer consumer.Traces, cfg *AutomaticLoggingConfig) (component.TracesProcessor, error) {
logger := log.With(util.Logger, "component", "tempo automatic logging")

if nextConsumer == nil {
Expand Down Expand Up @@ -134,8 +134,8 @@ func (p *automaticLoggingProcessor) ConsumeTraces(ctx context.Context, td pdata.
return p.nextConsumer.ConsumeTraces(ctx, td)
}

func (p *automaticLoggingProcessor) GetCapabilities() component.ProcessorCapabilities {
return component.ProcessorCapabilities{}
func (p *automaticLoggingProcessor) Capabilities() consumer.Capabilities {
return consumer.Capabilities{}
}

// Start is invoked during service startup.
Expand Down Expand Up @@ -238,23 +238,23 @@ func (p *automaticLoggingProcessor) exportToLoki(kind string, traceID string, ke
}

func spanDuration(span pdata.Span) string {
dur := int64(span.EndTime() - span.StartTime())
dur := int64(span.EndTimestamp() - span.StartTimestamp())
return strconv.FormatInt(dur, 10) + "ns"
}

func attributeValue(att pdata.AttributeValue) interface{} {
switch att.Type() {
case pdata.AttributeValueSTRING:
case pdata.AttributeValueTypeString:
return att.StringVal()
case pdata.AttributeValueINT:
case pdata.AttributeValueTypeInt:
return att.IntVal()
case pdata.AttributeValueDOUBLE:
case pdata.AttributeValueTypeDouble:
return att.DoubleVal()
case pdata.AttributeValueBOOL:
case pdata.AttributeValueTypeBool:
return att.BoolVal()
case pdata.AttributeValueMAP:
case pdata.AttributeValueTypeMap:
return att.MapVal()
case pdata.AttributeValueARRAY:
case pdata.AttributeValueTypeArray:
return att.ArrayVal()
}
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package automaticloggingprocessor

import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -12,8 +13,8 @@ func TestSpanKeyVals(t *testing.T) {
tests := []struct {
spanName string
spanAttrs map[string]pdata.AttributeValue
spanStart uint64
spanEnd uint64
spanStart time.Time
spanEnd time.Time
cfg AutomaticLoggingConfig
expected []interface{}
}{
Expand All @@ -40,16 +41,17 @@ func TestSpanKeyVals(t *testing.T) {
},
},
{
spanEnd: 10,
spanStart: time.Unix(0, 0),
spanEnd: time.Unix(0, 10),
expected: []interface{}{
"span", "",
"dur", "10ns",
"status", pdata.StatusCode(0),
},
},
{
spanStart: 10,
spanEnd: 100,
spanStart: time.Unix(0, 10),
spanEnd: time.Unix(0, 100),
expected: []interface{}{
"span", "",
"dur", "90ns",
Expand Down Expand Up @@ -105,8 +107,8 @@ func TestSpanKeyVals(t *testing.T) {
span := pdata.NewSpan()
span.SetName(tc.spanName)
span.Attributes().InitFromMap(tc.spanAttrs).Sort()
span.SetStartTime(pdata.TimestampUnixNano(tc.spanStart))
span.SetEndTime(pdata.TimestampUnixNano(tc.spanEnd))
span.SetStartTimestamp(pdata.TimestampFromTime(tc.spanStart))
span.SetEndTimestamp(pdata.TimestampFromTime(tc.spanEnd))

actual := p.(*automaticLoggingProcessor).spanKeyVals(span)
assert.Equal(t, tc.expected, actual)
Expand Down
17 changes: 7 additions & 10 deletions pkg/tempo/automaticloggingprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/processor/processorhelper"
)
Expand All @@ -15,7 +15,7 @@ const TypeStr = "automatic_logging"

// Config holds the configuration for the Automatic Logging processor.
type Config struct {
configmodels.ProcessorSettings `mapstructure:",squash"`
config.ProcessorSettings `mapstructure:",squash"`

LoggingConfig *AutomaticLoggingConfig `mapstructure:"automatic_logging"`
}
Expand Down Expand Up @@ -59,20 +59,17 @@ func NewFactory() component.ProcessorFactory {
)
}

func createDefaultConfig() configmodels.Processor {
func createDefaultConfig() config.Processor {
return &Config{
ProcessorSettings: configmodels.ProcessorSettings{
TypeVal: TypeStr,
NameVal: TypeStr,
},
ProcessorSettings: config.NewProcessorSettings(config.NewIDWithName(TypeStr, TypeStr)),
}
}

func createTraceProcessor(
_ context.Context,
cp component.ProcessorCreateParams,
cfg configmodels.Processor,
nextConsumer consumer.TracesConsumer,
cp component.ProcessorCreateSettings,
cfg config.Processor,
nextConsumer consumer.Traces,
) (component.TracesProcessor, error) {
oCfg := cfg.(*Config)

Expand Down
19 changes: 7 additions & 12 deletions pkg/tempo/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanmetricsprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor"
"github.com/prometheus/client_golang/prometheus"
prom_config "github.com/prometheus/common/config"
"github.com/spf13/viper"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/config/configloader"
"go.opentelemetry.io/collector/config/configparser"
"go.opentelemetry.io/collector/exporter/otlpexporter"
"go.opentelemetry.io/collector/exporter/otlphttpexporter"
"go.opentelemetry.io/collector/exporter/prometheusexporter"
Expand Down Expand Up @@ -217,7 +218,7 @@ type SpanMetricsConfig struct {
// Namespace if set, exports metrics under the provided value.
Namespace string `yaml:"namespace,omitempty"`
// ConstLabels are values that are applied for every exported metric.
ConstLabels map[string]interface{} `yaml:"const_labels,omitempty"`
ConstLabels *prometheus.Labels `yaml:"const_labels,omitempty"`
// PromInstance is the Agent's prometheus instance that will be used to push metrics
PromInstance string `yaml:"prom_instance"`
// HandlerEndpoint is the address where a prometheus exporter will be exposed
Expand Down Expand Up @@ -427,7 +428,7 @@ func formatPolicies(cfg []map[string]interface{}) ([]map[string]interface{}, err
return policies, nil
}

func (c *InstanceConfig) otelConfig() (*configmodels.Config, error) {
func (c *InstanceConfig) otelConfig() (*config.Config, error) {
otelMapStructure := map[string]interface{}{}

if len(c.Receivers) == 0 {
Expand Down Expand Up @@ -606,19 +607,13 @@ func (c *InstanceConfig) otelConfig() (*configmodels.Config, error) {
"pipelines": pipelines,
}

// now build the otel configmodel from the mapstructure
v := viper.New()
err = v.MergeConfigMap(otelMapStructure)
if err != nil {
return nil, fmt.Errorf("failed to merge in mapstructure config: %w", err)
}

factories, err := tracingFactories()
if err != nil {
return nil, fmt.Errorf("failed to create factories: %w", err)
}

otelCfg, err := config.Load(v, factories)
parser := configparser.NewParserFromStringMap(otelMapStructure)
otelCfg, err := configloader.Load(parser, factories)
if err != nil {
return nil, fmt.Errorf("failed to load OTel config: %w", err)
}
Expand Down
Loading