| 715 | |
| 716 | |
| 717 | FrameworkMetrics::FrameworkMetrics( |
| 718 | const FrameworkInfo& _frameworkInfo, |
| 719 | bool _publishPerFrameworkMetrics) |
| 720 | : metricPrefix(getFrameworkMetricPrefix(_frameworkInfo)), |
| 721 | publishPerFrameworkMetrics(_publishPerFrameworkMetrics), |
| 722 | subscribed(metricPrefix + "subscribed"), |
| 723 | calls(metricPrefix + "calls"), |
| 724 | events(metricPrefix + "events"), |
| 725 | offers_sent(metricPrefix + "offers/sent"), |
| 726 | offers_accepted(metricPrefix + "offers/accepted"), |
| 727 | offers_declined(metricPrefix + "offers/declined"), |
| 728 | offers_rescinded(metricPrefix + "offers/rescinded"), |
| 729 | operations(metricPrefix + "operations") |
| 730 | { |
| 731 | addMetric(subscribed); |
| 732 | addMetric(offers_sent); |
| 733 | addMetric(offers_accepted); |
| 734 | addMetric(offers_declined); |
| 735 | addMetric(offers_rescinded); |
| 736 | |
| 737 | // Add metrics for scheduler calls. |
| 738 | addMetric(calls); |
| 739 | for (int index = 0; |
| 740 | index < scheduler::Call::Type_descriptor()->value_count(); |
| 741 | index++) { |
| 742 | const google::protobuf::EnumValueDescriptor* descriptor = |
| 743 | scheduler::Call::Type_descriptor()->value(index); |
| 744 | |
| 745 | const scheduler::Call::Type type = |
| 746 | static_cast<scheduler::Call::Type>(descriptor->number()); |
| 747 | |
| 748 | if (type == scheduler::Call::UNKNOWN) { |
| 749 | continue; |
| 750 | } |
| 751 | |
| 752 | Counter counter = Counter( |
| 753 | metricPrefix + "calls/" + strings::lower(descriptor->name())); |
| 754 | |
| 755 | call_types.put(type, counter); |
| 756 | addMetric(counter); |
| 757 | } |
| 758 | |
| 759 | // Add metrics for scheduler events. |
| 760 | addMetric(events); |
| 761 | for (int index = 0; |
| 762 | index < scheduler::Event::Type_descriptor()->value_count(); |
| 763 | index++) { |
| 764 | const google::protobuf::EnumValueDescriptor* descriptor = |
| 765 | scheduler::Event::Type_descriptor()->value(index); |
| 766 | |
| 767 | const scheduler::Event::Type type = |
| 768 | static_cast<scheduler::Event::Type>(descriptor->number()); |
| 769 | |
| 770 | if (type == scheduler::Event::UNKNOWN) { |
| 771 | continue; |
| 772 | } |
| 773 | |
| 774 | Counter counter = Counter( |
nothing calls this directly
no test coverage detected