Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
72a0e83
feat: added baseline span metrics connector from opentelemetry-collec…
nikhilmantri0902 Nov 7, 2025
e4422c6
chore: ran go mod tidy
nikhilmantri0902 Nov 7, 2025
e80cd3f
fix: fixed testcase TestLoadConfig
nikhilmantri0902 Nov 7, 2025
9efd86f
chore: initializing connector in components
nikhilmantri0902 Nov 7, 2025
5e17b12
chore: added new config and make command to run with connector locally
nikhilmantri0902 Nov 7, 2025
8cf95b7
fix: removed prometheus connector from default-config-with-connector …
nikhilmantri0902 Nov 7, 2025
f4c97de
fix: spanmetricsconnector -> signozspanmetricsconnector
nikhilmantri0902 Nov 7, 2025
e994202
chore: connector setup matching processor setup
nikhilmantri0902 Nov 9, 2025
563bd3a
chore: types-> helpertypes
nikhilmantri0902 Nov 9, 2025
dc4fe1d
chore: factory_test added
nikhilmantri0902 Nov 9, 2025
1672a71
chore: tests added for connector.go
nikhilmantri0902 Nov 9, 2025
904a08b
chore: rearrangement
nikhilmantri0902 Nov 9, 2025
795c35d
fix: create a new map to avoid modifying the original map so we no lo…
nikhilmantri0902 Nov 10, 2025
8860c0a
fix: create a new map to avoid modifying the original map so we no lo…
nikhilmantri0902 Nov 10, 2025
043fa8b
chore: info log to indentify connector added
nikhilmantri0902 Nov 10, 2025
3078a2f
Merge branch 'main' into feat/traces2metrics_connector_p2
nikhilmantri0902 Nov 12, 2025
950aef1
chore: cleanup of coreinternal/traceutil
nikhilmantri0902 Nov 12, 2025
cdcb464
chore: remove internal/pdatautil as not needed for now
nikhilmantri0902 Nov 12, 2025
4f5a07b
fix: t.Context() remove from test case as collector is on go 1.23, no…
nikhilmantri0902 Nov 12, 2025
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
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ REPONAME ?= signoz
IMAGE_NAME ?= signoz-otel-collector
MIGRATOR_IMAGE_NAME ?= signoz-schema-migrator
CONFIG_FILE ?= ./config/default-config.yaml
CONFIG_FILE_WITH_CONNECTOR ?= ./config/default-config-with-connector.yaml
DOCKER_TAG ?= latest

GOOS ?= $(shell go env GOOS)
Expand Down Expand Up @@ -52,6 +53,10 @@ build-all: amd64 arm64
run:
go run cmd/signozotelcollector/main.go --config ${CONFIG_FILE}

.PHONY: run-with-connector
run-with-connector:
go run cmd/signozotelcollector/main.go --config ${CONFIG_FILE_WITH_CONNECTOR}

.PHONY: fmt
fmt:
@echo Running go fmt on query service ...
Expand Down
4 changes: 2 additions & 2 deletions components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/connector/roundrobinconnector"
"github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector"
"github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector"
"github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector"
"github.com/open-telemetry/opentelemetry-collector-contrib/connector/sumconnector"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alertmanagerexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awskinesisexporter"
Expand Down Expand Up @@ -171,6 +170,7 @@ import (
"go.uber.org/multierr"

"github.com/SigNoz/signoz-otel-collector/connectors/signozmeterconnector"
"github.com/SigNoz/signoz-otel-collector/connectors/signozspanmetricsconnector"
"github.com/SigNoz/signoz-otel-collector/exporter/clickhouselogsexporter"
"github.com/SigNoz/signoz-otel-collector/exporter/clickhousetracesexporter"
"github.com/SigNoz/signoz-otel-collector/exporter/jsontypeexporter"
Expand Down Expand Up @@ -391,7 +391,7 @@ func Components() (otelcol.Factories, error) {
roundrobinconnector.NewFactory(),
routingconnector.NewFactory(),
servicegraphconnector.NewFactory(),
spanmetricsconnector.NewFactory(),
signozspanmetricsconnector.NewFactory(),
sumconnector.NewFactory(),
signozmeterconnector.NewFactory(),
}
Expand Down
97 changes: 97 additions & 0 deletions config/default-config-with-connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
receivers:
otlp/spanmetrics:
protocols:
grpc:
endpoint: "localhost:12345"
otlp:
protocols:
grpc:
http:
jaeger:
protocols:
grpc:
thrift_http:
hostmetrics:
collection_interval: 30s
scrapers:
cpu:
load:
memory:
disk:
filesystem:
network:
processors:
batch:
send_batch_size: 1000
timeout: 10s

connectors:
signozspanmetrics/delta:
metrics_flush_interval: 60s
latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 50ms, 100ms, 250ms, 500ms, 1000ms, 1400ms, 2000ms, 5s, 10s, 20s, 40s, 60s ]
dimensions_cache_size: 100000
aggregation_temporality: AGGREGATION_TEMPORALITY_DELTA
enable_exp_histogram: true
skip_spans_older_than: 24h
dimensions:
- name: service.namespace
default: default
- name: deployment.environment
default: default
# This is added to ensure the uniqueness of the timeseries
# Otherwise, identical timeseries produced by multiple replicas of
# collectors result in incorrect APM metrics
- name: signoz.collector.id
- name: service.version
- name: browser.platform
- name: browser.mobile
- name: k8s.cluster.name
- name: k8s.node.name
- name: k8s.namespace.name
- name: host.name
- name: host.type
- name: container.name
# memory_limiter:
# # 80% of maximum memory up to 2G
# limit_mib: 1500
# # 25% of limit up to 2G
# spike_limit_mib: 512
# check_interval: 5s
#
# # 50% of the maximum memory
# limit_percentage: 50
# # 20% of max memory usage spike expected
# spike_limit_percentage: 20
# queued_retry:
# num_workers: 4
# queue_size: 100
# retry_on_failure: true
extensions:
zpages: {}
exporters:
clickhousetraces:
datasource: tcp://localhost:9000/signoz_traces
retry_on_failure:
enabled: true
initial_interval: 5s
max_interval: 30s
max_elapsed_time: 300s
sending_queue:
enabled: true
queue_size: 100
num_consumers: 5
signozclickhousemetrics:
dsn: tcp://localhost:9000/signoz_metrics
prometheus:
endpoint: "0.0.0.0:8889"
service:
extensions: [zpages]
pipelines:
traces:
receivers: [jaeger, otlp]
processors: [batch]
exporters: [signozspanmetrics/delta, clickhousetraces]
metrics:
receivers: [otlp, hostmetrics, signozspanmetrics/delta]
processors: [batch]
exporters: [signozclickhousemetrics]
81 changes: 81 additions & 0 deletions connectors/signozspanmetricsconnector/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package signozspanmetricsconnector

import (
"time"

"go.opentelemetry.io/collector/pdata/pmetric"
)

// Config defines the configuration options for spanmetricsconnector.
type Config struct {
// Dimensions defines the list of additional dimensions on top of the provided:
// - service.name
// - span.kind
// - span.kind
// - status.code
// - collector.instance.id This dimensions never added unless enable feature-gate connector.spanmetrics.includeCollectorInstanceID
// The dimensions will be fetched from the span's attributes. Examples of some conventionally used attributes:
// https://github.com/open-telemetry/opentelemetry-collector/blob/main/model/semconv/opentelemetry.go.
Dimensions []Dimension `mapstructure:"dimensions"`

// LatencyHistogramBuckets is the list of durations representing latency histogram buckets.
// See defaultLatencyHistogramBucketsMs in processor.go for the default value.
LatencyHistogramBuckets []time.Duration `mapstructure:"latency_histogram_buckets"`

// ExcludePatterns defines the list of patterns to exclude from the metrics.
ExcludePatterns []ExcludePattern `mapstructure:"exclude_patterns"`

// DimensionsCacheSize defines the size of cache for storing Dimensions, which helps to avoid cache memory growing
// indefinitely over the lifetime of the collector.
// Optional. See defaultDimensionsCacheSize in connector.go for the default value.
// Deprecated [v0.130.0]: Please use AggregationCardinalityLimit instead
DimensionsCacheSize int `mapstructure:"dimensions_cache_size"`

AggregationTemporality string `mapstructure:"aggregation_temporality"`

// skipSanitizeLabel if enabled, labels that start with _ are not sanitized
skipSanitizeLabel bool

// MetricsEmitInterval is the time period between when metrics are flushed or emitted to the configured MetricsExporter.
MetricsFlushInterval time.Duration `mapstructure:"metrics_flush_interval"`

// TimeBucketInterval is the time interval for bucketing spans based on their start timestamp.
// Spans are grouped into time buckets based on when they started, not when they are processed.
// Default is 1 minute.
TimeBucketInterval time.Duration `mapstructure:"time_bucket_interval"`

EnableExpHistogram bool `mapstructure:"enable_exp_histogram"`

MaxServicesToTrack int `mapstructure:"max_services_to_track"`
MaxOperationsToTrackPerService int `mapstructure:"max_operations_to_track_per_service"`

// SkipSpansOlderThan defines the staleness window for skipping late-arriving spans.
// Spans with start time older than now - SkipSpansOlderThan are skipped.
// Default is 24 hours if not set.
SkipSpansOlderThan time.Duration `mapstructure:"skip_spans_older_than"`
}

// GetAggregationTemporality converts the string value given in the config into a AggregationTemporality.
// Returns cumulative, unless delta is correctly specified.
func (c Config) GetAggregationTemporality() pmetric.AggregationTemporality {
if c.AggregationTemporality == delta {
return pmetric.AggregationTemporalityDelta
}
return pmetric.AggregationTemporalityCumulative
}

// GetTimeBucketInterval returns the configured time bucket interval, or the default if not set.
func (c Config) GetTimeBucketInterval() time.Duration {
if c.TimeBucketInterval == 0 {
return defaultTimeBucketInterval
}
return c.TimeBucketInterval
}

// GetSkipSpansOlderThan returns the configured staleness window or a default of 24 hours.
func (c Config) GetSkipSpansOlderThan() time.Duration {
if c.SkipSpansOlderThan <= 0 {
return defaultSkipSpansOlderThan
}
return c.SkipSpansOlderThan
}
Loading
Loading