GithubHelp home page GithubHelp logo

Comments (14)

brian-brazil avatar brian-brazil commented on July 30, 2024

We're going to need a lot more information to know what's going on here. Can you share the code of the mBean in question?

from jmx_exporter.

hagay3 avatar hagay3 commented on July 30, 2024

I'm trying to scrape metrics from cassandra, I tried to catch some specific metric and I saw it's not expose via jmx exporter. Enabled the logging feature for jmx exporter and this error appears for the metric.

  SCHEMA:12:291a4f2c-bc7f-34c1-9eb1-1c0952c3df82
  DC:50:*****
  RACK:30:R1
  RELEASE_VERSION:4:2.1.15.1403
  RPC_ADDRESS:3: **********
  X_11_PADDING:2166926:{"workload":"Cassandra","active":"true","health":1.0}
  SEVERITY:2166924:0.0833333358168602
  NET_VERSION:1:8
  HOST_ID:2:25ebafe4-1a92-4537-912b-0d21a6f18505
  TOKENS:17:<hidden>

Apr 26, 2017 7:36:32 AM io.prometheus.jmx.JmxScraper logScrape
FINE: scrape: 'org.apache.cassandra.net:type=FailureDetector'_'SimpleStates': process
Apr 26, 2017 7:36:32 AM io.prometheus.jmx.JmxScraper logScrape
FINE: scrape: 'org.apache.cassandra.net{type=FailureDetector}': java.util.Map is not exported

from jmx_exporter.

hagay3 avatar hagay3 commented on July 30, 2024

Apparently you skip Map objects :\

    private void processBeanValue(
            String domain,
            LinkedHashMap<String, String> beanProperties,
            LinkedList<String> attrKeys,
            String attrName,
            String attrType,
            String attrDescription,
            Object value) {
        if (value == null) {
            logScrape(domain + beanProperties + attrName, "null");
        } else if (value instanceof Number || value instanceof String || value instanceof Boolean) {
            logScrape(domain + beanProperties + attrName, value.toString());
            this.receiver.recordBean(
                    domain,
                    beanProperties,
                    attrKeys,
                    attrName,
                    attrType,
                    attrDescription,
                    value);
        } else if (value instanceof CompositeData) {
            logScrape(domain + beanProperties + attrName, "compositedata");
            CompositeData composite = (CompositeData) value;
            CompositeType type = composite.getCompositeType();
            attrKeys = new LinkedList<String>(attrKeys);
            attrKeys.add(attrName);
            for(String key : type.keySet()) {
                String typ = type.getType(key).getTypeName();
                Object valu = composite.get(key);
                processBeanValue(
                        domain,
                        beanProperties,
                        attrKeys,
                        key,
                        typ,
                        type.getDescription(),
                        valu);
            }
        } else if (value instanceof TabularData) {
            // I don't pretend to have a good understanding of TabularData.
            // The real world usage doesn't appear to match how they were
            // meant to be used according to the docs. I've only seen them
            // used as 'key' 'value' pairs even when 'value' is itself a
            // CompositeData of multiple values.
            logScrape(domain + beanProperties + attrName, "tabulardata");
            TabularData tds = (TabularData) value;
            TabularType tt = tds.getTabularType();

            List<String> rowKeys = tt.getIndexNames();
            LinkedHashMap<String, String> l2s = new LinkedHashMap<String, String>(beanProperties);

            CompositeType type = tt.getRowType();
            Set<String> valueKeys = new TreeSet<String>(type.keySet());
            valueKeys.removeAll(rowKeys);

            LinkedList<String> extendedAttrKeys = new LinkedList<String>(attrKeys);
            extendedAttrKeys.add(attrName);
            for (Object valu : tds.values()) {
                if (valu instanceof CompositeData) {
                    CompositeData composite = (CompositeData) valu;
                    for (String idx : rowKeys) {
                        l2s.put(idx, composite.get(idx).toString());
                    }
                    for(String valueIdx : valueKeys) {
                        LinkedList<String> attrNames = extendedAttrKeys;
                        String typ = type.getType(valueIdx).getTypeName();
                        String name = valueIdx;
                        if (valueIdx.toLowerCase().equals("value")) {
                            // Skip appending 'value' to the name
                            attrNames = attrKeys;
                            name = attrName;
                        }
                        processBeanValue(
                                domain,
                                l2s,
                                attrNames,
                                name,
                                typ,
                                type.getDescription(),
                                composite.get(valueIdx));
                    }
                } else {
                    logScrape(domain, "not a correct tabulardata format");
                }
            }
        } else if (value.getClass().isArray()) {
            logScrape(domain, "arrays are unsupported");
        } else {
            logScrape(domain + beanProperties, attrType + " is not exported");
        }
    }

from jmx_exporter.

brian-brazil avatar brian-brazil commented on July 30, 2024

JMX is nowhere near standard and we haven't seen one of these before. Can you share the code of the mBean in question?

from jmx_exporter.

hagay3 avatar hagay3 commented on July 30, 2024

I dont have source code for the cassandra mbeans.
What about Map objects ? its should be exposed by jmx exporter?

from jmx_exporter.

brian-brazil avatar brian-brazil commented on July 30, 2024

They're not currently supported.

from jmx_exporter.

hagay3 avatar hagay3 commented on July 30, 2024

I'm willing to add support for this one.

Some suggestions/notes about how-to develop for this repository?

from jmx_exporter.

brian-brazil avatar brian-brazil commented on July 30, 2024

First we need to know what a mBean like this looks like, both in Cassandra and anywhere else one is used.

from jmx_exporter.

obourdon avatar obourdon commented on July 30, 2024

I guess this comes from https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/net/MessagingServiceMBean.java

from jmx_exporter.

hagay3 avatar hagay3 commented on July 30, 2024

Just realized prometheous is not meant for exposing arbitrary strings.
its all about integers/double/float
So I will probably fallback to jmxterm and eventually use some meaningful metric.

from jmx_exporter.

brian-brazil avatar brian-brazil commented on July 30, 2024

Okay. Note that we do support extracting strings via the jmx exporter, it's meant for things like version numbers.

from jmx_exporter.

pesimon avatar pesimon commented on July 30, 2024

hit the same issue within a custom java service returning java.util.Map from MBean

@brian-brazil Would you consider a PR similar to #348 for adding support to it?

from jmx_exporter.

qixiaobo avatar qixiaobo commented on July 30, 2024

Also met this problem~
SpringBoot also export some map to jmxBean

from jmx_exporter.

qixiaobo avatar qixiaobo commented on July 30, 2024

org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean

from jmx_exporter.

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.