Skip to content
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

[cloudflarereceiver] Internal metrics not generated #38447

Closed
panys9 opened this issue Mar 7, 2025 · 2 comments · Fixed by #38463
Closed

[cloudflarereceiver] Internal metrics not generated #38447

panys9 opened this issue Mar 7, 2025 · 2 comments · Fixed by #38463
Labels
bug Something isn't working good first issue Good for newcomers receiver/cloudflare

Comments

@panys9
Copy link
Contributor

panys9 commented Mar 7, 2025

Component(s)

receiver/cloudflare

What happened?

Description

The internal metrics from the receiver is not generated when getting traffic.

otelcol_receiver_accepted_log_records
otelcol_receiver_refused_log_records

Steps to Reproduce

Start the collector with the cloudflare receiver and generate some traffic to it

Expected Result

Internal metrics should be generated to understand if the receiver handles the traffic

Actual Result

No metrics

Collector version

v0.121.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

exporters:
  otlp:
    endpoint: MY_BACKEND
extensions:
  health_check:
    endpoint: ${env:MY_POD_IP}:13133
processors:
  batch: {}
  memory_limiter:
    check_interval: 1s
    limit_percentage: 80
    spike_limit_percentage: 20
  resource:
    attributes:
      - action: insert
        key: deployment.environment.name
        value: dev
      - action: insert
        key: service.version
        value: 0.1.0
  transform/cloudflare:
    error_mode: ignore
    log_statements:
      - context: log
      statements:
        - merge_maps(cache, body, "upsert") where IsMatch(body, "^\\{")
        - set(attributes, cache)
        - set(time_unix_nano, Int(attributes["EdgeStartTimestamp"])) where attributes["EdgeStartTimestamp"]
            != ""
        - set(time_unix_nano, Int(attributes["Datetime"])) where attributes["Datetime"]
            != ""
        - replace_all_patterns(attributes, "key", "^(.*)$", "cloudflare.$$1")
        - set(trace_id.string, Substring(attributes["cloudflare.RequestHeaders_traceparent"],
            3, 32)) where IsMatch(attributes["cloudflare.RequestHeaders_traceparent"],
            "^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$")
        - set(attributes["cloudflare.Kind"], "http") where attributes["cloudflare.Kind"]
            != "firewall"
        - set(body, Concat(["cloudflare_http_request", attributes["cloudflare.RayID"]],
            "_")) where IsMatch(attributes["cloudflare.Kind"], "^(http)$")
        - set(body, Concat(["cloudflare_firewall_event", attributes["cloudflare.RayID"]],
            "_")) where IsMatch(attributes["cloudflare.Kind"], "^(firewall)$")
receivers:
  cloudflare:
    logs:
      endpoint: ${env:MY_POD_IP}:4318
      secret: ${env:MY_SECRET}
service:
  extensions:
    - health_check
  pipelines:
    logs:
      exporters:
        - otlp
      processors:
        - memory_limiter
        - transform/cloudflare
        - batch
        - resource
      receivers:
        - cloudflare
  telemetry:
    metrics:
      readers:
        - periodic:
            exporter:
              otlp:
                endpoint: <gateway>
                protocol: grpc
            interval: 10000
    resource:
      deployment.environment.name: dev

Log output

Additional context

No response

@panys9 panys9 added bug Something isn't working needs triage New item requiring triage labels Mar 7, 2025
Copy link
Contributor

github-actions bot commented Mar 7, 2025

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@dehaansa dehaansa added good first issue Good for newcomers and removed needs triage New item requiring triage labels Mar 7, 2025
@dehaansa
Copy link
Contributor

dehaansa commented Mar 7, 2025

Thanks for reporting this issue.

This should be relatively straightforward for anyone interested to implement, just look at uses of receiverhelper.ObsReport from other receivers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers receiver/cloudflare
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants