Skip to content

Conversation

@herin049
Copy link
Contributor

Adds support for FaaS telemetry API metrics.

@herin049 herin049 requested a review from a team as a code owner December 10, 2025 07:17
@herin049 herin049 force-pushed the feat/telemetryapi-metrics branch from c03090e to bed59f8 Compare December 19, 2025 18:33
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
semconv2 "go.opentelemetry.io/otel/semconv/v1.24.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this specific version needed? Can we not just use the same 1.25.0 version that is used elsewhere?

"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/receiver"
semconv "go.opentelemetry.io/collector/semconv/v1.25.0"
semconv2 "go.opentelemetry.io/otel/semconv/v1.24.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to other semconv version remark but I see now that you are seemingly doing this to deal with the deprecation of the old collector/semconv package in favor of otel/semconv. Could we not use "go.opentelemetry.io/otel/semconv/v1.25.0` for all semconv attributes? I'm assuming that that same version in the new package matches the one from the old package

span.SetTraceID(newTraceID())
span.SetSpanID(newSpanID())
span.SetName("platform.initRuntimeDone")
span.SetName(fmt.Sprintf("init %s", r.faasName))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question, why is this needed for supporting telemetryapi metrics? Or is this just a general improvement/fix?

resource pcommon.Resource
faasFunctionVersion string
faasName string
faaSMetricBuilders *FaaSMetricBuilders
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debatble nit - naming

Suggested change
faaSMetricBuilders *FaaSMetricBuilders
faasMetricBuilders *FaasMetricBuilders

lmk what you think.

r.logger.Error("error receiving traces", zap.Error(err))
// Metrics
if r.nextMetrics != nil {
if metrics, err := r.createMetrics(slice); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be worried about concurrent map writes here? Since createMetrics modifies the faaSMetricBuilders maps...

if record, ok := el.Record.(map[string]any); ok {
functionName, _ := record["functionName"].(string)
if functionName != "" {
r.faasName = functionName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same-ish remark here as: https://github.com/open-telemetry/opentelemetry-lambda/pull/2066/changes#r2637209797
Just wondering if there's any risk for concurrent writes here? Since this single telemetryAPIReceiver instance is shared across request goroutines.

@wpessers wpessers added enhancement New feature or request go Pull requests that update Go code labels Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants