Giter VIP home page Giter VIP logo

Comments (3)

jeromevdl avatar jeromevdl commented on July 18, 2024 2

First, I didn't really understand this code:

private static String defaultNameSpace() {
        MetricsContext context = MetricsLoggerHelper.metricsContext();
        return "aws-embedded-metrics".equals(context.getNamespace()) ?
                SystemWrapper.getenv("POWERTOOLS_METRICS_NAMESPACE") : context.getNamespace();
}

Looks to me that we should do the contrary: if the env var is empty, set a default, as you suggest.

But I'm not sure how the context namespace is actually set. I've found this which makes me think that "aws-embedded-metrics" is the default. So if it is the default, we try to replace it with the env var, otherwise, it means the user already changed the default somehow (how?) and we should use that.

What is missing here is the check on SystemWrapper.getenv("POWERTOOLS_METRICS_NAMESPACE". If null or empty, we should come back to the default.

from powertools-lambda-java.

scottgerring avatar scottgerring commented on July 18, 2024

Hey @roamingthings , thanks for the report! The requirement for the variable is documented, but it does seem a bit odd to explicitly 1/ check if the default hasn't been overriden, and then 2/ override it with an empty string. Inverting the whole thing as you suggest so we override if we have the env var, or use the default otherwise, seems more sensible, and wouldn't be a breaking change.

What do you think @jeromevdl - ?

from powertools-lambda-java.

github-actions avatar github-actions commented on July 18, 2024

This is now released under 1.18.0 version!

from powertools-lambda-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.