Skip to content

feat: add option to send forwarded metrics to Observe via OTLP #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 28, 2025

Conversation

obs-gh-mattcotter
Copy link
Collaborator

@obs-gh-mattcotter obs-gh-mattcotter commented May 19, 2025

Description

Add option to send forwarded metrics to Observe via OTLP. Going forward, we want to be able to send all custom metrics to Observe in the format the user prefers (between OTLP or Prometheus)

Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@obs-gh-mattcotter obs-gh-mattcotter force-pushed the mc/otel-metrics-forward branch 2 times, most recently from b52a37e to 503a0d4 Compare May 19, 2025 15:56
authorization: ${env:OBSERVE_AUTHORIZATION_HEADER}
x-observe-target-package: "Metrics"
sending_queue:
num_consumers: 4
Copy link
Collaborator

Choose a reason for hiding this comment

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

how'd you land on these values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are the same values used in all of our otlphttp exporters. It's lower than the default, but I don't know how we arrived at them in the first place. Do you think we should make them configurable in the agent config?

Copy link
Collaborator

Choose a reason for hiding this comment

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

dont need to in this PR

# Enable forwarding of local app metrics and traces
forwarding:
enabled: true
otlp_metrics: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

its a little unclear that these are referring to the output format; maybe we should nest this in another object something like

forwarding:
  enabled: true
  output:
    metrics_format: "prometheus" or "OTLP"

Copy link
Collaborator Author

@obs-gh-mattcotter obs-gh-mattcotter May 20, 2025

Choose a reason for hiding this comment

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

I went with:

forwarding:
  enabled: true
  metrics:
    output_format: "otlp"

to match your helm change (but kept snake case like the rest of the agent config).

Copy link
Collaborator

Choose a reason for hiding this comment

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

should the format be otel or otlp? the latter is more specific but references the protocol vs. the actual schema/data format

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think otel make sense; I liked that in the helm chart. Updated!

configFile := v.ConfigFileUsed()
if configFile == "" {
return false, nil, fmt.Errorf("no config file defined")
}
if _, err := os.Stat(configFile); err != nil && errors.Is(err, os.ErrNotExist) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems like an unrelated change? should it be in the same PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The diagnose check wasn't previously applying our config defaulting logic. Since this change adds a config option with a default that's invalid when empty, diagnose needed to be updated. So it's a loosely related bugfix that needs to happen before this option is added. I can split it out if you prefer?

@obs-gh-mattcotter obs-gh-mattcotter force-pushed the mc/otel-metrics-forward branch from c637fcb to 9b5d0b4 Compare May 22, 2025 15:09
@obs-gh-mattcotter obs-gh-mattcotter merged commit 9a740c1 into main May 28, 2025
13 checks passed
@obs-gh-mattcotter obs-gh-mattcotter deleted the mc/otel-metrics-forward branch May 28, 2025 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants