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

new relic lambda layer is not picking the right OTLP host #1308

Open
santhosh-reddy03 opened this issue Feb 20, 2025 · 3 comments
Open

new relic lambda layer is not picking the right OTLP host #1308

santhosh-reddy03 opened this issue Feb 20, 2025 · 3 comments

Comments

@santhosh-reddy03
Copy link

Description
I have configured new relic python lambda layer for my lambda service , and also configured all the required env vars, my license key belongs to eu region and starts with eu**, but new relic continues to pick up the otlp host for US region instead, i tried setting up env vars for OTLP, but found to be invalid.

Expected Behavior
Based on my license key, as per the new relic source code, it should pick eu otlp host

def default_host(license_key):
    if not license_key:
        return "collector.newrelic.com"

    region_aware_match = re.match("^(.+?)x", license_key)
    if not region_aware_match:
        return "collector.newrelic.com"

    region = region_aware_match.group(1)
    host = f"collector.{region}.nr-data.net"
    return host

Troubleshooting or NR Diag results
2025-02-20 07:04:45,308 (15/NR-Activate-Session/OurApp) newrelic.core.config WARNING - Unable to find corresponding OTLP host using default otlp.nr-data.net

Steps to Reproduce
Create a docker image with the new relic python lambda layer and configure the license key from EU region.

Your Environment
Python version : 3.10
Env: AWS Lambda

@workato-integration
Copy link

@santhosh-reddy03
Copy link
Author

Hi Guys, I also have found the issue on why its happening

def default_host(license_key):
    if not license_key:
        return "collector.newrelic.com"

    region_aware_match = re.match("^(.+?)x", license_key)
    if not region_aware_match:
        return "collector.newrelic.com"

    region = region_aware_match.group(1)
    host = f"collector.{region}.nr-data.net"
    return host


def default_otlp_host(host):
    HOST_MAP = {
        "collector.newrelic.com": "otlp.nr-data.net",
        "collector.eu.newrelic.com": "otlp.eu01.nr-data.net",
        "gov-collector.newrelic.com": "gov-otlp.nr-data.net",
        "staging-collector.newrelic.com": "staging-otlp.nr-data.net",
        "staging-collector.eu.newrelic.com": "staging-otlp.eu01.nr-data.net",
        "staging-gov-collector.newrelic.com": "staging-gov-otlp.nr-data.net",
        "fake-collector.newrelic.com": "fake-otlp.nr-data.net",
    }
    otlp_host = HOST_MAP.get(host, None)
    if not otlp_host:
        default = HOST_MAP["collector.newrelic.com"]
        _logger.warn(f"Unable to find corresponding OTLP host using default {default}")
        otlp_host = default
    return otlp_host

In the above default_host function the host key that is created for other regions is a not match in HOST_MAP present in default_oltp_host.

@TimPansino
Copy link
Contributor

Hello,

When in serverless mode the OTLP connection is not supposed to be enabled. We don't connect to a real backend directly with the agent, and rely instead on the lambda extension layer. That doesn't have any current ability to speak OTLP, so we don't support using any data types sent over OTLP for lambda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants