001/*
002 * jPOS Project [http://jpos.org]
003 * Copyright (C) 2000-2026 jPOS Software SRL
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jpos.metrics;
020
021import io.micrometer.core.instrument.Tags;
022
023public enum MeterInfo {
024    TM_ACTIVE ("jpos.tm.active", "TransactionManager activeSessions"),
025    TM_OPERATION("jpos.tm.op", "TransactionManager operation"),
026    TM_COUNTER("jpos.tm.cnt", "TransactionManager counter"),
027
028    ISOSERVER_CONNECTION_COUNT("jpos.server.connections", "Incoming active connections"),
029    ISOCHANNEL_CONNECTION_COUNT("jpos.channel.connections", "Outgoing active connections"),
030
031    ISOMSG_OUT("jpos.isomsg", "Transmitted messages", Tags.of ("direction", "out")),
032    ISOMSG_IN ("jpos.isomsg", "Received messages",    Tags.of ("direction", "in")),
033
034    CHANNEL_ACTIVE_CONNECTIONS("jpos.channel.connections", "Active outgoing connections"),
035    CHANNEL_STATUS("jpos.channel.status", "Channel status"),
036
037    MUX_STATUS("jpos.mux.status", "MUX Status"),
038    MUX_RX_PENDING("jpos.mux.pending", "MUX rx pending"),
039    MUX_RESPONSE_TIMER("jpos.mux.timer", "MUX response"),
040    MUX_TX("jpos.mux", "MUX tx", Tags.of("type", "tx")),
041    MUX_RX ("jpos.mux", "MUX rx", Tags.of("type", "rx")),
042    MUX_MATCH ("jpos.mux", "MUX rx unhandled", Tags.of("type", "match")),
043    MUX_UNHANDLED ("jpos.mux", "MUX rx unhandled", Tags.of("type", "unhandled"));
044
045    final String id;
046    final String description;
047    final Tags tags;
048
049    MeterInfo(String id, String description) {
050        this (id, description, null);
051    }
052    MeterInfo(String id, String description, Tags tags) {
053        this.id = id;
054        this.description = description;
055        this.tags = tags;
056    }
057
058    public String id() {
059        return id;
060    }
061
062    public String description() {
063        return description;
064    };
065
066    public Tags add (Tags tags) {
067        return this.tags != null ? tags.and(this.tags) : tags;
068    }
069}