diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-07-18 16:53:46 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-07-18 16:53:46 -0300 |
| commit | 40cff8093669df0569647ffb00adebd75a7b7b04 (patch) | |
| tree | 45ca8f3e4d61c5c39460bc0b1982f04986b0d938 | |
| parent | 52cfb47b94066322163997eeabb9dd2e918a7d73 (diff) | |
New upstream version 0.1.3
353 files changed, 17770 insertions, 6307 deletions
diff --git a/.clang-format b/.clang-format index b79bad4..af4bcf1 100644 --- a/.clang-format +++ b/.clang-format @@ -1,8 +1,2 @@ BasedOnStyle: Google -AlignAfterOpenBracket: DontAlign -AlignConsecutiveBitFields: true -BreakBeforeBinaryOperators: true -AllowShortIfStatementsOnASingleLine: Never -AlwaysBreakAfterReturnType: All -IndentWidth: 4 -TabWidth: 4 +ColumnLimit: 120
\ No newline at end of file diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 50efe14..0000000 --- a/.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -root = true -indent_style = tab -indent_size = 4 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a5c7f59..513f47d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,140 +1,67 @@ name: CI - -env: - GHAH: etc/gha-helper.sh - MISSING_BUILD_PKGS: 'ksh libmicrohttpd-dev' - MISSING_DOC_PKGS: 'doxygen graphviz' - PROTO: '/var/tmp/proto' - +# This workflow is triggered on pushes to the repository. on: - push: - branches: - - main - pull_request: - paths-ignore: - - '.github/**' - - '.gitignore' - - 'example/**' - - 'promtest/**' - - 'vendor/**' - workflow_dispatch: - -concurrency: - group: pr-build-and-deploy-${{ github.head_ref }} - cancel-in-progress: true + - push + - pull_request jobs: - job_1a: - name: Build - runs-on: ubuntu-20.04 + ubuntu-20-04: + name: ubuntu-20-04 + runs-on: ubuntu-latest steps: - - name: Environment + - uses: actions/checkout@v2 + - name: test env: - GITHUB_CTX: ${{ toJSON(github) }} - MY_ENV: ${{ toJSON(env) }} - RUNNER_CTX: ${{ toJSON(runner) }} - run: | - lsb_release -a - printf "github:\n$GITHUB_CTX\n" - printf "env:\n$MY_ENV\n" - printf "env:\n$RUNNER_CTX\n" - df -h - mount - echo "DISTRO_NAME=$( lsb_release -is )" >>$GITHUB_ENV - echo "DISTRO_VERSION=$( lsb_release -rs )" >>$GITHUB_ENV - echo "GITHUB_SHA_SHORT=$( echo ${GITHUB_SHA:0:7} )" >>$GITHUB_ENV - - name: Install packages - run: | - echo 'man-db man-db/auto-update boolean false' | \ - sudo debconf-set-selections - sudo rm -f /var/lib/man-db/auto-update - sudo apt-get update - # stupid debian shipped experimental and total broken ksh2020 as ksh - # package and the stable one as ksh93 in focal. - sudo apt-get install ksh93 || sudo apt-get install ksh - sudo apt-get install ${MISSING_BUILD_PKGS} - - name: Checkout - uses: actions/checkout@v3 - - name: Build - run: | - echo "APP_VERSION=$( cat VERSION )" >>$GITHUB_ENV - ${GHAH} -c showEnv - make - - name: Install - run: | - cd prom/build && DESTDIR=${PROTO} make install - cd ../../promhttp/build && DESTDIR=${PROTO} make install - cd ${PROTO} && printf "${GITHUB_SHA}\n" > libprom.commit && \ - tar cplzf ${{ runner.temp }}/libprom.tar.gz \ - --xform="s|^.|libprom-${APP_VERSION}|" . - - name: Upload binary archive - uses: actions/upload-artifact@v3 - with: - name: libprom-${{ env.DISTRO_NAME }}_${{ env.DISTRO_VERSION }}-${{ env.APP_VERSION }} - path: ${{ runner.temp }}/libprom.tar.gz - - job_2a: - name: Tests - runs-on: ubuntu-20.04 - # This job needs to do a lot more work than just building the libs. So - # if building the libs fails, it does not make a lot of sense to try to run - # any tests. Therefore we skip it automatically by building the libs first, - # and thus save a lot of resources if the job fails. - needs: job_1a + DOCKER_IMAGE: ubuntu:20.04 + CI: 1 + run: make + ubuntu-18-04: + name: ubuntu-18-04 + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install packages - run: | - echo 'man-db man-db/auto-update boolean false' | \ - sudo debconf-set-selections - sudo rm -f /var/lib/man-db/auto-update - sudo apt-get update - sudo apt-get install ${MISSING_BUILD_PKGS} - - name: Checkout - uses: actions/checkout@v3 - - name: Test run - run: | - make test - - job_1b: - name: Docs - runs-on: ubuntu-20.04 + - uses: actions/checkout@v2 + - name: test + env: + DOCKER_IMAGE: ubuntu:18.04 + CI: 1 + run: make + ubuntu-16-04: + name: ubuntu-16-04 + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install packages - run: | - echo 'man-db man-db/auto-update boolean false' | \ - sudo debconf-set-selections - sudo rm -f /var/lib/man-db/auto-update - sudo apt-get update - # stupid debian shipped experimental and total broken ksh2020 as ksh - # package and the stable one as ksh93 in focal. - sudo apt-get install ksh93 || sudo apt-get install ksh - sudo apt-get install ${MISSING_BUILD_PKGS} ${MISSING_DOC_PKGS} - - name: Build - run: | - ${GHAH} -c showEnv - make docs - - name: Upload docs archive - uses: actions/upload-pages-artifact@v2 - with: - name: github-pages - path: 'docs/html' - - job_2b: - name: Github pages - runs-on: ubuntu-20.04 - needs: job_1b - # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + - uses: actions/checkout@v2 + - name: test + env: + DOCKER_IMAGE: ubuntu:16.04 + CI: 1 + run: make + debian-buster: + name: debian-buster + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: test + env: + DOCKER_IMAGE: debian:buster + CI: 1 + run: make + debian-stretch: + name: debian-stretch + runs-on: ubuntu-latest steps: - - name: Deploy GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 + - uses: actions/checkout@v2 + - name: test + env: + DOCKER_IMAGE: debian:stretch + CI: 1 + run: make + debian-jessie: + name: debian-jessie + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: test + env: + DOCKER_IMAGE: debian:jessie + CI: 1 + run: make
\ No newline at end of file @@ -1,21 +1,13 @@ .*.swp +docker/Dockerfile .vscode -prom/build -prom/build.test -promhttp/build -promtest/build -example/example -docs/html -docs/latex +prom/build/* +promhttp/build/* +promtest/build/* tty.gif ttyrecord -_CPack_Packages -bin -vendor/parson/testcpp -*.tmp +_CPack_Packages/ *deb *tar.gz *vgcore* *.o -docs -prom/test/Testing diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..d23ad52 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @digitalocean/timeseries
\ No newline at end of file @@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "libprom" +PROJECT_NAME = "prometheus-client-c" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "@VERSION@" +PROJECT_NUMBER = "0.1.1" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "C based libraries to expose metrics in Promtheus exposition format" +PROJECT_BRIEF = "Prometheus client for the C programming language" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -1666,7 +1666,7 @@ EXTRA_SEARCH_MAPPINGS = # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. -GENERATE_LATEX = NO +GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -2099,7 +2099,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = PROM_LOG_ENABLE PROM_LOG_PRIV +PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2166,6 +2166,12 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of 'which perl'). +# The default file (with absolute path) is: /usr/bin/perl. + +PERL_PATH = /usr/bin/perl + #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- @@ -2179,6 +2185,15 @@ EXTERNAL_PAGES = YES CLASS_DIAGRAMS = YES +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see: +# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -1,3 +1,7 @@ +All rights, title, and interest in this project are owned and licensed to you as set forth below by DigitalOcean, LLC. + +---- + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -1,69 +1,50 @@ -CMAKE_EXTRA_OPTS ?= -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_SKIP_BUILD_RPATH=TRUE -MAKE_FLAGS ?= VERBOSE=1 -CFLAGS ?= -DPROM_LOG_ENABLE -g -O3 -LIB_PATH_SFX := $(shell [ `uname -s` = 'SunOS' ] && echo '_64' ) -LIB_PATH := .:$$PWD/prom/build:$$PWD/promhttp/build:/opt/local/lib +SHELL = /bin/bash -# If TEST is set, build test instead of production binaries -test: TEST := 1 -test: TESTDIR := .test -test: CFLAGS += -Og +GITHUB_ORG = digitalocean -# Enable troubleshooting info per default. -prom: CMAKE_EXTRA_OPTS += -DCMAKE_C_FLAGS="$(CFLAGS)" +# Origin does not point to https://github.com/digitalocean/prometheus-client-c.git in TravisCI so we must add a new +# remote for fetching. Fetch master, diff on the filenames and look for C files. If no changes to C files are made, skip +# the build. +CHANGED_FILES = $(shell git remote add ci https://github.com/${GITHUB_ORG}/prometheus-client-c.git > /dev/null 2>&1; git fetch ci master > /dev/null 2>&1; git diff --name-only ci/master | egrep -v '.*\.md$$') -.PHONY: build test clean distclean docs cleandocs prom promhttp example +ifneq ($(shell echo "x${CHANGED_FILES}x" | sed 's/\n\t //'), xx) +default: build_and_test +else +default: build_and_test +# default: changed_files + # @echo -e "\033[1;32mNothing to build\033[0m" +endif -all: build +build_and_test: changed_files clean build test package smoke +.PHONY: build_and_test -clean: - rm -rf prom/build prom/build.test - rm -rf promhttp/build - rm -rf promtest/build - cd example && $(MAKE) clean - -cleandocs: - rm -rf docs/html docs/latex Doxyfile.tmp +all: build_and_test docs +.PHONY: all -distclean: clean cleandocs - rm -f vendor/parson/testcpp - rm -rf bin - -prom: - -mkdir prom/build$(TESTDIR) && cd prom/build$(TESTDIR) && \ - TEST=$(TEST) cmake -G "Unix Makefiles" $(CMAKE_EXTRA_OPTS) .. - cd prom/build$(TESTDIR) && $(MAKE) $(MAKE_FLAGS) +clean: + ./auto dev -e auto -a clean -# Run "ctest --verbose --force-new-ctest-process" to get the details -test: prom - cd prom/build$(TESTDIR) && LD_LIBRARY_PATH$(LIB_PATH_SFX)=$(LIB_PATH) \ - $(MAKE) test +build: clean + ./auto dev -e auto -a build -a -t +.PHONY: build -promhttp: - -mkdir promhttp/build && cd promhttp/build && \ - cmake -G "Unix Makefiles" $(CMAKE_EXTRA_OPTS) .. - cd promhttp/build && $(MAKE) $(MAKE_FLAGS) +test: build + ./auto dev -e auto -a test +.PHONY: test -build: prom promhttp +package: test + ./auto dev -e auto -a package +.PHONY: smoke -example: build - cd example && $(MAKE) $(MAKE_FLAGS) +docs: smoke + ./auto dev -e auto -a docs +.PHONY: package -docs: cleandocs - VERS=$$( cat VERSION ) && \ - sed -e "s|@VERSION@|$$VERS|" Doxyfile >Doxyfile.tmp - doxygen Doxyfile.tmp +changed_files: + @echo "Changed C files: ${CHANGED_FILES}" +.PHONY: changed_files -# If this test fails with something like 'JSON: root container is not an []' -# the prom2json version picked up may not work, or is possibly for the wrong -# architecture etc.. Check promtest/prom2json.sh for more information. -smoke: build - promtest/prom2json.sh - -mkdir promtest/build && cd promtest/build && \ - cmake -G "Unix Makefiles" $(CMAKE_EXTRA_OPTS) .. - cd promtest/build && $(MAKE) $(MAKE_FLAGS) - @echo "Test takes ~ 1 min ..." - PATH=$${PWD}/bin:$${PATH} \ - LD_LIBRARY_PATH$(LIB_PATH_SFX)=$(LIB_PATH):$$PWD/promtest/build \ - promtest/build/promtest +smoke: package + ./auto dev -e auto -a smoke +.PHONY: smoke diff --git a/Overview.md b/Overview.md deleted file mode 100644 index dc773d9..0000000 --- a/Overview.md +++ /dev/null @@ -1,53 +0,0 @@ -# libprom - -This project provides shared libraries for instrumenting software and expose metrics using the [Prometheus exposition format](https://prometheus.io/docs/instrumenting/exposition_formats/) - -* libprom - Provides the core API. Resources such as counters, gauges, histograms, and - collector registries can be found here. This library has no dependencies on third-party - libraries; however, it does rely on pthreads native to POSIX systems. -* libpromhttp - Provides a simple web handler to expose Prometheus metrics for scraping. - This library has a dependency on libmicrohttpd. - -Documentation can be generated using `make docs`. - -## Versioning - -This project generally follows [semantic versioning](https://semver.org). - -## Development - -Navigate to the root fo this project directory and execute `make` - it will build libprom, libpromhttp and generate the documentation from the source code. To run all tests, use `make test` and `make smoke`. To generate the source documentation only use `make doc`. - -### General Rules for Contribution - -* Open An Issue: Before opening a PR or starting any work, open an issue. In the issue, describe the problem you -want to fix and how you would like to fix it. The level of detail should match the relative size of the proposed change. -This will allow us to work together to determine the best path forward towards a sound solution. - -* Open a Pull Request: After you have gotten confirmation on your proposed change it's time to get to work! Create a -fork and make all of your updates in said fork. For each commit, you must prefix the commit with the associated issue. -For example: `#12 - Fixing typo in documentation`. Before opening a pull request, review the commit log for your fork. -If any of your commit messages are extraneous, squash said commits using `git rebase`. Once you're happy with your -changes and your commit log, open a pull request against the master branch. - -* Engage in the Code Review: After submitting your pull request, there may be some requests for changes. If you have -any questions or concerns, please do not hesitate to make them known. The code review process is a bidirectional -communication process so please do not be shy. Speak up! - -### Coding Rules for Contribution - -* Please follow the general coding style already present in the project. - * Every struct must have a constructor function and destructor function. - * Every method must pass a pointer to the target struct as the first argument. - * Every function that is not a constructor or destructor and does not return a value must return an int to signify - success with 0 and failure with non-zero. - * Every function name must begin with the library name. For example, all functions within prom must begin with `prom_` - and all functions within promhttp must begin with `promhttp_`. - * All variables must be underscore delimited (i.e. snake-case). - * All macros must be captilalized. -* All new functions should introduce a corresponding suite of unit tests. -* If you add functionality to an existing function, be sure to add a corresponding unit test to verify correctness. - -## Misc - -* Language level: C11 @@ -1,53 +1,80 @@ -libprom -======= -This repo is a fork of the [Prometheus client libraries for C](https://github.com/digitalocean/prometheus-client-c) repository. - -It provides shared libraries for instrumenting software and exposing metrics in text format as defined by the Prometheus exposition format (see https://prometheus.io/docs/instrumenting/exposition_formats/ for more details). libprom provides the core API implementation, libpromhttp a simple web handler to expose metrics for scraping. - -Improvements wrt. to the forked source: ---------------------------------------- -- bug and test fixes -- much less useless bloat -- compact function and type names, reduced code dups -- better performance -- enhanced and re-usable logging -- better documentation -- better process metrics about the collector itself incl. scrapetimes -- compact output, i.e. option that allows to supress the huge - `# HELP` and `# TYPE` overhead in prometheus formatted output -- has now a `prom_counter_reset()` function -- `prom_string_builder()` is now public, i.e. usable by libprom consumers -- improved/KISSed process limit scraping (10..200x faster) -- libprom's process_collector is enhanced and now public, i.e. can now be used - by libprom consumers to collect metrics of other processes easily -- new functions `prom_collector_data_set()` and `prom_collector_data_get()` - allow to attach custom data by reference to every collector as well as read - them back -- Solaris/Smartos/OmniOS/Illumos support - -Build, Install, Test --------------------- -Requirements: A recent cmake, gcc and libmicrohttpd version incl. development -aka header files. Other compilers than gcc may work, too (but have not been -tested yet). - -To build libprom and libpromhttp just run `make`. To build the API docs, -run `make docs`. To install the libs, etc. change the working directory -to __target__/build/ and run `make install` (e.g. -`cd prom/build && DESTDIR=/tmp/libprom make install`). - -To test the libs, run `make test`. - -If you do not want to compile libprom by yourself, any successful CI job on the [Github Action Page](https://github.com/jelmd/libprom/actions) contains the libprom archive for x86_64 Ubuntu, where the CI tests have been run. Just click on a CI job and scroll down to the **Artifacts** section. On Linux they probably work on most more or less recent distributions. - -API, Documentation, Usage -------------------------- -- https://jelmd.github.io/libprom/ -- [example directory](https://github.com/jelmd/libprom/tree/main/example) of libprom -- To compile your own libprom enhanced app, just add `#include <libprom/prom.h>` - and optionally `#include <libprom/promhttp.h>` to the related source and link - it with `-lprom` and optionally with `-lpromhttp`. - -Branch info ------------ -The **master** branch is used to track the main development branch of the upstream repo, the **main** branch is the main development branch of this repo. +# prometheus-client-c + +[](https://github.com/digitalocean/prometheus-client-c/actions) + +This project provides shared libraries for instrumenting software via [Prometheus](https://prometheus.io) + +* libprom - Provides the core API. Resources such as counters, gauges, histograms, and + collector registries can be found here. This library has no dependencies on third-party + libraries; however, it does rely on pthreads native to POSIX systems. +* libpromhttp - Provides a simple web handler to expose Prometheus metrics for scraping. + This library has a dependency on libmicrohttpd. + +Documentation can be found +[at the documentation site](https://digitalocean.github.io/prometheus-client-c/) +and an example can be found under example/. Check under the releases tab for tarballs and debian installers + +## Versioning + +This project generally follows [semantic versioning](https://semver.org). For each version you can find a corresponding +release under the releases type. Do not expect the master branch to maintain alignment with the latest release. It may +contain changes not yet released. + +## Development + +The only development dependencies required to get started are Docker, Make and Bash. Navigate to the root fo this +project directory and execute `make`. This process will build the development container, build libprom and libpromhttp, +run the unit tests and execute the smoke tests. + +The stages of the development workflow are automated via `auto` which can be found in the root of this project directory. +Execute `bash auto -h` for information regarding the different subcommands. Information for each subcommand can be +obtained by executing `bash auto CMD -h`. + +## Contributing + +Thank you for your interest in contributing to prometheus-client-c! There two primary ways to get involved with this +project: documentation and code modifications. In either case, the process is identical. + +### General Rules for Contribution + +* Open An Issue: Before opening a PR or starting any work, open an issue. In the issue, describe the problem you +want to fix and how you would like to fix it. The level of detail should match the relative size of the proposed change. +This will allow us to work together to determine the best path forward towards a sound solution. + +* Open a Pull Request: After you have gotten confirmation on your proposed change it's time to get to work! Create a +fork and make all of your updates in said fork. For each commit, you must prefix the commit with the associated issue. +For example: `#12 - Fixing typo in documentation`. Before opening a pull request, review the commit log for your fork. +If any of your commit messages are extraneous, squash said commits using `git rebase`. Once you're happy with your +changes and your commit log, open a pull request against the master branch. + +* Engage in the Code Review: After submitting your pull request, there may be some requests for changes. If you have +any questions or concerns, please do not hesitate to make them known. The code review process is a bidirectional +communication process so please do not be shy. Speak up! + +### Coding Rules for Contribution + +* Please follow the general coding style already present in the project. + * clang-format your code by executing `bash auto format` before submitting a PR. + * Every struct must have a constructor function and destructor function. + * Every method must pass a pointer to the target struct as the first argument. + * Every function that is not a constructor or destructor and does not return a value must return an int to signify + success with 0 and failure with non-zero. + * Every function name must begin with the library name. For example, all functions within prom must begin with `prom_` + and all functions within promhttp must begin with `promhttp_`. + * All variables must be underscore delimited (i.e. snake-case). + * All macros must be captilalized. + * Every pointer reference must be assigned a NULL value after it is destroyed either by prom_free or its + corresponding destructor function. +* All new functions must introduce a corresponding suite of unit tests. +* If you add functionality to an existing function, be sure to add a corresponding unit test to verify correctness. + +## Misc + +* Language level: C11 +* Operating Systems: + * Ubuntu 20.04 + * Ubuntu 18.04 + * Ubuntu 16.04 + * Debian Buster + * Debian Stretch + * Debian Jessie @@ -1 +1 @@ -1.2.0 +0.1.2 @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +export PROJECT_ROOT=$(pushd $(dirname $0) > /dev/null; echo $PWD; popd > /dev/null) +export DOCKER_IMAGE +export CI=${CI:=0} +export CC=/usr/bin/gcc + +PROGRAM_NAME="$(basename $0)" + +usage(){ + cat <<EOF + +$PROGRAM_NAME [command [options...]] + +Provide developer workflow automation + +$PROGRAM_NAME command -h for help + +COMMANDS + +$(commands) + +ENVIRONMENT + +AUTO_DEBUG Set to 1 to enable and 0 to disable + +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +declare -i DEV=${DEV:=1} && export DEV +declare lib="$(dirname ${BASH_SOURCE[0]})/autolib" +source "${lib}/autolib.sh" + +commands(){ + while read cmd; do + printf "${cmd} - " + source "${lib}/cmd/${cmd}" + echo "$short" + done < <(ls -1 "${lib}/cmd") +} + +main(){ + if [[ "$PROJECT_ROOT" != "$PWD" ]]; then + echo "You must execute auto within the PROJECT_ROOT $PROJECT_ROOT" + exit 1 + fi + if (($# < 1)); then + usage + exit 1 + fi + local cmd=$1 + case "$cmd" in + ( -h | --help | help ) { + usage + exit 0 + } ;; + ( build | dev | test | package | docs | clean | smoke | format ) { + shift + exec "${lib}/cmd/${cmd}" $@ || exit $? + } ;; + ( * ) { + usage + exit 1 + } ;; + esac +} + +[[ $BASH_SOURCE == $0 ]] && main $@
\ No newline at end of file diff --git a/autolib/autolib.sh b/autolib/autolib.sh new file mode 100644 index 0000000..4230995 --- /dev/null +++ b/autolib/autolib.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +lib="$(dirname ${BASH_SOURCE[0]})" + +source "${lib}/output.sh" +source "${lib}/build.sh" +source "${lib}/docker.sh" +source "${lib}/env.sh" +source "${lib}/test.sh" diff --git a/autolib/build.sh b/autolib/build.sh new file mode 100644 index 0000000..42ec7de --- /dev/null +++ b/autolib/build.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +lib="$(dirname ${BASH_SOURCE[0]})" + +source "${lib}/env.sh" +source "${lib}/output.sh" + +# build all libraries +autolib_build() { + local lib=$1 + local build_test=$2 + + if [[ ! -d ${lib}/build ]]; then + mkdir ${lib}/build || { + autolib_output_error "Failed to create build directory" + return 1 + } + fi + pushd ${lib}/build > /dev/null || return $? + autolib_output_banner "${lib}: CMake Build Stage" + # YOU MUST set TEST to 1 in order to build the tests + TEST=$build_test cmake -v .. || { + autolib_output_error "${lib}: CMake Failure" + return 1 + } + autolib_output_banner "${lib}: Make Build Stage" + make || { + autolib_output_error "${lib} Make Failure" + return 1 + } + popd > /dev/null || return $? +}
\ No newline at end of file diff --git a/autolib/cmd/build b/autolib/cmd/build new file mode 100755 index 0000000..f65d62f --- /dev/null +++ b/autolib/cmd/build @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +PROGRAM_NAME=$(basename $0) + +short="Build the project" +read -d '' long <<EOF + +You MUST execute this command within the development container. + +-t Include the test build for testing + +EOF + + +usage(){ + cat <<EOF + +$PROGRAM_NAME [-h] + +$short + +DESCRIPTION + +$long +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +source "$(dirname ${BASH_SOURCE[0]})/../autolib.sh" + +declare AUTOLIB_BUILD_TEST=0 +declare AUTOLIB_TEST_LIB + +run(){ + autolib_check_dev || return $? + autolib_output_banner "Executing ${PROGRAM_NAME}" + declare -a libs + if [ -z "$AUTOLIB_TEST_LIB" ]; then + libs+=(prom promhttp) + else + libs+=($AUTOLIB_TEST_LIB) + fi + + for lib in ${libs[@]}; do + autolib_build "$lib" "$AUTOLIB_BUILD_TEST" || return $? + done + autolib_output_success "Build Complete" +} + +main(){ + while getopts 'hl:t' opt; do + case "$opt" in + ( h ) { + usage && exit 0 + } ;; + ( t ) { + AUTOLIB_BUILD_TEST=1 + } ;; + ( l ) { + AUTOLIB_TEST_LIB="$OPTARG" + } ;; + ( * ) { + usage && exit 1 + } ;; + esac + done + run $@ || exit $? +} + +[[ $BASH_SOURCE == $0 ]] && main $@
\ No newline at end of file diff --git a/autolib/cmd/clean b/autolib/cmd/clean new file mode 100755 index 0000000..46e2b28 --- /dev/null +++ b/autolib/cmd/clean @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +PROGRAM_NAME="$(basename $0)" + +short="Clean the development environment" + +read -d '' long <<EOF +You MUST execute this command from your development workstation. You +MUST NOT execute this command from an existing docker container. +EOF + +usage() { + cat <<EOF + +$PROGRAM_NAME [-h] + +$short + +DESCRIPTION + +$long + +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +source $(dirname ${BASH_SOURCE[0]})/../autolib.sh + + +run(){ + local r + autolib_check_dev || return $? + autolib_output_banner "Executing ${PROGRAM_NAME}" + + pushd "$(dirname ${BASH_SOURCE[0]})/../.." > /dev/null || return $? + for pkg in libprom-dev libpromhttp-dev; do + if dpkg --list | grep -q libprom-dev; then + dpkg --remove "$pkg" + fi + done + rm -rf prom/build/* + rm -rf promhttp/build/* + popd > /dev/null || return $? +} + +main(){ + while getopts "h" opt; do + case $opt in + ( h ) { + usage && exit 0 + } ;; + ( * ) { + usage && exit 1 + } + esac + done + run $@; exit $? +} + +[[ $BASH_SOURCE == $0 ]] && main $@
\ No newline at end of file diff --git a/autolib/cmd/dev b/autolib/cmd/dev new file mode 100755 index 0000000..2c31dd3 --- /dev/null +++ b/autolib/cmd/dev @@ -0,0 +1,124 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +PROGRAM_NAME="$(basename $0)" + +short="Initialize the development environment" + +read -d '' long <<EOF +You MUST execute this command from your development workstation. You +MUST NOT execute this command from an existing docker container. + +-e Execute the following executable +-a Pass an argument to the executable given by -e. You may specify + this flag multiple times. The order is preserved. +-p Port to map to the host environment. + Default: 8000 +-i The docker image to use. + Default: ubuntu:18.04 + Options: ubuntu:18.04, ubuntu:16.04, debian:buster, debian:stretch, debian:jessie +EOF + +usage() { + cat <<EOF + +$PROGRAM_NAME [-h | -e EXECUTABLE [-a ARG1 -a ARG2 ...]] + +$short + +DESCRIPTION + +$long + +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +source $(dirname ${BASH_SOURCE[0]})/../autolib.sh + +declare DOCKER_IMAGE=${DOCKER_IMAGE:=ubuntu:18.04} +declare DOCKER_EXEC +declare DOCKER_PORT=${DOCKER_PORT=8000} +declare -a DOCKER_EXEC_ARGS + +run(){ + local r + autolib_output_banner "Building development container" + autolib_write_dockerfile "$DOCKER_IMAGE" || return $? + pushd docker > /dev/null || return $? + make || { + r=$? + autolib_output_error "Docker Build Failure" + return $r + } + popd > /dev/null + + autolib_output_banner "Entering development environment" + declare -a args + args+=(--name prometheus-client-c-dev) # Give the running container a name to use instead of the ID + args+=(--interactive) # Interactive shell + args+=(--volume "${PWD}:/code") # Mount code into the container + args+=(--env DEV=1) # Enables check if executing in dev environment + args+=(--cap-add=SYS_PTRACE) # Required for valgrind and gdb + args+=(--security-opt seccomp=unconfined) # Required for debugging + args+=(--publish $DOCKER_PORT:$DOCKER_PORT) # map DOCKER_PORT to the host + args+=(--rm) # Remove when done + if (( ${CI} == 0 )); then + args+=(--tty) + fi + + echo ${args[@]} + docker run ${args[@]} prometheus-client-c-dev ${DOCKER_EXEC} ${DOCKER_EXEC_ARGS[@]} +} + +main(){ + while getopts "he:a:i:p:" opt; do + case $opt in + ( h ) { + usage && exit 0 + } ;; + ( i ) { + DOCKER_IMAGE="$OPTARG" + } ;; + ( e ) { + DOCKER_EXEC="$OPTARG" + } ;; + ( a ) { + DOCKER_EXEC_ARGS+=($OPTARG) + } ;; + ( p ) { + DOCKER_PORT=${OPTARG} + } ;; + esac + done + run $@; exit $? +} + +[[ $BASH_SOURCE == $0 ]] && main $@ + +# curl -L -o /tmp/gcc-${GCC_VERSION}.tar.xz https://ftpmirror.gnu.org/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz && \ +# tar xf /tmp/gcc-${GCC_VERSION}.tar.xz -C /tmp && \ +# rm -rf /tmp/gcc-${GCC_VERSION}.tar.xz && \ +# cd /tmp/gcc-${GCC_VERSION} && \ +# contrib/download_prerequisites && \ +# ./configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/usr/local/gcc --enable-checking=release --enable-languages=c --disable-multilib && \ +# make && \ +# make install-strip && \ +# cd $OLDPWD && \ +# echo 'export PATH=/usr/local/gcc/bin:$PATH' >> /root/.bashrc && \ +# echo 'LD_LIBRARY_PATH=/usr/local/gcc/lib64:$LD_LIBRARY_PATH' >> /root/.bashrc && \ +# curl -sL https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz | tar xzf - -C /opt && \ +# cp /opt/cmake-${CMAKE_VERSION}-Linux-x86_64/bin/* /usr/local/bin/ && \ +# cp -R /opt/cmake-${CMAKE_VERSION}-Linux-x86_64/share/cmake-3.14 /usr/local/share/ && \
\ No newline at end of file diff --git a/autolib/cmd/docs b/autolib/cmd/docs new file mode 100755 index 0000000..207f459 --- /dev/null +++ b/autolib/cmd/docs @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +PROGRAM_NAME="$(basename $0)" + +short="Generate the documentation" + +read -d '' long <<EOF +You MUST execute this command from your development workstation. You MUST NOT +execute this command from an existing docker container. +EOF + +usage() { + cat <<EOF + +$PROGRAM_NAME [-h] + +$short + +DESCRIPTION + +$long + +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +source $(dirname ${BASH_SOURCE[0]})/../autolib.sh + +run(){ + local r + autolib_check_dev || return $? + autolib_output_banner "Executing ${PROGRAM_NAME}" + doxygen Doxyfile || { + r=$? + autolib_output_error "Failed to generate Doxygen documentation" + return $r + } + if [ -d /tmp/html ]; then rm -rf /tmp/html; fi + mv docs/html /tmp/ + rm -r docs/latex + cp -R /tmp/html/* docs/ + autolib_output_success "Doxygen documentation generation complete" +} + +main(){ + while getopts "h" opt; do + case $opt in + ( h ) { + usage && exit 0 + } ;; + esac + done + run $@; exit $? +} + +[[ $BASH_SOURCE == $0 ]] && main $@
\ No newline at end of file diff --git a/autolib/cmd/format b/autolib/cmd/format new file mode 100755 index 0000000..b2e13d8 --- /dev/null +++ b/autolib/cmd/format @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +PROGRAM_NAME=$(basename $0) + +short="Format the project" +read -d '' long <<EOF + +You SHOULD execute this command within the development container. + +EOF + +usage(){ + cat <<EOF + +$PROGRAM_NAME [-h] + +$short + +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +source "$(dirname ${BASH_SOURCE[0]})/../autolib.sh" + +main(){ + declare -i return_value=0 + + while getopts "h" opt; do + case $opt in + ( h ) { + usage && exit 0 + } ;; + esac + done + + while read file_path; do + local temp + temp=$(mktemp) || { + return_value=$? + autolib_output_error "failed to create temp file" + exit $return_code + } + + { + clang-format --style=file $file_path > $temp && + sed -i 's/Copyright 2019-2020/Copyright 2019-2020/g' $temp && + mv $temp $file_path + } || { + return_value=$? + autolib_output_error "failed to format project" + exit $return_code + } + done < <(find ${PWD} -regextype posix-extended -type f -regex ".*/prom[[:alnum:]_-]+\.[c|h]" ! -regex '.*CPack.*') || { + return_value=$? + autolib_output_error "failed to find relevant C project files" + exit $return_code + } +} + +[[ $BASH_SOURCE == $0 ]] && main $@
\ No newline at end of file diff --git a/autolib/cmd/package b/autolib/cmd/package new file mode 100755 index 0000000..b1d0d35 --- /dev/null +++ b/autolib/cmd/package @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +PROGRAM_NAME="$(basename $0)" + +short="Package prometheus-client-c" + +read -d '' long <<EOF +You MUST execute this command from your development workstation. You MUST NOT +execute this command from an existing docker container. +EOF + +usage() { + cat <<EOF + +$PROGRAM_NAME [-h] + +$short + +DESCRIPTION + +$long + +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +source $(dirname ${BASH_SOURCE[0]})/../autolib.sh + +LIBS=(prom promhttp) + +run(){ + local r + autolib_check_dev || return $? + autolib_output_banner "Executing ${PROGRAM_NAME}" + + for lib in ${LIBS[@]}; do + pushd ${lib} > /dev/null || return $? + cpack \ + --config build/CPackConfig.cmake \ + -D "CPACK_DEBIAN_PACKAGE_MAINTAINER=Demitri Swan" \ + -D "CPACK_PACKAGE_CONTACT=dswan@digitalocean.com" || { + + r=$? + autolib_output_error "${lib}: Package build failed" + return $r + } + popd > /dev/null || return $? + done + autolib_output_success "Package build success" +} + +main(){ + while getopts "h" opt; do + case $opt in + ( h ) { + usage && exit 0 + } ;; + esac + done + run $@; exit $? +} + +[[ $BASH_SOURCE == $0 ]] && main $@
\ No newline at end of file diff --git a/autolib/cmd/smoke b/autolib/cmd/smoke new file mode 100755 index 0000000..1c0af79 --- /dev/null +++ b/autolib/cmd/smoke @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +PROGRAM_NAME=$(basename $0) + +short="Extinguish smoke" +read -d '' long <<EOF + +You MUST execute this command within the development container. + +EOF + +usage(){ + cat <<EOF + +$PROGRAM_NAME [-h] + +$short + +DESCRIPTION + +$long +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +source "$(dirname ${BASH_SOURCE[0]})/../autolib.sh" + +run(){ + local r=0; + autolib_check_dev || return $? + autolib_output_banner "Executing ${PROGRAM_NAME}" + if [ ! -d promtest/build ]; then mkdir promtest/build; fi + pushd promtest/build > /dev/null + { cmake .. && make; } || { + r=$? + autolib_output_error "failed to build promtest" + return $r + } + ./promtest || { + r=$? + autolib_output_error "promtest failed" + return $r + } + autolib_output_success "Smoke test pass" + popd > /dev/null +} + +main(){ + while getopts 'h' opt; do + case "$opt" in + ( h ) { + usage && exit 0 + } ;; + ( * ) { + usage && exit 1 + } ;; + esac + done + run $@ || exit $? +} + +[[ $BASH_SOURCE == $0 ]] && main $@
\ No newline at end of file diff --git a/autolib/cmd/test b/autolib/cmd/test new file mode 100755 index 0000000..99b65be --- /dev/null +++ b/autolib/cmd/test @@ -0,0 +1,92 @@ +#!/usr/bin/env bash + +######################################################################################################################## +# Meta +######################################################################################################################## + +# Propagate environment variables +if [[ "$AUTO_DEBUG" == "1" ]]; then + set -x + export AUTO_DEBUG=1 +fi + +PROGRAM_NAME=$(basename $0) + +short="Test the project" +read -d '' long <<EOF + +You MUST execute this command within the development container. + +EOF + +usage(){ + cat <<EOF + +$PROGRAM_NAME [-h] [-m] [-t] + +$short + +OPTIONS + +-t Run the unit/integration tests only +-m Run the memory tests only + +DESCRIPTION + +$long +EOF +} + +######################################################################################################################## +# End Meta +######################################################################################################################## + +source "$(dirname ${BASH_SOURCE[0]})/../autolib.sh" + +declare -i AUTO_TEST_MEM_ONLY=0 +declare -i AUTO_TEST_TESTS_ONLY=0 + +run(){ + autolib_check_dev || return $? + autolib_output_banner "Executing ${PROGRAM_NAME}" + for lib in prom; do + if (( AUTO_TEST_MEM_ONLY == 0 && AUTO_TEST_TESTS_ONLY == 0 )); then + { autolib_test "${lib}" && autolib_mem_test "${lib}"; } || return $? + fi + + if (( AUTO_TEST_MEM_ONLY == 1 )); then + autolib_mem_test "${lib}" || return $? + fi + + if (( AUTO_TEST_TESTS_ONLY == 1 )); then + autolib_test "${lib}" || return $? + fi + done +} + +main(){ + while getopts 'hmts' opt; do + case "$opt" in + ( h ) { + usage && exit 0 + } ;; + ( m ) { + AUTO_TEST_MEM_ONLY=1 + } ;; + ( t ) { + AUTO_TEST_TESTS_ONLY=1 + } ;; + ( * ) { + usage && exit 1 + } ;; + esac + done + local total=$((AUTO_TEST_MEM_ONLY + AUTO_TEST_TESTS_ONLY)) + if (( total > 1 )); then + usage + exit 1 + fi + run $@ || exit $? +} + +[[ $BASH_SOURCE == $0 ]] && main $@
\ No newline at end of file diff --git a/autolib/docker.sh b/autolib/docker.sh new file mode 100644 index 0000000..7f78d83 --- /dev/null +++ b/autolib/docker.sh @@ -0,0 +1,132 @@ +#!/usr/bin/env bash + +lib="$(dirname ${BASH_SOURCE[0]})" +source "${lib}/output.sh" + +PROJECT_ROOT=$(pushd "$(dirname ${BASH_SOURCE[0]})/.." > /dev/null; echo $PWD; popd > /dev/null) + +autolib_new_debian_template(){ + cat <<'EOF' +FROM __DOCKER_IMAGE__ + +RUN set -x && \ + apt-get update && \ + apt-get install -y apt-utils software-properties-common clang-format && \ + add-apt-repository ppa:ubuntu-toolchain-r/test && \ + apt-get update -y && \ + apt-get install -y curl tar build-essential git pkg-config gdb valgrind gcc-10 libmicrohttpd-dev doxygen graphviz && \ + rm -f /usr/bin/gcc && \ + ln -s /usr/bin/gcc-10 /usr/bin/gcc && \ + curl -sL https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-Linux-x86_64.tar.gz | tar xzf - -C /opt && \ + cp /opt/cmake-3.14.5-Linux-x86_64/bin/* /usr/local/bin/ && \ + cp -R /opt/cmake-3.14.5-Linux-x86_64/share/cmake-3.14 /usr/local/share/ && \ + curl -sL https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz 2> /dev/null | tar xzf - -C /usr/local && \ + mkdir -p /gopath/{src,bin} && \ + printf 'export GOPATH=/gopath\nexport PATH=$PATH:/usr/local/go/bin:/gopath/bin\n' > /root/.bash_profile && \ + printf '#!/usr/bin/env bash\nsource /root/.bash_profile\nexec /bin/bash $@\n' > /entrypoint && \ + chmod +x /entrypoint && \ + GOPATH=/gopath /usr/local/go/bin/go get github.com/prometheus/prom2json && \ + GOPATH=/gopath /usr/local/go/bin/go install github.com/prometheus/prom2json/cmd/prom2json && \ + GOPATH=/gopath /usr/local/go/bin/go get github.com/git-chglog/git-chglog && \ + GOPATH=/gopath /usr/local/go/bin/go install github.com/git-chglog/git-chglog/cmd/git-chglog && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /code +ENTRYPOINT ["/entrypoint"] + +EOF +} + +autolib_old_debian_template(){ + cat <<'EOF' +FROM __DOCKER_IMAGE__ + +ENV GCC_VERSION 10.1.0 + +RUN set -x && \ + apt-get update && \ + apt-get install -y apt-utils clang-format && \ + apt-get install -y curl tar build-essential git pkg-config gdb valgrind gcc libmicrohttpd-dev doxygen graphviz && \ + curl -sL https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-Linux-x86_64.tar.gz | tar xzf - -C /opt && \ + cp /opt/cmake-3.14.5-Linux-x86_64/bin/* /usr/local/bin/ && \ + cp -R /opt/cmake-3.14.5-Linux-x86_64/share/cmake-3.14 /usr/local/share/ && \ + curl -sL https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz 2> /dev/null | tar xzf - -C /usr/local && \ + mkdir -p /gopath/{src,bin} && \ + printf 'export GOPATH=/gopath\nexport PATH=$PATH:/usr/local/go/bin:/gopath/bin\n' > /root/.bash_profile && \ + printf '#!/usr/bin/env bash\nsource /root/.bash_profile\nexec /bin/bash $@\n' > /entrypoint && \ + chmod +x /entrypoint && \ + GOPATH=/gopath /usr/local/go/bin/go get github.com/prometheus/prom2json && \ + GOPATH=/gopath /usr/local/go/bin/go install github.com/prometheus/prom2json/cmd/prom2json && \ + GOPATH=/gopath /usr/local/go/bin/go get github.com/git-chglog/git-chglog && \ + GOPATH=/gopath /usr/local/go/bin/go install github.com/git-chglog/git-chglog/cmd/git-chglog && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /code +ENTRYPOINT ["/entrypoint"] + +EOF +} + +autolib_debian_jessie_template() { + cat <<EOF +FROM __DOCKER_IMAGE__ + +ENV GCC_VERSION 10.1.0 + +RUN set -x && \ + apt-get update && \ + apt-get install -y apt-utils && \ + apt-get install -y curl tar build-essential git pkg-config gdb valgrind gcc libmicrohttpd-dev doxygen graphviz && \ + curl -sL https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-Linux-x86_64.tar.gz | tar xzf - -C /opt && \ + cp /opt/cmake-3.14.5-Linux-x86_64/bin/* /usr/local/bin/ && \ + cp -R /opt/cmake-3.14.5-Linux-x86_64/share/cmake-3.14 /usr/local/share/ && \ + curl -sL https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz 2> /dev/null | tar xzf - -C /usr/local && \ + mkdir -p /gopath/{src,bin} && \ + printf 'export GOPATH=/gopath\nexport PATH=$PATH:/usr/local/go/bin:/gopath/bin\n' > /root/.bash_profile && \ + printf '#!/usr/bin/env bash\nsource /root/.bash_profile\nexec /bin/bash $@\n' > /entrypoint && \ + chmod +x /entrypoint && \ + GOPATH=/gopath /usr/local/go/bin/go get github.com/prometheus/prom2json && \ + GOPATH=/gopath /usr/local/go/bin/go install github.com/prometheus/prom2json/cmd/prom2json && \ + GOPATH=/gopath /usr/local/go/bin/go get github.com/git-chglog/git-chglog && \ + GOPATH=/gopath /usr/local/go/bin/go install github.com/git-chglog/git-chglog/cmd/git-chglog && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /code +ENTRYPOINT ["/entrypoint"] + + +EOF +} + +autolib_write_dockerfile(){ + local docker_image="$1" + local r + case "$docker_image" in + ( ubuntu:20.04 | ubuntu:18.04 ) { + autolib_new_debian_template | sed "s/__DOCKER_IMAGE__/$docker_image/g" > ${PROJECT_ROOT}/docker/Dockerfile || { + r=$? + autolib_output_error "failed to generate dockerfile" + return $r + } + } ;; + ( ubuntu:16.04 | debian:buster | debian:stretch ) { + autolib_old_debian_template | sed "s/__DOCKER_IMAGE__/$docker_image/g" > ${PROJECT_ROOT}/docker/Dockerfile || { + r=$? + autolib_output_error "failed to generate dockerfile" + return $r + } + } ;; + ( debian:jessie ) { + autolib_debian_jessie_template | sed "s/__DOCKER_IMAGE__/$docker_image/g" > ${PROJECT_ROOT}/docker/Dockerfile || { + r=$? + autolib_output_error "failed to generate dockerfile" + return $r + } + } ;; + ( * ) { + r=1 + autolib_output_error "unsupported DOCKER_IMAGE: $docker_image" + return $r + } ;; + esac +}
\ No newline at end of file diff --git a/autolib/env.sh b/autolib/env.sh new file mode 100644 index 0000000..431b8b3 --- /dev/null +++ b/autolib/env.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +autolib_check_dev(){ + local dev=${DEV:=0} + if (( dev == 0 )); then + autolib_output_err "Not executing in the Docker environment" + return 1 + fi +}
\ No newline at end of file diff --git a/autolib/output.sh b/autolib/output.sh new file mode 100644 index 0000000..18207cd --- /dev/null +++ b/autolib/output.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Print a stage. Pass a string to be enveloped in a banner. +autolib_output_banner(){ + echo -e "\n\033[1m########################################################################\033[0m" >&2 + echo -e "\033[1m> $@\033[0m" >&2 + echo -e "\033[1m########################################################################\033[0m\n" >&2 +} + +autolib_output_error() { + echo -e "\033[1;31mERROR: $@\033[0m" >&2 +} + +autolib_output_success() { + echo -e "\033[1;32mSUCCESS: $@\033[0m" >&2 +} + +autolib_output_warn() { + echo -e "\033[1;33mWARN: $@\033[0m" >&2 +}
\ No newline at end of file diff --git a/autolib/test.sh b/autolib/test.sh new file mode 100644 index 0000000..dd30f76 --- /dev/null +++ b/autolib/test.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +lib="$(dirname ${BASH_SOURCE[0]})" + +source "${lib}/output.sh" + +autolib_test() { + local library="$1" + local r + pushd ${lib}/build > /dev/null || return $? + autolib_output_banner "${library}: Starting Tests" + ARGS=' --track-origins=yes --output-on-failure=yes --verbose' make test && { + r=$? + autolib_output_success "${library}: Test Pass" + } || { + r=$? + autolib_output_error "${library}: Test Failure" + } + popd > /dev/null || return $? + return $r +} + +autolib_mem_test() { + local library="$1" + local r + pushd ${library} > /dev/null || return $? + autolib_output_banner "${library}: Starting MemTests" + while read test_file; do + valgrind --leak-check=full --error-exitcode=1 --num-callers=30 "$test_file" && { + r=$? + autolib_output_success "${library} ${test_file}: MemTest Pass" + } || { + r=$? + autolib_output_error "${library} ${test_file}: MemTest Failure" + } + done < <(find build -maxdepth 1 -regex ".*prom.*test$") + popd > /dev/null || return $? + return $r +}
\ No newline at end of file diff --git a/docker/Makefile b/docker/Makefile new file mode 100644 index 0000000..375bb2b --- /dev/null +++ b/docker/Makefile @@ -0,0 +1,2 @@ +docker: + docker build -t prometheus-client-c-dev .
\ No newline at end of file diff --git a/docs/annotated.html b/docs/annotated.html new file mode 100644 index 0000000..7199386 --- /dev/null +++ b/docs/annotated.html @@ -0,0 +1,80 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Class List</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="headertitle"> +<div class="title">Class List</div> </div> +</div><!--header--> +<div class="contents"> +<div class="textblock">Here are the classes, structs, unions and interfaces with brief descriptions:</div><div class="directory"> +<table class="directory"> +<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="structprom__histogram__buckets.html" target="_self">prom_histogram_buckets</a></td><td class="desc"></td></tr> +</table> +</div><!-- directory --> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/bc_s.png b/docs/bc_s.png Binary files differnew file mode 100644 index 0000000..224b29a --- /dev/null +++ b/docs/bc_s.png diff --git a/docs/bdwn.png b/docs/bdwn.png Binary files differnew file mode 100644 index 0000000..940a0b9 --- /dev/null +++ b/docs/bdwn.png diff --git a/docs/classes.html b/docs/classes.html new file mode 100644 index 0000000..2db9609 --- /dev/null +++ b/docs/classes.html @@ -0,0 +1,84 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Class Index</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="headertitle"> +<div class="title">Class Index</div> </div> +</div><!--header--> +<div class="contents"> +<div class="qindex"><a class="qindex" href="#letter_p">p</a></div> +<table class="classindex"> +<tr><td rowspan="2" valign="bottom"><a name="letter_p"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">  p  </div></td></tr></table> +</td><td></td></tr> +<tr><td></td></tr> +<tr><td valign="top"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets</a>   </td><td></td></tr> +<tr><td></td><td></td></tr> +</table> +<div class="qindex"><a class="qindex" href="#letter_p">p</a></div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/closed.png b/docs/closed.png Binary files differnew file mode 100644 index 0000000..98cc2c9 --- /dev/null +++ b/docs/closed.png diff --git a/docs/dir_000003_000000.html b/docs/dir_000003_000000.html new file mode 100644 index 0000000..2f78386 --- /dev/null +++ b/docs/dir_000003_000000.html @@ -0,0 +1,75 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: promhttp/include -> prom Relation</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_21619567660c3332e6a61228c76007f9.html">promhttp</a></li><li class="navelem"><a class="el" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="contents"> +<h3>include → prom Relation</h3><table class="dirtab"><tr class="dirtab"><th class="dirtab">File in promhttp/include</th><th class="dirtab">Includes file in prom</th></tr><tr class="dirtab"><td class="dirtab"><a class="el" href="promhttp_8h.html">promhttp.h</a></td><td class="dirtab"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a> / <a class="el" href="prom__collector__registry_8h.html">prom_collector_registry.h</a></td></tr></table></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/dir_21619567660c3332e6a61228c76007f9.html b/docs/dir_21619567660c3332e6a61228c76007f9.html new file mode 100644 index 0000000..43d2225 --- /dev/null +++ b/docs/dir_21619567660c3332e6a61228c76007f9.html @@ -0,0 +1,94 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: promhttp Directory Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_21619567660c3332e6a61228c76007f9.html">promhttp</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">promhttp Directory Reference</div> </div> +</div><!--header--> +<div class="contents"> +<div class="dynheader"> +Directory dependency graph for promhttp:</div> +<div class="dyncontent"> +<div class="center"><img src="dir_21619567660c3332e6a61228c76007f9_dep.png" border="0" usemap="#dir__21619567660c3332e6a61228c76007f9__dep" alt="promhttp"/></div> +<map name="dir__21619567660c3332e6a61228c76007f9__dep" id="dir__21619567660c3332e6a61228c76007f9__dep"> +<area shape="rect" id="node2" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html" title="include" alt="" coords="27,27,99,75"/> +<area shape="rect" id="node3" href="dir_2c63f04010e7ff462eba5e344f58cd21.html" title="prom" alt="" coords="27,123,99,171"/> +<area shape="rect" id="edge1-headlabel" href="dir_000003_000000.html" title="1" alt="" coords="66,97,76,111"/> +<area shape="rect" id="clust1" href="dir_21619567660c3332e6a61228c76007f9.html" alt="" coords="16,16,216,85"/> +</map> +</div> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="subdirs"></a> +Directories</h2></td></tr> +</table> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/dir_21619567660c3332e6a61228c76007f9_dep.dot b/docs/dir_21619567660c3332e6a61228c76007f9_dep.dot new file mode 100644 index 0000000..34aead6 --- /dev/null +++ b/docs/dir_21619567660c3332e6a61228c76007f9_dep.dot @@ -0,0 +1,12 @@ +digraph "promhttp" { + compound=true + node [ fontsize="10", fontname="Helvetica"]; + edge [ labelfontsize="10", labelfontname="Helvetica"]; + subgraph clusterdir_21619567660c3332e6a61228c76007f9 { + graph [ bgcolor="#eeeeff", pencolor="black", label="" URL="dir_21619567660c3332e6a61228c76007f9.html"]; + dir_21619567660c3332e6a61228c76007f9 [shape=plaintext label="promhttp"]; + dir_8d140c3a8bac3cd45205c9ea74fd211f [shape=box label="include" color="black" fillcolor="white" style="filled" URL="dir_8d140c3a8bac3cd45205c9ea74fd211f.html"]; + } + dir_2c63f04010e7ff462eba5e344f58cd21 [shape=box label="prom" fillcolor="white" style="filled" color="red" URL="dir_2c63f04010e7ff462eba5e344f58cd21.html"]; + dir_8d140c3a8bac3cd45205c9ea74fd211f->dir_2c63f04010e7ff462eba5e344f58cd21 [headlabel="1", labeldistance=1.5 headhref="dir_000003_000000.html"]; +} diff --git a/docs/dir_21619567660c3332e6a61228c76007f9_dep.map b/docs/dir_21619567660c3332e6a61228c76007f9_dep.map new file mode 100644 index 0000000..90600f2 --- /dev/null +++ b/docs/dir_21619567660c3332e6a61228c76007f9_dep.map @@ -0,0 +1,6 @@ +<map id="promhttp" name="promhttp"> +<area shape="rect" id="node2" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html" title="include" alt="" coords="27,27,99,75"/> +<area shape="rect" id="node3" href="dir_2c63f04010e7ff462eba5e344f58cd21.html" title="prom" alt="" coords="27,123,99,171"/> +<area shape="rect" id="edge1-headlabel" href="dir_000003_000000.html" title="1" alt="" coords="66,97,76,111"/> +<area shape="rect" id="clust1" href="dir_21619567660c3332e6a61228c76007f9.html" alt="" coords="16,16,216,85"/> +</map> diff --git a/docs/dir_21619567660c3332e6a61228c76007f9_dep.md5 b/docs/dir_21619567660c3332e6a61228c76007f9_dep.md5 new file mode 100644 index 0000000..d92ba69 --- /dev/null +++ b/docs/dir_21619567660c3332e6a61228c76007f9_dep.md5 @@ -0,0 +1 @@ +5a733acb8d15f543b6a2b5e7983b6f1e
\ No newline at end of file diff --git a/docs/dir_21619567660c3332e6a61228c76007f9_dep.png b/docs/dir_21619567660c3332e6a61228c76007f9_dep.png Binary files differnew file mode 100644 index 0000000..d39190e --- /dev/null +++ b/docs/dir_21619567660c3332e6a61228c76007f9_dep.png diff --git a/docs/dir_2c63f04010e7ff462eba5e344f58cd21.html b/docs/dir_2c63f04010e7ff462eba5e344f58cd21.html new file mode 100644 index 0000000..c4991f3 --- /dev/null +++ b/docs/dir_2c63f04010e7ff462eba5e344f58cd21.html @@ -0,0 +1,83 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom Directory Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom Directory Reference</div> </div> +</div><!--header--> +<div class="contents"> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="subdirs"></a> +Directories</h2></td></tr> +</table> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/dir_83821d63a26a6eb889c4977bd95ca990.html b/docs/dir_83821d63a26a6eb889c4977bd95ca990.html new file mode 100644 index 0000000..bda5750 --- /dev/null +++ b/docs/dir_83821d63a26a6eb889c4977bd95ca990.html @@ -0,0 +1,116 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include Directory Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">include Directory Reference</div> </div> +</div><!--header--> +<div class="contents"> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a> +Files</h2></td></tr> +<tr class="memitem:prom_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom_8h.html">prom.h</a> <a href="prom_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom_8h"><td class="mdescLeft"> </td><td class="mdescRight">Include <a class="el" href="prom_8h.html" title="Include prom.h to include the entire public API. ">prom.h</a> to include the entire public API. <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__alloc_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__alloc_8h.html">prom_alloc.h</a> <a href="prom__alloc_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__alloc_8h"><td class="mdescLeft"> </td><td class="mdescRight">memory management <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__collector_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html">prom_collector.h</a> <a href="prom__collector_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__collector_8h"><td class="mdescLeft"> </td><td class="mdescRight">A Prometheus collector returns a collection of metrics. <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__collector__registry_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html">prom_collector_registry.h</a> <a href="prom__collector__registry_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__collector__registry_8h"><td class="mdescLeft"> </td><td class="mdescRight">The collector registry registers collectors for metric exposition. <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__counter_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html">prom_counter.h</a> <a href="prom__counter_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__counter_8h"><td class="mdescLeft"> </td><td class="mdescRight"><a href="https://prometheus.io/docs/concepts/metric_types/#counter">https://prometheus.io/docs/concepts/metric_types/#counter</a> <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__gauge_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html">prom_gauge.h</a> <a href="prom__gauge_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__gauge_8h"><td class="mdescLeft"> </td><td class="mdescRight"><a href="https://prometheus.io/docs/concepts/metric_types/#gauge">https://prometheus.io/docs/concepts/metric_types/#gauge</a> <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__histogram_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram_8h.html">prom_histogram.h</a> <a href="prom__histogram_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__histogram_8h"><td class="mdescLeft"> </td><td class="mdescRight"><a href="https://prometheus.io/docs/concepts/metric_types/#histogram">https://prometheus.io/docs/concepts/metric_types/#histogram</a> <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__histogram__buckets_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram__buckets_8h.html">prom_histogram_buckets.h</a> <a href="prom__histogram__buckets_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__histogram__buckets_8h"><td class="mdescLeft"> </td><td class="mdescRight"><a href="https://prometheus.io/docs/concepts/metric_types/#histogram">https://prometheus.io/docs/concepts/metric_types/#histogram</a> <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__metric_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric_8h.html">prom_metric.h</a> <a href="prom__metric_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__metric_8h"><td class="mdescLeft"> </td><td class="mdescRight">Functions for retrieving metric samples from metrics given an ordered set of labels. <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__metric__sample_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric__sample_8h.html">prom_metric_sample.h</a> <a href="prom__metric__sample_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__metric__sample_8h"><td class="mdescLeft"> </td><td class="mdescRight">Functions for interfacting with metric samples directly. <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:prom__metric__sample__histogram_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric__sample__histogram_8h.html">prom_metric_sample_histogram.h</a> <a href="prom__metric__sample__histogram_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:prom__metric__sample__histogram_8h"><td class="mdescLeft"> </td><td class="mdescRight">Functions for interacting with histogram metric samples directly. <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +</table> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f.html b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f.html new file mode 100644 index 0000000..e731d58 --- /dev/null +++ b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f.html @@ -0,0 +1,97 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: promhttp/include Directory Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_21619567660c3332e6a61228c76007f9.html">promhttp</a></li><li class="navelem"><a class="el" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">include Directory Reference</div> </div> +</div><!--header--> +<div class="contents"> +<div class="dynheader"> +Directory dependency graph for include:</div> +<div class="dyncontent"> +<div class="center"><img src="dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.png" border="0" usemap="#dir__8d140c3a8bac3cd45205c9ea74fd211f__dep" alt="promhttp/include"/></div> +<map name="dir__8d140c3a8bac3cd45205c9ea74fd211f__dep" id="dir__8d140c3a8bac3cd45205c9ea74fd211f__dep"> +<area shape="rect" id="node1" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html" title="include" alt="" coords="27,52,99,100"/> +<area shape="rect" id="node2" href="dir_2c63f04010e7ff462eba5e344f58cd21.html" title="prom" alt="" coords="27,148,99,196"/> +<area shape="rect" id="edge1-headlabel" href="dir_000003_000000.html" title="1" alt="" coords="66,122,76,137"/> +<area shape="rect" id="clust1" href="dir_21619567660c3332e6a61228c76007f9.html" title="promhttp" alt="" coords="16,16,109,111"/> +</map> +</div> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a> +Files</h2></td></tr> +<tr class="memitem:promhttp_8h"><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="promhttp_8h.html">promhttp.h</a> <a href="promhttp_8h_source.html">[code]</a></td></tr> +<tr class="memdesc:promhttp_8h"><td class="mdescLeft"> </td><td class="mdescRight">Provides a HTTP endpoint for metric exposition References: <br /></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +</table> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.dot b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.dot new file mode 100644 index 0000000..b65c06e --- /dev/null +++ b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.dot @@ -0,0 +1,11 @@ +digraph "promhttp/include" { + compound=true + node [ fontsize="10", fontname="Helvetica"]; + edge [ labelfontsize="10", labelfontname="Helvetica"]; + subgraph clusterdir_21619567660c3332e6a61228c76007f9 { + graph [ bgcolor="#ddddee", pencolor="black", label="promhttp" fontname="Helvetica", fontsize="10", URL="dir_21619567660c3332e6a61228c76007f9.html"] + dir_8d140c3a8bac3cd45205c9ea74fd211f [shape=box, label="include", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_8d140c3a8bac3cd45205c9ea74fd211f.html"]; + } + dir_2c63f04010e7ff462eba5e344f58cd21 [shape=box label="prom" fillcolor="white" style="filled" color="red" URL="dir_2c63f04010e7ff462eba5e344f58cd21.html"]; + dir_8d140c3a8bac3cd45205c9ea74fd211f->dir_2c63f04010e7ff462eba5e344f58cd21 [headlabel="1", labeldistance=1.5 headhref="dir_000003_000000.html"]; +} diff --git a/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.map b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.map new file mode 100644 index 0000000..5081380 --- /dev/null +++ b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.map @@ -0,0 +1,6 @@ +<map id="promhttp/include" name="promhttp/include"> +<area shape="rect" id="node1" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html" title="include" alt="" coords="27,52,99,100"/> +<area shape="rect" id="node2" href="dir_2c63f04010e7ff462eba5e344f58cd21.html" title="prom" alt="" coords="27,148,99,196"/> +<area shape="rect" id="edge1-headlabel" href="dir_000003_000000.html" title="1" alt="" coords="66,122,76,137"/> +<area shape="rect" id="clust1" href="dir_21619567660c3332e6a61228c76007f9.html" title="promhttp" alt="" coords="16,16,109,111"/> +</map> diff --git a/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.md5 b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.md5 new file mode 100644 index 0000000..76b9734 --- /dev/null +++ b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.md5 @@ -0,0 +1 @@ +409e6884fb8a90bc89f51c346dd9a368
\ No newline at end of file diff --git a/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.png b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.png Binary files differnew file mode 100644 index 0000000..db4e49e --- /dev/null +++ b/docs/dir_8d140c3a8bac3cd45205c9ea74fd211f_dep.png diff --git a/docs/doc.png b/docs/doc.png Binary files differnew file mode 100644 index 0000000..17edabf --- /dev/null +++ b/docs/doc.png diff --git a/docs/doxygen.css b/docs/doxygen.css new file mode 100644 index 0000000..4f1ab91 --- /dev/null +++ b/docs/doxygen.css @@ -0,0 +1,1596 @@ +/* The standard CSS for doxygen 1.8.13 */ + +body, table, div, p, dl { + font: 400 14px/22px Roboto,sans-serif; +} + +p.reference, p.definition { + font: 400 14px/22px Roboto,sans-serif; +} + +/* @group Heading Levels */ + +h1.groupheader { + font-size: 150%; +} + +.title { + font: 400 14px/28px Roboto,sans-serif; + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h2.groupheader { + border-bottom: 1px solid #879ECB; + color: #354C7B; + font-size: 150%; + font-weight: normal; + margin-top: 1.75em; + padding-top: 8px; + padding-bottom: 4px; + width: 100%; +} + +h3.groupheader { + font-size: 100%; +} + +h1, h2, h3, h4, h5, h6 { + -webkit-transition: text-shadow 0.5s linear; + -moz-transition: text-shadow 0.5s linear; + -ms-transition: text-shadow 0.5s linear; + -o-transition: text-shadow 0.5s linear; + transition: text-shadow 0.5s linear; + margin-right: 15px; +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px cyan; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd { + margin-top: 2px; +} + +p.starttd { + margin-top: 0px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code, a.code:visited, a.line, a.line:visited { + color: #4665A2; +} + +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%; +} + +div.fragment { + padding: 0px; + margin: 4px 8px 4px 2px; + background-color: #FBFCFD; + border: 1px solid #C4CFE5; +} + +div.line { + font-family: monospace, fixed; + font-size: 13px; + min-height: 13px; + line-height: 1.0; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line:after { + content:"\000A"; + white-space: pre; +} + +div.line.glow { + background-color: cyan; + box-shadow: 0 0 10px cyan; +} + + +span.lineno { + padding-right: 4px; + text-align: right; + border-right: 2px solid #0F0; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a { + background-color: #D8D8D8; +} + +span.lineno a:hover { + background-color: #C8C8C8; +} + +.lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.ah, span.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); +} + +div.classindex ul { + list-style: none; + padding-left: 0; +} + +div.classindex span.ai { + display: inline-block; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background-color: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 12px; + margin-right: 8px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; + white-space: nowrap; + vertical-align: top; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +blockquote { + background-color: #F7F8FB; + border-left: 2px solid #9CAFD4; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.memberdecls td, .fieldtable tr { + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: cyan; + box-shadow: 0 0 15px cyan; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memSeparator { + border-bottom: 1px solid #DEE4F0; + line-height: 1px; + margin: 0px; + padding: 0px; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; + font-size: 80%; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtitle { + padding: 8px; + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + margin-bottom: -1px; + background-image: url('nav_f.png'); + background-repeat: repeat-x; + background-color: #E2E8F2; + line-height: 1.25; + font-weight: 300; + float:left; +} + +.permalink +{ + font-size: 65%; + display: inline-block; + vertical-align: middle; +} + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; + -webkit-transition: box-shadow 0.5s linear; + -moz-transition: box-shadow 0.5s linear; + -ms-transition: box-shadow 0.5s linear; + -o-transition: box-shadow 0.5s linear; + transition: box-shadow 0.5s linear; + display: table !important; + width: 100%; +} + +.memitem.glow { + box-shadow: 0 0 15px cyan; +} + +.memname { + font-weight: 400; + margin-left: 6px; +} + +.memname td { + vertical-align: bottom; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + background-color: #DFE5F1; + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 4px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 4px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 4px; + +} + +.overload { + font-family: "courier new",courier,monospace; + font-size: 65%; +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 10px 2px 10px; + background-color: #FBFCFD; + border-top-width: 0; + background-image:url('nav_g.png'); + background-repeat:repeat-x; + background-color: #FFFFFF; + /* opera specific markup */ + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} +.paramname code { + line-height: 14px; +} + +.params, .retval, .exception, .tparams { + margin-left: 0px; + padding-left: 0px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: #728DC1; + border-top:1px solid #5373B4; + border-left:1px solid #5373B4; + border-right:1px solid #C4CFE5; + border-bottom:1px solid #C4CFE5; + text-shadow: none; + color: white; + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} + + + +/* @end */ + +/* these are for tree view inside a (index) page */ + +div.directory { + margin: 10px 0px; + border-top: 1px solid #9CAFD4; + border-bottom: 1px solid #9CAFD4; + width: 100%; +} + +.directory table { + border-collapse:collapse; +} + +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; +} + +.directory td.entry { + white-space: nowrap; + padding-right: 6px; + padding-top: 3px; +} + +.directory td.entry a { + outline:none; +} + +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + border-left: 1px solid rgba(0,0,0,0.05); +} + +.directory tr.even { + padding-left: 6px; + background-color: #F7F8FB; +} + +.directory img { + vertical-align: -30%; +} + +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; +} + +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: #3D578C; +} + +.arrow { + color: #9CAFD4; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #728DC1; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable caption { + caption-side: top; +} + +table.doxtable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +table.fieldtable { + /*width: 100%;*/ + margin-bottom: 10px; + border: 1px solid #A8B8D9; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8B8D9; + border-bottom: 1px solid #A8B8D9; + vertical-align: top; +} + +.fieldtable td.fieldname { + padding-top: 3px; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8B8D9; + /*width: 100%;*/ +} + +.fieldtable td.fielddoc p:first-child { + margin-top: 0px; +} + +.fieldtable td.fielddoc p:last-child { + margin-bottom: 2px; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + font-size: 90%; + color: #253555; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + font-weight: 400; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8B8D9; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + background-position: 0 -5px; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; + color: #283A5D; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + +div.ingroups +{ + font-size: 8pt; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +dl +{ + padding: 0 0 0 10px; +} + +/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ +dl.section +{ + margin-left: 0px; + padding-left: 0px; +} + +dl.note +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #D0C000; +} + +dl.warning, dl.attention +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #00D000; +} + +dl.deprecated +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #505050; +} + +dl.todo +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #00C0E0; +} + +dl.test +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #3030E0; +} + +dl.bug +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #C08050; +} + +dl.section dd { + margin-bottom: 6px; +} + + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectalign +{ + vertical-align: middle; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.plantumlgraph +{ + text-align: center; +} + +.diagraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #90A5CE; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#334975; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd { + margin:2px 0; + padding:5px 0; +} + +div.toc { + padding: 14px 25px; + background-color: #F4F6FA; + border: 1px solid #D8DFEE; + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 8px 10px 10px; + width: 200px; +} + +div.toc li { + background: url("bdwn.png") no-repeat scroll 0 5px transparent; + font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +div.toc h3 { + font: bold 12px/1.2 Arial,FreeSans,sans-serif; + color: #4665A2; + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.level2 { + margin-left: 15px; +} + +div.toc li.level3 { + margin-left: 30px; +} + +div.toc li.level4 { + margin-left: 45px; +} + +.inherit_header { + font-weight: bold; + color: gray; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0px 2px 5px; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 4px; +} + +/* tooltip related style info */ + +.ttc { + position: absolute; + display: none; +} + +#powerTip { + cursor: default; + white-space: nowrap; + background-color: white; + border: 1px solid gray; + border-radius: 4px 4px 4px 4px; + box-shadow: 1px 1px 7px gray; + display: none; + font-size: smaller; + max-width: 80%; + opacity: 0.9; + padding: 1ex 1em 1em; + position: absolute; + z-index: 2147483647; +} + +#powerTip div.ttdoc { + color: grey; + font-style: italic; +} + +#powerTip div.ttname a { + font-weight: bold; +} + +#powerTip div.ttname { + font-weight: bold; +} + +#powerTip div.ttdeci { + color: #006318; +} + +#powerTip div { + margin: 0px; + padding: 0px; + font: 12px/16px Roboto,sans-serif; +} + +#powerTip:before, #powerTip:after { + content: ""; + position: absolute; + margin: 0px; +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.s:after, #powerTip.s:before, +#powerTip.w:after, #powerTip.w:before, +#powerTip.e:after, #powerTip.e:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.nw:after, #powerTip.nw:before, +#powerTip.sw:after, #powerTip.sw:before { + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; +} + +#powerTip.n:after, #powerTip.s:after, +#powerTip.w:after, #powerTip.e:after, +#powerTip.nw:after, #powerTip.ne:after, +#powerTip.sw:after, #powerTip.se:after { + border-color: rgba(255, 255, 255, 0); +} + +#powerTip.n:before, #powerTip.s:before, +#powerTip.w:before, #powerTip.e:before, +#powerTip.nw:before, #powerTip.ne:before, +#powerTip.sw:before, #powerTip.se:before { + border-color: rgba(128, 128, 128, 0); +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.nw:after, #powerTip.nw:before { + top: 100%; +} + +#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { + border-top-color: #ffffff; + border-width: 10px; + margin: 0px -10px; +} +#powerTip.n:before { + border-top-color: #808080; + border-width: 11px; + margin: 0px -11px; +} +#powerTip.n:after, #powerTip.n:before { + left: 50%; +} + +#powerTip.nw:after, #powerTip.nw:before { + right: 14px; +} + +#powerTip.ne:after, #powerTip.ne:before { + left: 14px; +} + +#powerTip.s:after, #powerTip.s:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.sw:after, #powerTip.sw:before { + bottom: 100%; +} + +#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { + border-bottom-color: #ffffff; + border-width: 10px; + margin: 0px -10px; +} + +#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { + border-bottom-color: #808080; + border-width: 11px; + margin: 0px -11px; +} + +#powerTip.s:after, #powerTip.s:before { + left: 50%; +} + +#powerTip.sw:after, #powerTip.sw:before { + right: 14px; +} + +#powerTip.se:after, #powerTip.se:before { + left: 14px; +} + +#powerTip.e:after, #powerTip.e:before { + left: 100%; +} +#powerTip.e:after { + border-left-color: #ffffff; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.e:before { + border-left-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +#powerTip.w:after, #powerTip.w:before { + right: 100%; +} +#powerTip.w:after { + border-right-color: #ffffff; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.w:before { + border-right-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } +} + +/* @group Markdown */ + +/* +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.markdownTableHead tr { +} + +table.markdownTableBodyLeft td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft { + text-align: left +} + +th.markdownTableHeadRight { + text-align: right +} + +th.markdownTableHeadCenter { + text-align: center +} +*/ + +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.markdownTable tr { +} + +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft, td.markdownTableBodyLeft { + text-align: left +} + +th.markdownTableHeadRight, td.markdownTableBodyRight { + text-align: right +} + +th.markdownTableHeadCenter, td.markdownTableBodyCenter { + text-align: center +} + + +/* @end */ diff --git a/docs/doxygen.png b/docs/doxygen.png Binary files differnew file mode 100644 index 0000000..3ff17d8 --- /dev/null +++ b/docs/doxygen.png diff --git a/docs/dynsections.js b/docs/dynsections.js new file mode 100644 index 0000000..85e1836 --- /dev/null +++ b/docs/dynsections.js @@ -0,0 +1,97 @@ +function toggleVisibility(linkObj) +{ + var base = $(linkObj).attr('id'); + var summary = $('#'+base+'-summary'); + var content = $('#'+base+'-content'); + var trigger = $('#'+base+'-trigger'); + var src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.hide(); + summary.show(); + $(linkObj).addClass('closed').removeClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + content.show(); + summary.hide(); + $(linkObj).removeClass('closed').addClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); + } + return false; +} + +function updateStripes() +{ + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); +} + +function toggleLevel(level) +{ + $('table.directory tr').each(function() { + var l = this.id.split('_').length-1; + var i = $('#img'+this.id.substring(3)); + var a = $('#arr'+this.id.substring(3)); + if (l<level+1) { + i.removeClass('iconfopen iconfclosed').addClass('iconfopen'); + a.html('▼'); + $(this).show(); + } else if (l==level+1) { + i.removeClass('iconfclosed iconfopen').addClass('iconfclosed'); + a.html('►'); + $(this).show(); + } else { + $(this).hide(); + } + }); + updateStripes(); +} + +function toggleFolder(id) +{ + // the clicked row + var currentRow = $('#row_'+id); + + // all rows after the clicked row + var rows = currentRow.nextAll("tr"); + + var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub + + // only match elements AFTER this one (can't hide elements before) + var childRows = rows.filter(function() { return this.id.match(re); }); + + // first row is visible we are HIDING + if (childRows.filter(':first').is(':visible')===true) { + // replace down arrow by right arrow for current row + var currentRowSpans = currentRow.find("span"); + currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed"); + currentRowSpans.filter(".arrow").html('►'); + rows.filter("[id^=row_"+id+"]").hide(); // hide all children + } else { // we are SHOWING + // replace right arrow by down arrow for current row + var currentRowSpans = currentRow.find("span"); + currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen"); + currentRowSpans.filter(".arrow").html('▼'); + // replace down arrows by right arrows for child rows + var childRowsSpans = childRows.find("span"); + childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed"); + childRowsSpans.filter(".arrow").html('►'); + childRows.show(); //show all children + } + updateStripes(); +} + + +function toggleInherit(id) +{ + var rows = $('tr.inherit.'+id); + var img = $('tr.inherit_header.'+id+' img'); + var src = $(img).attr('src'); + if (rows.filter(':first').is(':visible')===true) { + rows.css('display','none'); + $(img).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + rows.css('display','table-row'); // using show() causes jump in firefox + $(img).attr('src',src.substring(0,src.length-10)+'open.png'); + } +} + diff --git a/docs/files.html b/docs/files.html new file mode 100644 index 0000000..c07079c --- /dev/null +++ b/docs/files.html @@ -0,0 +1,97 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: File List</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="headertitle"> +<div class="title">File List</div> </div> +</div><!--header--> +<div class="contents"> +<div class="textblock">Here is a list of all documented files with brief descriptions:</div><div class="directory"> +<div class="levels">[detail level <span onclick="javascript:toggleLevel(1);">1</span><span onclick="javascript:toggleLevel(2);">2</span><span onclick="javascript:toggleLevel(3);">3</span>]</div><table class="directory"> +<tr id="row_0_" class="even"><td class="entry"><span style="width:0px;display:inline-block;"> </span><span id="arr_0_" class="arrow" onclick="toggleFolder('0_')">▼</span><span id="img_0_" class="iconfopen" onclick="toggleFolder('0_')"> </span><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html" target="_self">prom</a></td><td class="desc"></td></tr> +<tr id="row_0_0_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span id="arr_0_0_" class="arrow" onclick="toggleFolder('0_0_')">▼</span><span id="img_0_0_" class="iconfopen" onclick="toggleFolder('0_0_')"> </span><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html" target="_self">include</a></td><td class="desc"></td></tr> +<tr id="row_0_0_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom_8h.html" target="_self">prom.h</a></td><td class="desc">Include <a class="el" href="prom_8h.html" title="Include prom.h to include the entire public API. ">prom.h</a> to include the entire public API </td></tr> +<tr id="row_0_0_1_"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__alloc_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__alloc_8h.html" target="_self">prom_alloc.h</a></td><td class="desc">Memory management </td></tr> +<tr id="row_0_0_2_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__collector_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__collector_8h.html" target="_self">prom_collector.h</a></td><td class="desc">A Prometheus collector returns a collection of metrics </td></tr> +<tr id="row_0_0_3_"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__collector__registry_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__collector__registry_8h.html" target="_self">prom_collector_registry.h</a></td><td class="desc">The collector registry registers collectors for metric exposition </td></tr> +<tr id="row_0_0_4_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__counter_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__counter_8h.html" target="_self">prom_counter.h</a></td><td class="desc">Https://prometheus.io/docs/concepts/metric_types/#counter </td></tr> +<tr id="row_0_0_5_"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__gauge_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__gauge_8h.html" target="_self">prom_gauge.h</a></td><td class="desc">Https://prometheus.io/docs/concepts/metric_types/#gauge </td></tr> +<tr id="row_0_0_6_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__histogram_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__histogram_8h.html" target="_self">prom_histogram.h</a></td><td class="desc">Https://prometheus.io/docs/concepts/metric_types/#histogram </td></tr> +<tr id="row_0_0_7_"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__histogram__buckets_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__histogram__buckets_8h.html" target="_self">prom_histogram_buckets.h</a></td><td class="desc">Https://prometheus.io/docs/concepts/metric_types/#histogram </td></tr> +<tr id="row_0_0_8_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__linked__list_8h_source.html"><span class="icondoc"></span></a><b>prom_linked_list.h</b></td><td class="desc"></td></tr> +<tr id="row_0_0_9_"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__map_8h_source.html"><span class="icondoc"></span></a><b>prom_map.h</b></td><td class="desc"></td></tr> +<tr id="row_0_0_10_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__metric_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__metric_8h.html" target="_self">prom_metric.h</a></td><td class="desc">Functions for retrieving metric samples from metrics given an ordered set of labels </td></tr> +<tr id="row_0_0_11_"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__metric__sample_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__metric__sample_8h.html" target="_self">prom_metric_sample.h</a></td><td class="desc">Functions for interfacting with metric samples directly </td></tr> +<tr id="row_0_0_12_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="prom__metric__sample__histogram_8h_source.html"><span class="icondoc"></span></a><a class="el" href="prom__metric__sample__histogram_8h.html" target="_self">prom_metric_sample_histogram.h</a></td><td class="desc">Functions for interacting with histogram metric samples directly </td></tr> +<tr id="row_1_"><td class="entry"><span style="width:0px;display:inline-block;"> </span><span id="arr_1_" class="arrow" onclick="toggleFolder('1_')">▼</span><span id="img_1_" class="iconfopen" onclick="toggleFolder('1_')"> </span><a class="el" href="dir_21619567660c3332e6a61228c76007f9.html" target="_self">promhttp</a></td><td class="desc"></td></tr> +<tr id="row_1_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span id="arr_1_0_" class="arrow" onclick="toggleFolder('1_0_')">▼</span><span id="img_1_0_" class="iconfopen" onclick="toggleFolder('1_0_')"> </span><a class="el" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html" target="_self">include</a></td><td class="desc"></td></tr> +<tr id="row_1_0_0_"><td class="entry"><span style="width:48px;display:inline-block;"> </span><a href="promhttp_8h_source.html"><span class="icondoc"></span></a><a class="el" href="promhttp_8h.html" target="_self">promhttp.h</a></td><td class="desc">Provides a HTTP endpoint for metric exposition References: </td></tr> +</table> +</div><!-- directory --> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/folderclosed.png b/docs/folderclosed.png Binary files differnew file mode 100644 index 0000000..bb8ab35 --- /dev/null +++ b/docs/folderclosed.png diff --git a/docs/folderopen.png b/docs/folderopen.png Binary files differnew file mode 100644 index 0000000..d6c7f67 --- /dev/null +++ b/docs/folderopen.png diff --git a/docs/functions.html b/docs/functions.html new file mode 100644 index 0000000..8330c50 --- /dev/null +++ b/docs/functions.html @@ -0,0 +1,79 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Class Members</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> +<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div><ul> +<li>count +: <a class="el" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">prom_histogram_buckets</a> +</li> +<li>upper_bounds +: <a class="el" href="structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344">prom_histogram_buckets</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/functions_vars.html b/docs/functions_vars.html new file mode 100644 index 0000000..cbaa143 --- /dev/null +++ b/docs/functions_vars.html @@ -0,0 +1,79 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Class Members - Variables</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> + <ul> +<li>count +: <a class="el" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">prom_histogram_buckets</a> +</li> +<li>upper_bounds +: <a class="el" href="structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344">prom_histogram_buckets</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/globals.html b/docs/globals.html new file mode 100644 index 0000000..26a718f --- /dev/null +++ b/docs/globals.html @@ -0,0 +1,249 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: File Members</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> +<div class="textblock">Here is a list of all documented file members with links to the documentation:</div> + +<h3><a id="index_p"></a>- p -</h3><ul> +<li>prom_collect_fn +: <a class="el" href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40">prom_collector.h</a> +</li> +<li>prom_collector_add_metric() +: <a class="el" href="prom__collector_8h.html#abd87021bd63f759d55642685a74874ee">prom_collector.h</a> +</li> +<li>prom_collector_destroy() +: <a class="el" href="prom__collector_8h.html#a037b72b2edb81a477999a7dfc08758c7">prom_collector.h</a> +</li> +<li>prom_collector_destroy_generic() +: <a class="el" href="prom__collector_8h.html#a12c297cce0a30ee4149f2b486d9f0337">prom_collector.h</a> +</li> +<li>prom_collector_free_generic() +: <a class="el" href="prom__collector_8h.html#a875b72940cd578ee76c71f1f4853f139">prom_collector.h</a> +</li> +<li>prom_collector_new() +: <a class="el" href="prom__collector_8h.html#a4300cf33b6f8e4457df385c3d2a51a4b">prom_collector.h</a> +</li> +<li>prom_collector_process_new() +: <a class="el" href="prom__collector_8h.html#af50746bb4af87eda617fa08237e3834e">prom_collector.h</a> +</li> +<li>prom_collector_registry_bridge() +: <a class="el" href="prom__collector__registry_8h.html#a0149a2702ae0b3ff39d57904d613c14f">prom_collector_registry.h</a> +</li> +<li>PROM_COLLECTOR_REGISTRY_DEFAULT +: <a class="el" href="prom__collector__registry_8h.html#a6092b48e150390c1927da5fe8914981b">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_default_init() +: <a class="el" href="prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_destroy() +: <a class="el" href="prom__collector__registry_8h.html#ad3854e6e40b6f741fde53dc65f0ecd87">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_enable_process_metrics() +: <a class="el" href="prom__collector__registry_8h.html#a0d59bf988de4ee29e076910fa7135071">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_must_register_metric() +: <a class="el" href="prom__collector__registry_8h.html#a113683f4e15ad9240a37ed2139ddaea6">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_new() +: <a class="el" href="prom__collector__registry_8h.html#ab5d622258998978c528253f07e2903b8">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_register_collector() +: <a class="el" href="prom__collector__registry_8h.html#a42203da085c6c6f2bc3ba31501683882">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_register_metric() +: <a class="el" href="prom__collector__registry_8h.html#aa735fa0fbe03d6d9a0d11eb4792ec761">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_t +: <a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_validate_metric_name() +: <a class="el" href="prom__collector__registry_8h.html#acf002221c3239584723f9fb15c53e15e">prom_collector_registry.h</a> +</li> +<li>prom_collector_set_collect_fn() +: <a class="el" href="prom__collector_8h.html#a9929cb81f4fb49ffca8aa880a4699650">prom_collector.h</a> +</li> +<li>prom_collector_t +: <a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector.h</a> +</li> +<li>prom_counter_add() +: <a class="el" href="prom__counter_8h.html#addd8a7efc39e17d30b2267e5a0a626db">prom_counter.h</a> +</li> +<li>prom_counter_destroy() +: <a class="el" href="prom__counter_8h.html#ac36abc71c11df1e774c8c102b1fdb78d">prom_counter.h</a> +</li> +<li>prom_counter_inc() +: <a class="el" href="prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35">prom_counter.h</a> +</li> +<li>prom_counter_new() +: <a class="el" href="prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651">prom_counter.h</a> +</li> +<li>prom_counter_t +: <a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter.h</a> +</li> +<li>prom_free +: <a class="el" href="prom__alloc_8h.html#a19b2231f9b45a520bbbcf046ed5d81ef">prom_alloc.h</a> +</li> +<li>prom_gauge_add() +: <a class="el" href="prom__gauge_8h.html#a96bc5b32abee5f99fbd4ae11bebd44c8">prom_gauge.h</a> +</li> +<li>prom_gauge_dec() +: <a class="el" href="prom__gauge_8h.html#aa351ef4f2d917d7dae914df6d81c547b">prom_gauge.h</a> +</li> +<li>prom_gauge_destroy() +: <a class="el" href="prom__gauge_8h.html#a2fc5dc11239cefdf59ae978be4bfd789">prom_gauge.h</a> +</li> +<li>prom_gauge_inc() +: <a class="el" href="prom__gauge_8h.html#ad953b12ea1f8a3c3b7a39e6c260d07a2">prom_gauge.h</a> +</li> +<li>prom_gauge_new() +: <a class="el" href="prom__gauge_8h.html#a5ecd07c83cf0981944a9256914571d70">prom_gauge.h</a> +</li> +<li>prom_gauge_set() +: <a class="el" href="prom__gauge_8h.html#a04210b18bfb89aa6f3ddc72d7851a528">prom_gauge.h</a> +</li> +<li>prom_gauge_sub() +: <a class="el" href="prom__gauge_8h.html#a7ae193d586176bff82a39cd65e2bc999">prom_gauge.h</a> +</li> +<li>prom_gauge_t +: <a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge.h</a> +</li> +<li>prom_histogram_buckets_count() +: <a class="el" href="prom__histogram__buckets_8h.html#a92158192cfe9a71a98dbb1d9adc8508a">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_buckets_destroy() +: <a class="el" href="prom__histogram__buckets_8h.html#a36bc3312f8f479bbd6eb92fa3b1a5033">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_buckets_exponential() +: <a class="el" href="prom__histogram__buckets_8h.html#a164da4101785b6fa2a292a964c232f12">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_buckets_linear() +: <a class="el" href="prom__histogram__buckets_8h.html#aa1adc550bf8999a27f6a26769d6bfc72">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_buckets_new() +: <a class="el" href="prom__histogram__buckets_8h.html#a03736e2fac21748bbfd80100bf9546c4">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_default_buckets +: <a class="el" href="prom__histogram__buckets_8h.html#aa8d61c1abc355eb54173b27cb1b50a5d">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_destroy() +: <a class="el" href="prom__histogram_8h.html#af9067b27e7ab2abd815af0614bb35357">prom_histogram.h</a> +</li> +<li>prom_histogram_new() +: <a class="el" href="prom__histogram_8h.html#ad42681e59e727f9e3d43bf0cdbba9a1b">prom_histogram.h</a> +</li> +<li>prom_histogram_observe() +: <a class="el" href="prom__histogram_8h.html#a274e4b869c7d9239e9f47b3898210fbe">prom_histogram.h</a> +</li> +<li>prom_histogram_t +: <a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram.h</a> +</li> +<li>prom_malloc +: <a class="el" href="prom__alloc_8h.html#ae1613c091e07daa2bfa4303ef5628827">prom_alloc.h</a> +</li> +<li>prom_metric_sample_add() +: <a class="el" href="prom__metric__sample_8h.html#a3f8674d6c8ee2c27eb7504d602110daa">prom_metric_sample.h</a> +</li> +<li>prom_metric_sample_from_labels() +: <a class="el" href="prom__metric_8h.html#a2c33d7e03b430a2903bf122fbeeb89de">prom_metric.h</a> +</li> +<li>prom_metric_sample_histogram_from_labels() +: <a class="el" href="prom__metric_8h.html#a3b76680b4a7177eebc864f3b3be1e935">prom_metric.h</a> +</li> +<li>prom_metric_sample_histogram_observe() +: <a class="el" href="prom__metric__sample__histogram_8h.html#a20a030bf6be56211c87c9feb520a3761">prom_metric_sample_histogram.h</a> +</li> +<li>prom_metric_sample_histogram_t +: <a class="el" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram.h</a> +</li> +<li>prom_metric_sample_set() +: <a class="el" href="prom__metric__sample_8h.html#a0c5f0c66599282c2ee2c042ae4574db3">prom_metric_sample.h</a> +</li> +<li>prom_metric_sample_sub() +: <a class="el" href="prom__metric__sample_8h.html#a1965caa1626c308bc1cb23995e90a0a7">prom_metric_sample.h</a> +</li> +<li>prom_metric_sample_t +: <a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample.h</a> +</li> +<li>prom_metric_t +: <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric.h</a> +</li> +<li>prom_realloc +: <a class="el" href="prom__alloc_8h.html#aab8dc4629c851a8c59cc721bd2f7c6f3">prom_alloc.h</a> +</li> +<li>prom_strdup +: <a class="el" href="prom__alloc_8h.html#a21faa2fafc84c8ca25467fe9cb0a55f3">prom_alloc.h</a> +</li> +<li>promhttp_set_active_collector_registry() +: <a class="el" href="promhttp_8h.html#a712a45634bc22724fef9bedcb2841e00">promhttp.h</a> +</li> +<li>promhttp_start_daemon() +: <a class="el" href="promhttp_8h.html#a699ecc3aa11ed601269722f43da2823e">promhttp.h</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/globals_defs.html b/docs/globals_defs.html new file mode 100644 index 0000000..cd227de --- /dev/null +++ b/docs/globals_defs.html @@ -0,0 +1,85 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: File Members</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> + <ul> +<li>prom_free +: <a class="el" href="prom__alloc_8h.html#a19b2231f9b45a520bbbcf046ed5d81ef">prom_alloc.h</a> +</li> +<li>prom_malloc +: <a class="el" href="prom__alloc_8h.html#ae1613c091e07daa2bfa4303ef5628827">prom_alloc.h</a> +</li> +<li>prom_realloc +: <a class="el" href="prom__alloc_8h.html#aab8dc4629c851a8c59cc721bd2f7c6f3">prom_alloc.h</a> +</li> +<li>prom_strdup +: <a class="el" href="prom__alloc_8h.html#a21faa2fafc84c8ca25467fe9cb0a55f3">prom_alloc.h</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/globals_enum.html b/docs/globals_enum.html new file mode 100644 index 0000000..75948fb --- /dev/null +++ b/docs/globals_enum.html @@ -0,0 +1,76 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: File Members</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.0</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> + <ul> +<li>prom_return_code +: <a class="el" href="prom__errors_8h.html#ae9dcc70f3217ae6f5cd331dbdef06602">prom_errors.h</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/globals_eval.html b/docs/globals_eval.html new file mode 100644 index 0000000..7308d55 --- /dev/null +++ b/docs/globals_eval.html @@ -0,0 +1,88 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: File Members</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.0</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> + <ul> +<li>PROM_COLLECTOR_REGISTRATION_FAILURE +: <a class="el" href="prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830a23269fa188cfe85113887765ae300781">prom_errors.h</a> +</li> +<li>PROM_FAILURE +: <a class="el" href="prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830a20d1dda215f590d375c018ecabb065cc">prom_errors.h</a> +</li> +<li>PROM_INVALID_METRIC_TYPE +: <a class="el" href="prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830a11a15b66987a9d455f369a94101205fc">prom_errors.h</a> +</li> +<li>PROM_METRIC_REGISTRATION_FAILURE +: <a class="el" href="prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830ae3ad35c6d86de06362db4735e0805416">prom_errors.h</a> +</li> +<li>PROM_SUCCESS +: <a class="el" href="prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830a4860821c9dc1ba212354b29a48b8c59c">prom_errors.h</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/globals_func.html b/docs/globals_func.html new file mode 100644 index 0000000..6fc4f7c --- /dev/null +++ b/docs/globals_func.html @@ -0,0 +1,204 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: File Members</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> +  + +<h3><a id="index_p"></a>- p -</h3><ul> +<li>prom_collector_add_metric() +: <a class="el" href="prom__collector_8h.html#abd87021bd63f759d55642685a74874ee">prom_collector.h</a> +</li> +<li>prom_collector_destroy() +: <a class="el" href="prom__collector_8h.html#a037b72b2edb81a477999a7dfc08758c7">prom_collector.h</a> +</li> +<li>prom_collector_destroy_generic() +: <a class="el" href="prom__collector_8h.html#a12c297cce0a30ee4149f2b486d9f0337">prom_collector.h</a> +</li> +<li>prom_collector_free_generic() +: <a class="el" href="prom__collector_8h.html#a875b72940cd578ee76c71f1f4853f139">prom_collector.h</a> +</li> +<li>prom_collector_new() +: <a class="el" href="prom__collector_8h.html#a4300cf33b6f8e4457df385c3d2a51a4b">prom_collector.h</a> +</li> +<li>prom_collector_process_new() +: <a class="el" href="prom__collector_8h.html#af50746bb4af87eda617fa08237e3834e">prom_collector.h</a> +</li> +<li>prom_collector_registry_bridge() +: <a class="el" href="prom__collector__registry_8h.html#a0149a2702ae0b3ff39d57904d613c14f">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_default_init() +: <a class="el" href="prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_destroy() +: <a class="el" href="prom__collector__registry_8h.html#ad3854e6e40b6f741fde53dc65f0ecd87">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_enable_process_metrics() +: <a class="el" href="prom__collector__registry_8h.html#a0d59bf988de4ee29e076910fa7135071">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_must_register_metric() +: <a class="el" href="prom__collector__registry_8h.html#a113683f4e15ad9240a37ed2139ddaea6">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_new() +: <a class="el" href="prom__collector__registry_8h.html#ab5d622258998978c528253f07e2903b8">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_register_collector() +: <a class="el" href="prom__collector__registry_8h.html#a42203da085c6c6f2bc3ba31501683882">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_register_metric() +: <a class="el" href="prom__collector__registry_8h.html#aa735fa0fbe03d6d9a0d11eb4792ec761">prom_collector_registry.h</a> +</li> +<li>prom_collector_registry_validate_metric_name() +: <a class="el" href="prom__collector__registry_8h.html#acf002221c3239584723f9fb15c53e15e">prom_collector_registry.h</a> +</li> +<li>prom_collector_set_collect_fn() +: <a class="el" href="prom__collector_8h.html#a9929cb81f4fb49ffca8aa880a4699650">prom_collector.h</a> +</li> +<li>prom_counter_add() +: <a class="el" href="prom__counter_8h.html#addd8a7efc39e17d30b2267e5a0a626db">prom_counter.h</a> +</li> +<li>prom_counter_destroy() +: <a class="el" href="prom__counter_8h.html#ac36abc71c11df1e774c8c102b1fdb78d">prom_counter.h</a> +</li> +<li>prom_counter_inc() +: <a class="el" href="prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35">prom_counter.h</a> +</li> +<li>prom_counter_new() +: <a class="el" href="prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651">prom_counter.h</a> +</li> +<li>prom_gauge_add() +: <a class="el" href="prom__gauge_8h.html#a96bc5b32abee5f99fbd4ae11bebd44c8">prom_gauge.h</a> +</li> +<li>prom_gauge_dec() +: <a class="el" href="prom__gauge_8h.html#aa351ef4f2d917d7dae914df6d81c547b">prom_gauge.h</a> +</li> +<li>prom_gauge_destroy() +: <a class="el" href="prom__gauge_8h.html#a2fc5dc11239cefdf59ae978be4bfd789">prom_gauge.h</a> +</li> +<li>prom_gauge_inc() +: <a class="el" href="prom__gauge_8h.html#ad953b12ea1f8a3c3b7a39e6c260d07a2">prom_gauge.h</a> +</li> +<li>prom_gauge_new() +: <a class="el" href="prom__gauge_8h.html#a5ecd07c83cf0981944a9256914571d70">prom_gauge.h</a> +</li> +<li>prom_gauge_set() +: <a class="el" href="prom__gauge_8h.html#a04210b18bfb89aa6f3ddc72d7851a528">prom_gauge.h</a> +</li> +<li>prom_gauge_sub() +: <a class="el" href="prom__gauge_8h.html#a7ae193d586176bff82a39cd65e2bc999">prom_gauge.h</a> +</li> +<li>prom_histogram_buckets_count() +: <a class="el" href="prom__histogram__buckets_8h.html#a92158192cfe9a71a98dbb1d9adc8508a">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_buckets_destroy() +: <a class="el" href="prom__histogram__buckets_8h.html#a36bc3312f8f479bbd6eb92fa3b1a5033">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_buckets_exponential() +: <a class="el" href="prom__histogram__buckets_8h.html#a164da4101785b6fa2a292a964c232f12">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_buckets_linear() +: <a class="el" href="prom__histogram__buckets_8h.html#aa1adc550bf8999a27f6a26769d6bfc72">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_buckets_new() +: <a class="el" href="prom__histogram__buckets_8h.html#a03736e2fac21748bbfd80100bf9546c4">prom_histogram_buckets.h</a> +</li> +<li>prom_histogram_destroy() +: <a class="el" href="prom__histogram_8h.html#af9067b27e7ab2abd815af0614bb35357">prom_histogram.h</a> +</li> +<li>prom_histogram_new() +: <a class="el" href="prom__histogram_8h.html#ad42681e59e727f9e3d43bf0cdbba9a1b">prom_histogram.h</a> +</li> +<li>prom_histogram_observe() +: <a class="el" href="prom__histogram_8h.html#a274e4b869c7d9239e9f47b3898210fbe">prom_histogram.h</a> +</li> +<li>prom_metric_sample_add() +: <a class="el" href="prom__metric__sample_8h.html#a3f8674d6c8ee2c27eb7504d602110daa">prom_metric_sample.h</a> +</li> +<li>prom_metric_sample_from_labels() +: <a class="el" href="prom__metric_8h.html#a2c33d7e03b430a2903bf122fbeeb89de">prom_metric.h</a> +</li> +<li>prom_metric_sample_histogram_from_labels() +: <a class="el" href="prom__metric_8h.html#a3b76680b4a7177eebc864f3b3be1e935">prom_metric.h</a> +</li> +<li>prom_metric_sample_histogram_observe() +: <a class="el" href="prom__metric__sample__histogram_8h.html#a20a030bf6be56211c87c9feb520a3761">prom_metric_sample_histogram.h</a> +</li> +<li>prom_metric_sample_set() +: <a class="el" href="prom__metric__sample_8h.html#a0c5f0c66599282c2ee2c042ae4574db3">prom_metric_sample.h</a> +</li> +<li>prom_metric_sample_sub() +: <a class="el" href="prom__metric__sample_8h.html#a1965caa1626c308bc1cb23995e90a0a7">prom_metric_sample.h</a> +</li> +<li>promhttp_set_active_collector_registry() +: <a class="el" href="promhttp_8h.html#a712a45634bc22724fef9bedcb2841e00">promhttp.h</a> +</li> +<li>promhttp_start_daemon() +: <a class="el" href="promhttp_8h.html#a699ecc3aa11ed601269722f43da2823e">promhttp.h</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/globals_type.html b/docs/globals_type.html new file mode 100644 index 0000000..5dc6da3 --- /dev/null +++ b/docs/globals_type.html @@ -0,0 +1,100 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: File Members</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> + <ul> +<li>prom_collect_fn +: <a class="el" href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40">prom_collector.h</a> +</li> +<li>prom_collector_registry_t +: <a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry.h</a> +</li> +<li>prom_collector_t +: <a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector.h</a> +</li> +<li>prom_counter_t +: <a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter.h</a> +</li> +<li>prom_gauge_t +: <a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge.h</a> +</li> +<li>prom_histogram_t +: <a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram.h</a> +</li> +<li>prom_metric_sample_histogram_t +: <a class="el" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram.h</a> +</li> +<li>prom_metric_sample_t +: <a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample.h</a> +</li> +<li>prom_metric_t +: <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric.h</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/globals_vars.html b/docs/globals_vars.html new file mode 100644 index 0000000..77bf142 --- /dev/null +++ b/docs/globals_vars.html @@ -0,0 +1,79 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: File Members</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="contents"> + <ul> +<li>PROM_COLLECTOR_REGISTRY_DEFAULT +: <a class="el" href="prom__collector__registry_8h.html#a6092b48e150390c1927da5fe8914981b">prom_collector_registry.h</a> +</li> +<li>prom_histogram_default_buckets +: <a class="el" href="prom__histogram__buckets_8h.html#aa8d61c1abc355eb54173b27cb1b50a5d">prom_histogram_buckets.h</a> +</li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/graph_legend.dot b/docs/graph_legend.dot new file mode 100644 index 0000000..789df56 --- /dev/null +++ b/docs/graph_legend.dot @@ -0,0 +1,22 @@ +digraph "Graph Legend" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node9 [shape="box",label="Inherited",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",fillcolor="grey75",style="filled" fontcolor="black"]; + Node10 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 [shape="box",label="PublicBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPublicBase.html"]; + Node11 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 [shape="box",label="Truncated",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="red",URL="$classTruncated.html"]; + Node13 -> Node9 [dir="back",color="darkgreen",fontsize="10",style="solid",fontname="Helvetica"]; + Node13 [shape="box",label="ProtectedBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classProtectedBase.html"]; + Node14 -> Node9 [dir="back",color="firebrick4",fontsize="10",style="solid",fontname="Helvetica"]; + Node14 [shape="box",label="PrivateBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPrivateBase.html"]; + Node15 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node15 [shape="box",label="Undocumented",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="grey75"]; + Node16 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node16 [shape="box",label="Templ< int >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"]; + Node17 -> Node16 [dir="back",color="orange",fontsize="10",style="dashed",label="< int >",fontname="Helvetica"]; + Node17 [shape="box",label="Templ< T >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"]; + Node18 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label="m_usedClass",fontname="Helvetica"]; + Node18 [shape="box",label="Used",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classUsed.html"]; +} diff --git a/docs/graph_legend.html b/docs/graph_legend.html new file mode 100644 index 0000000..bea51c5 --- /dev/null +++ b/docs/graph_legend.html @@ -0,0 +1,104 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Graph Legend</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="headertitle"> +<div class="title">Graph Legend</div> </div> +</div><!--header--> +<div class="contents"> +<p>This page explains how to interpret the graphs that are generated by doxygen.</p> +<p>Consider the following example: </p><div class="fragment"><div class="line">/*! Invisible class because of truncation */</div><div class="line">class Invisible { };</div><div class="line"></div><div class="line">/*! Truncated class, inheritance relation is hidden */</div><div class="line">class Truncated : public Invisible { };</div><div class="line"></div><div class="line">/* Class not documented with doxygen comments */</div><div class="line">class Undocumented { };</div><div class="line"></div><div class="line">/*! Class that is inherited using public inheritance */</div><div class="line">class PublicBase : public Truncated { };</div><div class="line"></div><div class="line">/*! A template class */</div><div class="line">template<class T> class Templ { };</div><div class="line"></div><div class="line">/*! Class that is inherited using protected inheritance */</div><div class="line">class ProtectedBase { };</div><div class="line"></div><div class="line">/*! Class that is inherited using private inheritance */</div><div class="line">class PrivateBase { };</div><div class="line"></div><div class="line">/*! Class that is used by the Inherited class */</div><div class="line">class Used { };</div><div class="line"></div><div class="line">/*! Super class that inherits a number of other classes */</div><div class="line">class Inherited : public PublicBase,</div><div class="line"> protected ProtectedBase,</div><div class="line"> private PrivateBase,</div><div class="line"> public Undocumented,</div><div class="line"> public Templ<int></div><div class="line">{</div><div class="line"> private:</div><div class="line"> Used *m_usedClass;</div><div class="line">};</div></div><!-- fragment --><p> This will result in the following graph:</p> +<center><div class="image"> +<img src="graph_legend.png"/> +</div> +</center><p>The boxes in the above graph have the following meaning: </p> +<ul> +<li> +A filled gray box represents the struct or class for which the graph is generated. </li> +<li> +A box with a black border denotes a documented struct or class. </li> +<li> +A box with a gray border denotes an undocumented struct or class. </li> +<li> +A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries. </li> +</ul> +<p>The arrows have the following meaning: </p> +<ul> +<li> +A dark blue arrow is used to visualize a public inheritance relation between two classes. </li> +<li> +A dark green arrow is used for protected inheritance. </li> +<li> +A dark red arrow is used for private inheritance. </li> +<li> +A purple dashed arrow is used if a class is contained or used by another class. The arrow is labelled with the variable(s) through which the pointed class or struct is accessible. </li> +<li> +A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labelled with the template parameters of the instance. </li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/graph_legend.md5 b/docs/graph_legend.md5 new file mode 100644 index 0000000..a06ed05 --- /dev/null +++ b/docs/graph_legend.md5 @@ -0,0 +1 @@ +387ff8eb65306fa251338d3c9bd7bfff
\ No newline at end of file diff --git a/docs/graph_legend.png b/docs/graph_legend.png Binary files differnew file mode 100644 index 0000000..93e2541 --- /dev/null +++ b/docs/graph_legend.png diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..1e35ff9 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,119 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Welcome to the documentation site for prometheus-client-c!</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="headertitle"> +<div class="title">Welcome to the documentation site for prometheus-client-c! </div> </div> +</div><!--header--> +<div class="contents"> +<div class="toc"><h3>Table of Contents</h3> +<ul><li class="level1"><a href="#Introduction">Introduction</a></li> +<li class="level1"><a href="#Creating-and-Registering-Metrics">Creating and Registering Metrics</a></li> +<li class="level1"><a href="#Updating-Metric-Sample-Values">Updating Metric Sample Values</a></li> +<li class="level1"><a href="#Program-Initialization">Program Initialization</a></li> +<li class="level1"><a href="#Metric-Exposition-Over-HTTP">Metric Exposition Over HTTP</a></li> +<li class="level1"><a href="#Where-To-Go-From-Here">Where to Go From Here?</a></li> +</ul> +</div> +<div class="textblock"><h1><a class="anchor" id="Introduction"></a> +Introduction</h1> +<p>prometheus-client-c is a small suite of Prometheus client libraries targeted for the C programming language. In this brief tutorial you will learn how to create and register metrics, update metric samples, and expose metrics over HTTP.</p> +<h1><a class="anchor" id="Creating-and-Registering-Metrics"></a> +Creating and Registering Metrics</h1> +<p>prometheus-client-c supports the following metric types:</p> +<ul> +<li><a href="https://prometheus.io/docs/concepts/metric_types/#counter">Counter</a></li> +<li><a href="https://prometheus.io/docs/concepts/metric_types/#gauge">Gauge</a></li> +<li><a href="https://prometheus.io/docs/concepts/metric_types/#histogram">Histogram</a></li> +</ul> +<p>To get started using one of the metric types, declare the metric at file scope. For example:</p> +<div class="fragment"><div class="line"><span class="preprocessor">#incldue "prom.h"</span></div><div class="line"></div><div class="line"><a class="code" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *my_counter;</div></div><!-- fragment --><p>Next, create a metric initialization function. You can create the metric and register it with the default metric collector registry in one chain of functions. A metric collector is responsible for collecting metrics and returning them. A metric collector registry is declared in global scope and contains metric collectors. More on this later...</p> +<p>To create a metric and register it with the default metric collector registry in one shot, you may chain the metric constructor into the prom_collector_registry_must_register_metric function. For example:</p> +<div class="fragment"><div class="line"><span class="keywordtype">void</span> foo_metric_init(<span class="keywordtype">void</span>) {</div><div class="line"> my_counter = <a class="code" href="prom__collector__registry_8h.html#a113683f4e15ad9240a37ed2139ddaea6">prom_collector_registry_must_register_metric</a>(<a class="code" href="prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651">prom_counter_new</a>(<span class="stringliteral">"my_counter"</span>, <span class="stringliteral">"counts things"</span>, 0, NULL));</div><div class="line">}</div></div><!-- fragment --><p>The first argument to prom_counter_new is the counter name. The second argument is the counter description. The third argument is the number of metric labels. In this case, we will only have one metric sample for this metric so we pass 0 to specify that no labels will be used. The 4th argument is an array of strings storing the metric labels. Since we have none, we pass NULL. A call to foo_metric_init within the program's main function will initialize the metrics for the file we just created to the default prometheus metric collector registery called PROM_COLLECTOR_REGISTRY_DEFAULT</p> +<h1><a class="anchor" id="Updating-Metric-Sample-Values"></a> +Updating Metric Sample Values</h1> +<p>Now that we have a metric configured for creation and registration, we can update our metric within any of the functions of the file in which it was declared. For example:</p> +<div class="fragment"><div class="line"><span class="keywordtype">void</span> my_lib_do_something(<span class="keywordtype">void</span>) {</div><div class="line"> printf(<span class="stringliteral">"I did a really important thing!\n"</span>);</div><div class="line"> <a class="code" href="prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35">prom_counter_inc</a>(my_counter, NULL);</div><div class="line">}</div></div><!-- fragment --><p>This function will increment the default metric sample for my_counter. Since we are not using metric labels, we pass NULL as the second argument.</p> +<h1><a class="anchor" id="Program-Initialization"></a> +Program Initialization</h1> +<p>At the start of the program's main function you need to do two things:</p> +<ul> +<li>Initialize the default metric collector registry:</li> +</ul> +<div class="fragment"><div class="line"><a class="code" href="prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54">prom_collector_registry_default_init</a>();</div></div><!-- fragment --><ul> +<li>For each file containing prometheus metrics, call its corresponding metric initialization function</li> +</ul> +<div class="fragment"><div class="line">foo_metric_init()</div></div><!-- fragment --><p>After initialization is complete, you may proceed to do work and update your metrics.</p> +<h1><a class="anchor" id="Metric-Exposition-Over-HTTP"></a> +Metric Exposition Over HTTP</h1> +<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000001">Todo:</a></b></dt><dd>Describe how to use libpromhttp to expose metrics over HTTP</dd></dl> +<h1><a class="anchor" id="Where-To-Go-From-Here"></a> +Where to Go From Here?</h1> +<p>Take a look at the <a href="https://github.internal.digitalocean.com/pages/timeseries/prometheus-client-c/files.html">Files</a> tab in this documentation site for more information about the public API available to you. Also, you can take a look at the examples directory at the <a href="https://github.internal.digitalocean.com/timeseries/prometheus-client-c">Github repository</a> for inspiration. </p> +</div></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/jquery.js b/docs/jquery.js new file mode 100644 index 0000000..f5343ed --- /dev/null +++ b/docs/jquery.js @@ -0,0 +1,87 @@ +/*! + * jQuery JavaScript Library v1.7.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Nov 21 21:11:03 2011 -0500 + */ +(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b4<b3;b4++){if((b9=arguments[b4])!=null){for(b2 in b9){b0=b5[b2];b1=b9[b2];if(b5===b1){continue}if(b8&&b1&&(bF.isPlainObject(b1)||(b6=bF.isArray(b1)))){if(b6){b6=false;b7=b0&&bF.isArray(b0)?b0:[]}else{b7=b0&&bF.isPlainObject(b0)?b0:{}}b5[b2]=bF.extend(b8,b7,b1)}else{if(b1!==L){b5[b2]=b1}}}}}return b5};bF.extend({noConflict:function(b0){if(bb.$===bF){bb.$=bH}if(b0&&bb.jQuery===bF){bb.jQuery=bU}return bF},isReady:false,readyWait:1,holdReady:function(b0){if(b0){bF.readyWait++}else{bF.ready(true)}},ready:function(b0){if((b0===true&&!--bF.readyWait)||(b0!==true&&!bF.isReady)){if(!av.body){return setTimeout(bF.ready,1)}bF.isReady=true;if(b0!==true&&--bF.readyWait>0){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b4<b5;){if(b6.apply(b3[b4++],b2)===false){break}}}}else{if(b0){for(b1 in b3){if(b6.call(b3[b1],b1,b3[b1])===false){break}}}else{for(;b4<b5;){if(b6.call(b3[b4],b4,b3[b4++])===false){break}}}}return b3},trim:bO?function(b0){return b0==null?"":bO.call(b0)}:function(b0){return b0==null?"":b0.toString().replace(bI,"").replace(bE,"")},makeArray:function(b3,b1){var b0=b1||[];if(b3!=null){var b2=bF.type(b3);if(b3.length==null||b2==="string"||b2==="function"||b2==="regexp"||bF.isWindow(b3)){bz.call(b0,b3)}else{bF.merge(b0,b3)}}return b0},inArray:function(b2,b3,b1){var b0;if(b3){if(bv){return bv.call(b3,b2,b1)}b0=b3.length;b1=b1?b1<0?Math.max(0,b0+b1):b1:0;for(;b1<b0;b1++){if(b1 in b3&&b3[b1]===b2){return b1}}}return -1},merge:function(b4,b2){var b3=b4.length,b1=0;if(typeof b2.length==="number"){for(var b0=b2.length;b1<b0;b1++){b4[b3++]=b2[b1]}}else{while(b2[b1]!==L){b4[b3++]=b2[b1++]}}b4.length=b3;return b4},grep:function(b1,b6,b0){var b2=[],b5;b0=!!b0;for(var b3=0,b4=b1.length;b3<b4;b3++){b5=!!b6(b1[b3],b3);if(b0!==b5){b2.push(b1[b3])}}return b2},map:function(b0,b7,b8){var b5,b6,b4=[],b2=0,b1=b0.length,b3=b0 instanceof bF||b1!==L&&typeof b1==="number"&&((b1>0&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b2<b1;b2++){b5=b7(b0[b2],b2,b8);if(b5!=null){b4[b4.length]=b5}}}else{for(b6 in b0){b5=b7(b0[b6],b6,b8);if(b5!=null){b4[b4.length]=b5}}}return b4.concat.apply([],b4)},guid:1,proxy:function(b4,b3){if(typeof b3==="string"){var b2=b4[b3];b3=b4;b4=b2}if(!bF.isFunction(b4)){return L}var b0=bK.call(arguments,2),b1=function(){return b4.apply(b3,b0.concat(bK.call(arguments)))};b1.guid=b4.guid=b4.guid||b1.guid||bF.guid++;return b1},access:function(b0,b8,b6,b2,b5,b7){var b1=b0.length;if(typeof b8==="object"){for(var b3 in b8){bF.access(b0,b3,b8[b3],b2,b5,b6)}return b0}if(b6!==L){b2=!b7&&b2&&bF.isFunction(b6);for(var b4=0;b4<b1;b4++){b5(b0[b4],b8,b2?b6.call(b0[b4],b4,b5(b0[b4],b8)):b6,b7)}return b0}return b1?b5(b0[0],b8):L},now:function(){return(new Date()).getTime()},uaMatch:function(b1){b1=b1.toLowerCase();var b0=by.exec(b1)||bR.exec(b1)||bQ.exec(b1)||b1.indexOf("compatible")<0&&bS.exec(b1)||[];return{browser:b0[1]||"",version:b0[2]||"0"}},sub:function(){function b0(b3,b4){return new b0.fn.init(b3,b4)}bF.extend(true,b0,this);b0.superclass=this;b0.fn=b0.prototype=this();b0.fn.constructor=b0;b0.sub=this.sub;b0.fn.init=function b2(b3,b4){if(b4&&b4 instanceof bF&&!(b4 instanceof b0)){b4=b0(b4)}return bF.fn.init.call(this,b3,b4,b1)};b0.fn.init.prototype=b0.fn;var b1=b0(av);return b0},browser:{}});bF.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(b1,b0){bx["[object "+b0+"]"]=b0.toLowerCase()});bV=bF.uaMatch(bX);if(bV.browser){bF.browser[bV.browser]=true;bF.browser.version=bV.version}if(bF.browser.webkit){bF.browser.safari=true}if(bM.test("\xA0")){bI=/^[\s\xA0]+/;bE=/[\s\xA0]+$/}bD=bF(av);if(av.addEventListener){e=function(){av.removeEventListener("DOMContentLoaded",e,false);bF.ready()}}else{if(av.attachEvent){e=function(){if(av.readyState==="complete"){av.detachEvent("onreadystatechange",e);bF.ready()}}}}function bw(){if(bF.isReady){return}try{av.documentElement.doScroll("left")}catch(b0){setTimeout(bw,1);return}bF.ready()}return bF})();var a2={};function X(e){var bv=a2[e]={},bw,bx;e=e.split(/\s+/);for(bw=0,bx=e.length;bw<bx;bw++){bv[e[bw]]=true}return bv}b.Callbacks=function(bw){bw=bw?(a2[bw]||X(bw)):{};var bB=[],bC=[],bx,by,bv,bz,bA,bE=function(bF){var bG,bJ,bI,bH,bK;for(bG=0,bJ=bF.length;bG<bJ;bG++){bI=bF[bG];bH=b.type(bI);if(bH==="array"){bE(bI)}else{if(bH==="function"){if(!bw.unique||!bD.has(bI)){bB.push(bI)}}}}},e=function(bG,bF){bF=bF||[];bx=!bw.memory||[bG,bF];by=true;bA=bv||0;bv=0;bz=bB.length;for(;bB&&bA<bz;bA++){if(bB[bA].apply(bG,bF)===false&&bw.stopOnFalse){bx=true;break}}by=false;if(bB){if(!bw.once){if(bC&&bC.length){bx=bC.shift();bD.fireWith(bx[0],bx[1])}}else{if(bx===true){bD.disable()}else{bB=[]}}}},bD={add:function(){if(bB){var bF=bB.length;bE(arguments);if(by){bz=bB.length}else{if(bx&&bx!==true){bv=bF;e(bx[0],bx[1])}}}return this},remove:function(){if(bB){var bF=arguments,bH=0,bI=bF.length;for(;bH<bI;bH++){for(var bG=0;bG<bB.length;bG++){if(bF[bH]===bB[bG]){if(by){if(bG<=bz){bz--;if(bG<=bA){bA--}}}bB.splice(bG--,1);if(bw.unique){break}}}}}return this},has:function(bG){if(bB){var bF=0,bH=bB.length;for(;bF<bH;bF++){if(bG===bB[bF]){return true}}}return false},empty:function(){bB=[];return this},disable:function(){bB=bC=bx=L;return this},disabled:function(){return !bB},lock:function(){bC=L;if(!bx||bx===true){bD.disable()}return this},locked:function(){return !bC},fireWith:function(bG,bF){if(bC){if(by){if(!bw.once){bC.push([bG,bF])}}else{if(!(bw.once&&bx)){e(bG,bF)}}}return this},fire:function(){bD.fireWith(this,arguments);return this},fired:function(){return !!bx}};return bD};var aJ=[].slice;b.extend({Deferred:function(by){var bx=b.Callbacks("once memory"),bw=b.Callbacks("once memory"),bv=b.Callbacks("memory"),e="pending",bA={resolve:bx,reject:bw,notify:bv},bC={done:bx.add,fail:bw.add,progress:bv.add,state:function(){return e},isResolved:bx.fired,isRejected:bw.fired,then:function(bE,bD,bF){bB.done(bE).fail(bD).progress(bF);return this},always:function(){bB.done.apply(bB,arguments).fail.apply(bB,arguments);return this},pipe:function(bF,bE,bD){return b.Deferred(function(bG){b.each({done:[bF,"resolve"],fail:[bE,"reject"],progress:[bD,"notify"]},function(bI,bL){var bH=bL[0],bK=bL[1],bJ;if(b.isFunction(bH)){bB[bI](function(){bJ=bH.apply(this,arguments);if(bJ&&b.isFunction(bJ.promise)){bJ.promise().then(bG.resolve,bG.reject,bG.notify)}else{bG[bK+"With"](this===bB?bG:this,[bJ])}})}else{bB[bI](bG[bK])}})}).promise()},promise:function(bE){if(bE==null){bE=bC}else{for(var bD in bC){bE[bD]=bC[bD]}}return bE}},bB=bC.promise({}),bz;for(bz in bA){bB[bz]=bA[bz].fire;bB[bz+"With"]=bA[bz].fireWith}bB.done(function(){e="resolved"},bw.disable,bv.lock).fail(function(){e="rejected"},bx.disable,bv.lock);if(by){by.call(bB,bB)}return bB},when:function(bA){var bx=aJ.call(arguments,0),bv=0,e=bx.length,bB=new Array(e),bw=e,by=e,bC=e<=1&&bA&&b.isFunction(bA.promise)?bA:b.Deferred(),bE=bC.promise();function bD(bF){return function(bG){bx[bF]=arguments.length>1?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv<e;bv++){if(bx[bv]&&bx[bv].promise&&b.isFunction(bx[bv].promise)){bx[bv].promise().then(bD(bv),bC.reject,bz(bv))}else{--bw}}if(!bw){bC.resolveWith(bC,bx)}}else{if(bC!==bA){bC.resolveWith(bC,e?[bA]:[])}}return bE}});b.support=(function(){var bJ,bI,bF,bG,bx,bE,bA,bD,bz,bK,bB,by,bw,bv=av.createElement("div"),bH=av.documentElement;bv.setAttribute("className","t");bv.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="<div "+e+"><div></div></div><table "+e+" cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="<div style='width:4px;'></div>";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA<bz;bA++){delete bB[bv[bA]]}if(!(by?S:b.isEmptyObject)(bB)){return}}}if(!by){delete e[bw].data;if(!S(e[bw])){return}}if(b.support.deleteExpando||!e.setInterval){delete e[bw]}else{e[bw]=null}if(bD){if(b.support.deleteExpando){delete bx[bC]}else{if(bx.removeAttribute){bx.removeAttribute(bC)}else{bx[bC]=null}}}},_data:function(bv,e,bw){return b.data(bv,e,bw,true)},acceptData:function(bv){if(bv.nodeName){var e=b.noData[bv.nodeName.toLowerCase()];if(e){return !(e===true||bv.getAttribute("classid")!==e)}}return true}});b.fn.extend({data:function(by,bA){var bB,e,bw,bz=null;if(typeof by==="undefined"){if(this.length){bz=b.data(this[0]);if(this[0].nodeType===1&&!b._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var bx=0,bv=e.length;bx<bv;bx++){bw=e[bx].name;if(bw.indexOf("data-")===0){bw=b.camelCase(bw.substring(5));a5(this[0],bw,bz[bw])}}b._data(this[0],"parsedAttrs",true)}}return bz}else{if(typeof by==="object"){return this.each(function(){b.data(this,by)})}}bB=by.split(".");bB[1]=bB[1]?"."+bB[1]:"";if(bA===L){bz=this.triggerHandler("getData"+bB[1]+"!",[bB[0]]);if(bz===L&&this.length){bz=b.data(this[0],by);bz=a5(this[0],by,bz)}return bz===L&&bB[1]?this.data(bB[0]):bz}else{return this.each(function(){var bC=b(this),bD=[bB[0],bA];bC.triggerHandler("setData"+bB[1]+"!",bD);b.data(this,by,bA);bC.triggerHandler("changeData"+bB[1]+"!",bD)})}},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function a5(bx,bw,by){if(by===L&&bx.nodeType===1){var bv="data-"+bw.replace(aA,"-$1").toLowerCase();by=bx.getAttribute(bv);if(typeof by==="string"){try{by=by==="true"?true:by==="false"?false:by==="null"?null:b.isNumeric(by)?parseFloat(by):aS.test(by)?b.parseJSON(by):by}catch(bz){}b.data(bx,bw,by)}else{by=L}}return by}function S(bv){for(var e in bv){if(e==="data"&&b.isEmptyObject(bv[e])){continue}if(e!=="toJSON"){return false}}return true}function bi(by,bx,bA){var bw=bx+"defer",bv=bx+"queue",e=bx+"mark",bz=b._data(by,bw);if(bz&&(bA==="queue"||!b._data(by,bv))&&(bA==="mark"||!b._data(by,e))){setTimeout(function(){if(!b._data(by,bv)&&!b._data(by,e)){b.removeData(by,bw,true);bz.fire()}},0)}}b.extend({_mark:function(bv,e){if(bv){e=(e||"fx")+"mark";b._data(bv,e,(b._data(bv,e)||0)+1)}},_unmark:function(by,bx,bv){if(by!==true){bv=bx;bx=by;by=false}if(bx){bv=bv||"fx";var e=bv+"mark",bw=by?0:((b._data(bx,e)||1)-1);if(bw){b._data(bx,e,bw)}else{b.removeData(bx,e,true);bi(bx,bv,"mark")}}},queue:function(bv,e,bx){var bw;if(bv){e=(e||"fx")+"queue";bw=b._data(bv,e);if(bx){if(!bw||b.isArray(bx)){bw=b._data(bv,e,b.makeArray(bx))}else{bw.push(bx)}}return bw||[]}},dequeue:function(by,bx){bx=bx||"fx";var bv=b.queue(by,bx),bw=bv.shift(),e={};if(bw==="inprogress"){bw=bv.shift()}if(bw){if(bx==="fx"){bv.unshift("inprogress")}b._data(by,bx+".run",e);bw.call(by,function(){b.dequeue(by,bx)},e)}if(!bv.length){b.removeData(by,bx+"queue "+bx+".run",true);bi(by,bx,"queue")}}});b.fn.extend({queue:function(e,bv){if(typeof e!=="string"){bv=e;e="fx"}if(bv===L){return b.queue(this[0],e)}return this.each(function(){var bw=b.queue(this,e,bv);if(e==="fx"&&bw[0]!=="inprogress"){b.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(bv,e){bv=b.fx?b.fx.speeds[bv]||bv:bv;e=e||"fx";return this.queue(e,function(bx,bw){var by=setTimeout(bx,bv);bw.stop=function(){clearTimeout(by)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(bD,bw){if(typeof bD!=="string"){bw=bD;bD=L}bD=bD||"fx";var e=b.Deferred(),bv=this,by=bv.length,bB=1,bz=bD+"defer",bA=bD+"queue",bC=bD+"mark",bx;function bE(){if(!(--bB)){e.resolveWith(bv,[bv])}}while(by--){if((bx=b.data(bv[by],bz,L,true)||(b.data(bv[by],bA,L,true)||b.data(bv[by],bC,L,true))&&b.data(bv[by],bz,b.Callbacks("once memory"),true))){bB++;bx.add(bE)}}bE();return e.promise()}});var aP=/[\n\t\r]/g,af=/\s+/,aU=/\r/g,g=/^(?:button|input)$/i,D=/^(?:button|input|object|select|textarea)$/i,l=/^a(?:rea)?$/i,ao=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,F=b.support.getSetAttribute,be,aY,aF;b.fn.extend({attr:function(e,bv){return b.access(this,e,bv,true,b.attr)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,bv){return b.access(this,e,bv,true,b.prop)},removeProp:function(e){e=b.propFix[e]||e;return this.each(function(){try{this[e]=L;delete this[e]}catch(bv){}})},addClass:function(by){var bA,bw,bv,bx,bz,bB,e;if(b.isFunction(by)){return this.each(function(bC){b(this).addClass(by.call(this,bC,this.className))})}if(by&&typeof by==="string"){bA=by.split(af);for(bw=0,bv=this.length;bw<bv;bw++){bx=this[bw];if(bx.nodeType===1){if(!bx.className&&bA.length===1){bx.className=by}else{bz=" "+bx.className+" ";for(bB=0,e=bA.length;bB<e;bB++){if(!~bz.indexOf(" "+bA[bB]+" ")){bz+=bA[bB]+" "}}bx.className=b.trim(bz)}}}}return this},removeClass:function(bz){var bA,bw,bv,by,bx,bB,e;if(b.isFunction(bz)){return this.each(function(bC){b(this).removeClass(bz.call(this,bC,this.className))})}if((bz&&typeof bz==="string")||bz===L){bA=(bz||"").split(af);for(bw=0,bv=this.length;bw<bv;bw++){by=this[bw];if(by.nodeType===1&&by.className){if(bz){bx=(" "+by.className+" ").replace(aP," ");for(bB=0,e=bA.length;bB<e;bB++){bx=bx.replace(" "+bA[bB]+" "," ")}by.className=b.trim(bx)}else{by.className=""}}}}return this},toggleClass:function(bx,bv){var bw=typeof bx,e=typeof bv==="boolean";if(b.isFunction(bx)){return this.each(function(by){b(this).toggleClass(bx.call(this,by,this.className,bv),bv)})}return this.each(function(){if(bw==="string"){var bA,bz=0,by=b(this),bB=bv,bC=bx.split(af);while((bA=bC[bz++])){bB=e?bB:!by.hasClass(bA);by[bB?"addClass":"removeClass"](bA)}}else{if(bw==="undefined"||bw==="boolean"){if(this.className){b._data(this,"__className__",this.className)}this.className=this.className||bx===false?"":b._data(this,"__className__")||""}}})},hasClass:function(e){var bx=" "+e+" ",bw=0,bv=this.length;for(;bw<bv;bw++){if(this[bw].nodeType===1&&(" "+this[bw].className+" ").replace(aP," ").indexOf(bx)>-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv<bz;bv++){bx=bC[bv];if(bx.selected&&(b.support.optDisabled?!bx.disabled:bx.getAttribute("disabled")===null)&&(!bx.parentNode.disabled||!b.nodeName(bx.parentNode,"optgroup"))){bA=b(bx).val();if(bw){return bA}bB.push(bA)}}if(bw&&!bB.length&&bC.length){return b(bC[by]).val()}return bB},set:function(bv,bw){var e=b.makeArray(bw);b(bv).find("option").each(function(){this.selected=b.inArray(b(this).val(),e)>=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType;if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw<e;bw++){bv=bA[bw];if(bv){by=b.propFix[bv]||bv;b.attr(bx,bv,"");bx.removeAttribute(F?bv:by);if(ao.test(bv)&&by in bx){bx[by]=false}}}}},attrHooks:{type:{set:function(e,bv){if(g.test(e.nodeName)&&e.parentNode){b.error("type property can't be changed")}else{if(!b.support.radioValue&&bv==="radio"&&b.nodeName(e,"input")){var bw=e.value;e.setAttribute("type",bv);if(bw){e.value=bw}return bv}}}},value:{get:function(bv,e){if(be&&b.nodeName(bv,"button")){return be.get(bv,e)}return e in bv?bv.value:null},set:function(bv,bw,e){if(be&&b.nodeName(bv,"button")){return be.set(bv,bw,e)}bv.value=bw}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(bz,bx,bA){var bw,e,by,bv=bz.nodeType;if(!bz||bv===3||bv===8||bv===2){return}by=bv!==1||!b.isXMLDoc(bz);if(by){bx=b.propFix[bx]||bx;e=b.propHooks[bx]}if(bA!==L){if(e&&"set" in e&&(bw=e.set(bz,bA,bx))!==L){return bw}else{return(bz[bx]=bA)}}else{if(e&&"get" in e&&(bw=e.get(bz,bx))!==null){return bw}else{return bz[bx]}}},propHooks:{tabIndex:{get:function(bv){var e=bv.getAttributeNode("tabindex");return e&&e.specified?parseInt(e.value,10):D.test(bv.nodeName)||l.test(bv.nodeName)&&bv.href?0:L}}}});b.attrHooks.tabindex=b.propHooks.tabIndex;aY={get:function(bv,e){var bx,bw=b.prop(bv,e);return bw===true||typeof bw!=="boolean"&&(bx=bv.getAttributeNode(e))&&bx.nodeValue!==false?e.toLowerCase():L},set:function(bv,bx,e){var bw;if(bx===false){b.removeAttr(bv,e)}else{bw=b.propFix[e]||e;if(bw in bv){bv[bw]=true}bv.setAttribute(e,e.toLowerCase())}return e}};if(!F){aF={name:true,id:true};be=b.valHooks.button={get:function(bw,bv){var e;e=bw.getAttributeNode(bv);return e&&(aF[bv]?e.nodeValue!=="":e.specified)?e.nodeValue:L},set:function(bw,bx,bv){var e=bw.getAttributeNode(bv);if(!e){e=av.createAttribute(bv);bw.setAttributeNode(e)}return(e.nodeValue=bx+"")}};b.attrHooks.tabindex.set=be.set;b.each(["width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{set:function(bw,bx){if(bx===""){bw.setAttribute(e,"auto");return bx}}})});b.attrHooks.contenteditable={get:be.get,set:function(bv,bw,e){if(bw===""){bw="false"}be.set(bv,bw,e)}}}if(!b.support.hrefNormalized){b.each(["href","src","width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{get:function(bx){var bw=bx.getAttribute(e,2);return bw===null?L:bw}})})}if(!b.support.style){b.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||L},set:function(e,bv){return(e.style.cssText=""+bv)}}}if(!b.support.optSelected){b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(bv){var e=bv.parentNode;if(e){e.selectedIndex;if(e.parentNode){e.parentNode.selectedIndex}}return null}})}if(!b.support.enctype){b.propFix.enctype="encoding"}if(!b.support.checkOn){b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}})}b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,bv){if(b.isArray(bv)){return(e.checked=b.inArray(b(e).val(),bv)>=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI<bC.length;bI++){bH=n.exec(bC[bI])||[];bF=bH[1];e=(bH[2]||"").split(".").sort();bE=b.event.special[bF]||{};bF=(by?bE.delegateType:bE.bindType)||bF;bE=b.event.special[bF]||{};bG=b.extend({type:bF,origType:bH[1],data:bA,handler:bJ,guid:bJ.guid,selector:by,quick:Y(by),namespace:e.join(".")},bv);bw=bK[bF];if(!bw){bw=bK[bF]=[];bw.delegateCount=0;if(!bE.setup||bE.setup.call(bx,bA,e,bB)===false){if(bx.addEventListener){bx.addEventListener(bF,bB,false)}else{if(bx.attachEvent){bx.attachEvent("on"+bF,bB)}}}}if(bE.add){bE.add.call(bx,bG);if(!bG.handler.guid){bG.handler.guid=bJ.guid}}if(by){bw.splice(bw.delegateCount++,0,bG)}else{bw.push(bG)}b.event.global[bF]=true}bx=null},global:{},remove:function(bJ,bE,bv,bH,bB){var bI=b.hasData(bJ)&&b._data(bJ),bF,bx,bz,bL,bC,bA,bG,bw,by,bK,bD,e;if(!bI||!(bw=bI.events)){return}bE=b.trim(bt(bE||"")).split(" ");for(bF=0;bF<bE.length;bF++){bx=n.exec(bE[bF])||[];bz=bL=bx[1];bC=bx[2];if(!bz){for(bz in bw){b.event.remove(bJ,bz+bE[bF],bv,bH,true)}continue}by=b.event.special[bz]||{};bz=(bH?by.delegateType:by.bindType)||bz;bD=bw[bz]||[];bA=bD.length;bC=bC?new RegExp("(^|\\.)"+bC.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(bG=0;bG<bD.length;bG++){e=bD[bG];if((bB||bL===e.origType)&&(!bv||bv.guid===e.guid)&&(!bC||bC.test(e.namespace))&&(!bH||bH===e.selector||bH==="**"&&e.selector)){bD.splice(bG--,1);if(e.selector){bD.delegateCount--}if(by.remove){by.remove.call(bJ,e)}}}if(bD.length===0&&bA!==bD.length){if(!by.teardown||by.teardown.call(bJ,bC)===false){b.removeEvent(bJ,bz,bI.handle)}delete bw[bz]}}if(b.isEmptyObject(bw)){bK=bI.handle;if(bK){bK.elem=null}b.removeData(bJ,["events","handle"],true)}},customEvent:{getData:true,setData:true,changeData:true},trigger:function(bv,bD,bA,bJ){if(bA&&(bA.nodeType===3||bA.nodeType===8)){return}var bG=bv.type||bv,bx=[],e,bw,bC,bH,bz,by,bF,bE,bB,bI;if(T.test(bG+b.event.triggered)){return}if(bG.indexOf("!")>=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bC<bB.length&&!bv.isPropagationStopped();bC++){bH=bB[bC][0];bv.type=bB[bC][1];bE=(b._data(bH,"events")||{})[bv.type]&&b._data(bH,"handle");if(bE){bE.apply(bH,bD)}bE=by&&bH[by];if(bE&&b.acceptData(bH)&&bE.apply(bH,bD)===false){bv.preventDefault()}}bv.type=bG;if(!bJ&&!bv.isDefaultPrevented()){if((!bF._default||bF._default.apply(bA.ownerDocument,bD)===false)&&!(bG==="click"&&b.nodeName(bA,"a"))&&b.acceptData(bA)){if(by&&bA[bG]&&((bG!=="focus"&&bG!=="blur")||bv.target.offsetWidth!==0)&&!b.isWindow(bA)){bz=bA[by];if(bz){bA[by]=null}b.event.triggered=bG;bA[bG]();b.event.triggered=L;if(bz){bA[by]=bz}}}}return bv.result},dispatch:function(e){e=b.event.fix(e||bb.event);var bz=((b._data(this,"events")||{})[e.type]||[]),bA=bz.delegateCount,bG=[].slice.call(arguments,0),by=!e.exclusive&&!e.namespace,bH=[],bC,bB,bK,bx,bF,bE,bv,bD,bI,bw,bJ;bG[0]=e;e.delegateTarget=this;if(bA&&!e.target.disabled&&!(e.button&&e.type==="click")){bx=b(this);bx.context=this.ownerDocument||this;for(bK=e.target;bK!=this;bK=bK.parentNode||this){bE={};bD=[];bx[0]=bK;for(bC=0;bC<bA;bC++){bI=bz[bC];bw=bI.selector;if(bE[bw]===L){bE[bw]=(bI.quick?j(bK,bI.quick):bx.is(bw))}if(bE[bw]){bD.push(bI)}}if(bD.length){bH.push({elem:bK,matches:bD})}}}if(bz.length>bA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC<bH.length&&!e.isPropagationStopped();bC++){bv=bH[bC];e.currentTarget=bv.elem;for(bB=0;bB<bv.matches.length&&!e.isImmediatePropagationStopped();bB++){bI=bv.matches[bB];if(by||(!e.namespace&&!bI.namespace)||e.namespace_re&&e.namespace_re.test(bI.namespace)){e.data=bI.data;e.handleObj=bI;bF=((b.event.special[bI.origType]||{}).handle||bI.handler).apply(bv.elem,bG);if(bF!==L){e.result=bF;if(bF===false){e.preventDefault();e.stopPropagation()}}}}}return e.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(bv,e){if(bv.which==null){bv.which=e.charCode!=null?e.charCode:e.keyCode}return bv}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(bx,bw){var by,bz,e,bv=bw.button,bA=bw.fromElement;if(bx.pageX==null&&bw.clientX!=null){by=bx.target.ownerDocument||av;bz=by.documentElement;e=by.body;bx.pageX=bw.clientX+(bz&&bz.scrollLeft||e&&e.scrollLeft||0)-(bz&&bz.clientLeft||e&&e.clientLeft||0);bx.pageY=bw.clientY+(bz&&bz.scrollTop||e&&e.scrollTop||0)-(bz&&bz.clientTop||e&&e.clientTop||0)}if(!bx.relatedTarget&&bA){bx.relatedTarget=bA===bx.target?bw.toElement:bA}if(!bx.which&&bv!==L){bx.which=(bv&1?1:(bv&2?3:(bv&4?2:0)))}return bx}},fix:function(bw){if(bw[b.expando]){return bw}var bv,bz,e=bw,bx=b.event.fixHooks[bw.type]||{},by=bx.props?this.props.concat(bx.props):this.props;bw=b.Event(e);for(bv=by.length;bv;){bz=by[--bv];bw[bz]=e[bz]}if(!bw.target){bw.target=e.srcElement||av}if(bw.target.nodeType===3){bw.target=bw.target.parentNode}if(bw.metaKey===L){bw.metaKey=bw.ctrlKey}return bx.filter?bx.filter(bw,e):bw},special:{ready:{setup:b.bindReady},load:{noBubble:true},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(bw,bv,e){if(b.isWindow(this)){this.onbeforeunload=e}},teardown:function(bv,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}},simulate:function(bw,by,bx,bv){var bz=b.extend(new b.Event(),bx,{type:bw,isSimulated:true,originalEvent:{}});if(bv){b.event.trigger(bz,null,by)}else{b.event.dispatch.call(by,bz)}if(bz.isDefaultPrevented()){bx.preventDefault()}}};b.event.handle=b.event.dispatch;b.removeEvent=av.removeEventListener?function(bv,e,bw){if(bv.removeEventListener){bv.removeEventListener(e,bw,false)}}:function(bv,e,bw){if(bv.detachEvent){bv.detachEvent("on"+e,bw)}};b.Event=function(bv,e){if(!(this instanceof b.Event)){return new b.Event(bv,e)}if(bv&&bv.type){this.originalEvent=bv;this.type=bv.type;this.isDefaultPrevented=(bv.defaultPrevented||bv.returnValue===false||bv.getPreventDefault&&bv.getPreventDefault())?i:bk}else{this.type=bv}if(e){b.extend(this,e)}this.timeStamp=bv&&bv.timeStamp||b.now();this[b.expando]=true};function bk(){return false}function i(){return true}b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=i;var bv=this.originalEvent;if(!bv){return}if(bv.preventDefault){bv.preventDefault()}else{bv.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=i;var bv=this.originalEvent;if(!bv){return}if(bv.stopPropagation){bv.stopPropagation()}bv.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i;this.stopPropagation()},isDefaultPrevented:bk,isPropagationStopped:bk,isImmediatePropagationStopped:bk};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bv,e){b.event.special[bv]={delegateType:e,bindType:e,handle:function(bz){var bB=this,bA=bz.relatedTarget,by=bz.handleObj,bw=by.selector,bx;if(!bA||(bA!==bB&&!b.contains(bB,bA))){bz.type=by.origType;bx=by.handler.apply(this,arguments);bz.type=e}return bx}}});if(!b.support.submitBubbles){b.event.special.submit={setup:function(){if(b.nodeName(this,"form")){return false}b.event.add(this,"click._submit keypress._submit",function(bx){var bw=bx.target,bv=b.nodeName(bw,"input")||b.nodeName(bw,"button")?bw.form:L;if(bv&&!bv._submit_attached){b.event.add(bv,"submit._submit",function(e){if(this.parentNode&&!e.isTrigger){b.event.simulate("submit",this.parentNode,e,true)}});bv._submit_attached=true}})},teardown:function(){if(b.nodeName(this,"form")){return false}b.event.remove(this,"._submit")}}}if(!b.support.changeBubbles){b.event.special.change={setup:function(){if(bd.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){b.event.add(this,"propertychange._change",function(e){if(e.originalEvent.propertyName==="checked"){this._just_changed=true}});b.event.add(this,"click._change",function(e){if(this._just_changed&&!e.isTrigger){this._just_changed=false;b.event.simulate("change",this,e,true)}})}return false}b.event.add(this,"beforeactivate._change",function(bw){var bv=bw.target;if(bd.test(bv.nodeName)&&!bv._change_attached){b.event.add(bv,"change._change",function(e){if(this.parentNode&&!e.isSimulated&&!e.isTrigger){b.event.simulate("change",this.parentNode,e,true)}});bv._change_attached=true}})},handle:function(bv){var e=bv.target;if(this!==e||bv.isSimulated||bv.isTrigger||(e.type!=="radio"&&e.type!=="checkbox")){return bv.handleObj.handler.apply(this,arguments)}},teardown:function(){b.event.remove(this,"._change");return bd.test(this.nodeName)}}}if(!b.support.focusinBubbles){b.each({focus:"focusin",blur:"focusout"},function(bx,e){var bv=0,bw=function(by){b.event.simulate(e,by.target,b.event.fix(by),true)};b.event.special[e]={setup:function(){if(bv++===0){av.addEventListener(bx,bw,true)}},teardown:function(){if(--bv===0){av.removeEventListener(bx,bw,true)}}}})}b.fn.extend({on:function(bw,e,bz,by,bv){var bA,bx;if(typeof bw==="object"){if(typeof e!=="string"){bz=e;e=L}for(bx in bw){this.on(bx,e,bz,bw[bx],bv)}return this}if(bz==null&&by==null){by=e;bz=e=L}else{if(by==null){if(typeof e==="string"){by=bz;bz=L}else{by=bz;bz=e;e=L}}}if(by===false){by=bk}else{if(!by){return this}}if(bv===1){bA=by;by=function(bB){b().off(bB);return bA.apply(this,arguments)};by.guid=bA.guid||(bA.guid=b.guid++)}return this.each(function(){b.event.add(this,bw,by,bz,e)})},one:function(bv,e,bx,bw){return this.on.call(this,bv,e,bx,bw,1)},off:function(bw,e,by){if(bw&&bw.preventDefault&&bw.handleObj){var bv=bw.handleObj;b(bw.delegateTarget).off(bv.namespace?bv.type+"."+bv.namespace:bv.type,bv.selector,bv.handler);return this}if(typeof bw==="object"){for(var bx in bw){this.off(bx,e,bw[bx])}return this}if(e===false||typeof e==="function"){by=e;e=L}if(by===false){by=bk}return this.each(function(){b.event.remove(this,bw,by,e)})},bind:function(e,bw,bv){return this.on(e,null,bw,bv)},unbind:function(e,bv){return this.off(e,null,bv)},live:function(e,bw,bv){b(this.context).on(e,this.selector,bw,bv);return this},die:function(e,bv){b(this.context).off(e,this.selector||"**",bv);return this},delegate:function(e,bv,bx,bw){return this.on(bv,e,bx,bw)},undelegate:function(e,bv,bw){return arguments.length==1?this.off(e,"**"):this.off(bv,e,bw)},trigger:function(e,bv){return this.each(function(){b.event.trigger(e,bv,this)})},triggerHandler:function(e,bv){if(this[0]){return b.event.trigger(e,bv,this[0],true)}},toggle:function(bx){var bv=arguments,e=bx.guid||b.guid++,bw=0,by=function(bz){var bA=(b._data(this,"lastToggle"+bx.guid)||0)%bw;b._data(this,"lastToggle"+bx.guid,bA+1);bz.preventDefault();return bv[bA].apply(this,arguments)||false};by.guid=e;while(bw<bv.length){bv[bw++].guid=e}return this.click(by)},hover:function(e,bv){return this.mouseenter(e).mouseleave(bv||e)}});b.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu").split(" "),function(bv,e){b.fn[e]=function(bx,bw){if(bw==null){bw=bx;bx=null}return arguments.length>0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e<bR.length;e++){if(bR[e]===bR[e-1]){bR.splice(e--,1)}}}}return bR};by.matches=function(e,bR){return by(e,null,null,bR)};by.matchesSelector=function(e,bR){return by(bR,null,null,[e]).length>0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS<bU;bS++){bV=bE.order[bS];if((bT=bE.leftMatch[bV].exec(bX))){bR=bT[1];bT.splice(1,1);if(bR.substr(bR.length-1)!=="\\"){bT[1]=(bT[1]||"").replace(bK,"");bW=bE.find[bV](bT,e,bY);if(bW!=null){bX=bX.replace(bE.match[bV],"");break}}}}if(!bW){bW=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bW,expr:bX}};by.filter=function(b1,b0,b4,bU){var bW,e,bZ,b6,b3,bR,bT,bV,b2,bS=b1,b5=[],bY=b0,bX=b0&&b0[0]&&by.isXML(b0[0]);while(b1&&b0.length){for(bZ in bE.filter){if((bW=bE.leftMatch[bZ].exec(b1))!=null&&bW[2]){bR=bE.filter[bZ];bT=bW[1];e=false;bW.splice(1,1);if(bT.substr(bT.length-1)==="\\"){continue}if(bY===b5){b5=[]}if(bE.preFilter[bZ]){bW=bE.preFilter[bZ](bW,bY,b4,b5,bU,bX);if(!bW){e=b6=true}else{if(bW===true){continue}}}if(bW){for(bV=0;(b3=bY[bV])!=null;bV++){if(b3){b6=bR(b3,bW,bV,bY);b2=bU^b6;if(b4&&b6!=null){if(b2){e=true}else{bY[bV]=false}}else{if(b2){b5.push(b3);e=true}}}}}if(b6!==L){if(!b4){bY=b5}b1=b1.replace(bE.match[bZ],"");if(!e){return[]}break}}}if(b1===bS){if(e==null){by.error(b1)}else{break}}bS=b1}return bY};by.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var bw=by.getText=function(bU){var bS,bT,e=bU.nodeType,bR="";if(e){if(e===1||e===9){if(typeof bU.textContent==="string"){return bU.textContent}else{if(typeof bU.innerText==="string"){return bU.innerText.replace(bO,"")}else{for(bU=bU.firstChild;bU;bU=bU.nextSibling){bR+=bw(bU)}}}}else{if(e===3||e===4){return bU.nodeValue}}}else{for(bS=0;(bT=bU[bS]);bS++){if(bT.nodeType!==8){bR+=bw(bT)}}}return bR};var bE=by.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bW,bR){var bT=typeof bR==="string",bV=bT&&!bQ.test(bR),bX=bT&&!bV;if(bV){bR=bR.toLowerCase()}for(var bS=0,e=bW.length,bU;bS<e;bS++){if((bU=bW[bS])){while((bU=bU.previousSibling)&&bU.nodeType!==1){}bW[bS]=bX||bU&&bU.nodeName.toLowerCase()===bR?bU||false:bU===bR}}if(bX){by.filter(bR,bW,true)}},">":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS<e;bS++){bV=bW[bS];if(bV){var bT=bV.parentNode;bW[bS]=bT.nodeName.toLowerCase()===bR?bT:false}}}else{for(;bS<e;bS++){bV=bW[bS];if(bV){bW[bS]=bU?bV.parentNode:bV.parentNode===bR}}if(bU){by.filter(bR,bW,true)}}},"":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("parentNode",bR,bS,bT,bU,bV)},"~":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("previousSibling",bR,bS,bT,bU,bV)}},find:{ID:function(bR,bS,bT){if(typeof bS.getElementById!=="undefined"&&!bT){var e=bS.getElementById(bR[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bS,bV){if(typeof bV.getElementsByName!=="undefined"){var bR=[],bU=bV.getElementsByName(bS[1]);for(var bT=0,e=bU.length;bT<e;bT++){if(bU[bT].getAttribute("name")===bS[1]){bR.push(bU[bT])}}return bR.length===0?null:bR}},TAG:function(e,bR){if(typeof bR.getElementsByTagName!=="undefined"){return bR.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(bT,bR,bS,e,bW,bX){bT=" "+bT[1].replace(bK,"")+" ";if(bX){return bT}for(var bU=0,bV;(bV=bR[bU])!=null;bU++){if(bV){if(bW^(bV.className&&(" "+bV.className+" ").replace(/[\t\n\r]/g," ").indexOf(bT)>=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bR<e[3]-0},gt:function(bS,bR,e){return bR>e[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV<bU;bV++){if(bT[bV]===bS){return false}}return true}else{by.error(e)}}}},CHILD:function(bS,bU){var bT,b0,bW,bZ,e,bV,bY,bX=bU[1],bR=bS;switch(bX){case"only":case"first":while((bR=bR.previousSibling)){if(bR.nodeType===1){return false}}if(bX==="first"){return true}bR=bS;case"last":while((bR=bR.nextSibling)){if(bR.nodeType===1){return false}}return true;case"nth":bT=bU[2];b0=bU[3];if(bT===1&&b0===0){return true}bW=bU[0];bZ=bS.parentNode;if(bZ&&(bZ[bC]!==bW||!bS.nodeIndex)){bV=0;for(bR=bZ.firstChild;bR;bR=bR.nextSibling){if(bR.nodeType===1){bR.nodeIndex=++bV}}bZ[bC]=bW}bY=bS.nodeIndex-b0;if(bT===0){return bY===0}else{return(bY%bT===0&&bY/bT>=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS<e;bS++){bR.push(bU[bS])}}else{for(;bU[bS];bS++){bR.push(bU[bS])}}}return bR}}var bJ,bG;if(av.documentElement.compareDocumentPosition){bJ=function(bR,e){if(bR===e){bB=true;return 0}if(!bR.compareDocumentPosition||!e.compareDocumentPosition){return bR.compareDocumentPosition?-1:1}return bR.compareDocumentPosition(e)&4?-1:1}}else{bJ=function(bY,bX){if(bY===bX){bB=true;return 0}else{if(bY.sourceIndex&&bX.sourceIndex){return bY.sourceIndex-bX.sourceIndex}}var bV,bR,bS=[],e=[],bU=bY.parentNode,bW=bX.parentNode,bZ=bU;if(bU===bW){return bG(bY,bX)}else{if(!bU){return -1}else{if(!bW){return 1}}}while(bZ){bS.unshift(bZ);bZ=bZ.parentNode}bZ=bW;while(bZ){e.unshift(bZ);bZ=bZ.parentNode}bV=bS.length;bR=e.length;for(var bT=0;bT<bV&&bT<bR;bT++){if(bS[bT]!==e[bT]){return bG(bS[bT],e[bT])}}return bT===bV?bG(bY,e[bT],-1):bG(bS[bT],bX,1)};bG=function(bR,e,bS){if(bR===e){return bS}var bT=bR.nextSibling;while(bT){if(bT===e){return -1}bT=bT.nextSibling}return 1}}(function(){var bR=av.createElement("div"),bS="script"+(new Date()).getTime(),e=av.documentElement;bR.innerHTML="<a name='"+bS+"'/>";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="<p class='TEST'></p>";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1&&!bY){e[bC]=bV;e.sizset=bT}if(e.nodeName.toLowerCase()===bW){bU=e;break}e=e[bR]}bZ[bT]=bU}}}function bN(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1){if(!bY){e[bC]=bV;e.sizset=bT}if(typeof bW!=="string"){if(e===bW){bU=true;break}}else{if(by.filter(bW,[e]).length>0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT<bR;bT++){by(bS,bY[bT],bX,bW)}return by.filter(bU,bX)};by.attr=b.attr;by.selectors.attrMap={};b.find=by;b.expr=by.selectors;b.expr[":"]=b.expr.filters;b.unique=by.uniqueSort;b.text=by.getText;b.isXMLDoc=by.isXML;b.contains=by.contains})();var ab=/Until$/,aq=/^(?:parents|prevUntil|prevAll)/,a9=/,/,bp=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,H=b.expr.match.POS,ay={children:true,contents:true,next:true,prev:true};b.fn.extend({find:function(e){var bw=this,by,bv;if(typeof e!=="string"){return b(e).filter(function(){for(by=0,bv=bw.length;by<bv;by++){if(b.contains(bw[by],this)){return true}}})}var bx=this.pushStack("","find",e),bA,bB,bz;for(by=0,bv=this.length;by<bv;by++){bA=bx.length;b.find(e,this[by],bx);if(by>0){for(bB=bA;bB<bx.length;bB++){for(bz=0;bz<bA;bz++){if(bx[bz]===bx[bB]){bx.splice(bB--,1);break}}}}}return bx},has:function(bv){var e=b(bv);return this.filter(function(){for(var bx=0,bw=e.length;bx<bw;bx++){if(b.contains(this,e[bx])){return true}}})},not:function(e){return this.pushStack(aG(this,e,false),"not",e)},filter:function(e){return this.pushStack(aG(this,e,true),"filter",e)},is:function(e){return !!e&&(typeof e==="string"?H.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw<by.length;bw++){if(b(bz).is(by[bw])){bv.push({selector:by[bw],elem:bz,level:bB})}}bz=bz.parentNode;bB++}return bv}var bA=H.test(by)||typeof by!=="string"?b(by,bx||this.context):0;for(bw=0,e=this.length;bw<e;bw++){bz=this[bw];while(bz){if(bA?bA.index(bz)>-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/<tbody/i,W=/<|&#?\w+;/,ae=/<(?:script|style)/i,O=/<(?:script|object|embed|option|style)/i,ah=new RegExp("<(?:"+aR+")","i"),o=/checked\s*(?:[^=]|=\s*.checked.)/i,bm=/\/(java|ecma)script/i,aN=/^\s*<!(?:\[CDATA\[|\-\-)/,ax={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div<div>","</div>"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1></$2>");try{for(var bw=0,bv=this.length;bw<bv;bw++){if(this[bw].nodeType===1){b.cleanData(this[bw].getElementsByTagName("*"));this[bw].innerHTML=bx}}}catch(by){this.empty().append(bx)}}else{if(b.isFunction(bx)){this.each(function(bz){var e=b(this);e.html(bx.call(this,bz,e.html()))})}else{this.empty().append(bx)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(b.isFunction(e)){return this.each(function(bx){var bw=b(this),bv=bw.html();bw.replaceWith(e.call(this,bx,bv))})}if(typeof e!=="string"){e=b(e).detach()}return this.each(function(){var bw=this.nextSibling,bv=this.parentNode;b(this).remove();if(bw){b(bw).before(e)}else{b(bv).append(e)}})}else{return this.length?this.pushStack(b(b.isFunction(e)?e():e),"replaceWith",e):this}},detach:function(e){return this.remove(e,true)},domManip:function(bB,bF,bE){var bx,by,bA,bD,bC=bB[0],bv=[];if(!b.support.checkClone&&arguments.length===3&&typeof bC==="string"&&o.test(bC)){return this.each(function(){b(this).domManip(bB,bF,bE,true)})}if(b.isFunction(bC)){return this.each(function(bH){var bG=b(this);bB[0]=bC.call(this,bH,bF?bG.html():L);bG.domManip(bB,bF,bE)})}if(this[0]){bD=bC&&bC.parentNode;if(b.support.parentNode&&bD&&bD.nodeType===11&&bD.childNodes.length===this.length){bx={fragment:bD}}else{bx=b.buildFragment(bB,this,bv)}bA=bx.fragment;if(bA.childNodes.length===1){by=bA=bA.firstChild}else{by=bA.firstChild}if(by){bF=bF&&b.nodeName(by,"tr");for(var bw=0,e=this.length,bz=e-1;bw<e;bw++){bE.call(bF?ba(this[bw],by):this[bw],bx.cacheable||(e>1&&bw<bz)?b.clone(bA,true,true):bA)}}if(bv.length){b.each(bv,bo)}}return this}});function ba(e,bv){return b.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function t(bB,bv){if(bv.nodeType!==1||!b.hasData(bB)){return}var by,bx,e,bA=b._data(bB),bz=b._data(bv,bA),bw=bA.events;if(bw){delete bz.handle;bz.events={};for(by in bw){for(bx=0,e=bw[by].length;bx<e;bx++){b.event.add(bv,by+(bw[by][bx].namespace?".":"")+bw[by][bx].namespace,bw[by][bx],bw[by][bx].data)}}}if(bz.data){bz.data=b.extend({},bz.data)}}function ai(bv,e){var bw;if(e.nodeType!==1){return}if(e.clearAttributes){e.clearAttributes()}if(e.mergeAttributes){e.mergeAttributes(bv)}bw=e.nodeName.toLowerCase();if(bw==="object"){e.outerHTML=bv.outerHTML}else{if(bw==="input"&&(bv.type==="checkbox"||bv.type==="radio")){if(bv.checked){e.defaultChecked=e.checked=bv.checked}if(e.value!==bv.value){e.value=bv.value}}else{if(bw==="option"){e.selected=bv.defaultSelected}else{if(bw==="input"||bw==="textarea"){e.defaultValue=bv.defaultValue}}}}e.removeAttribute(b.expando)}b.buildFragment=function(bz,bx,bv){var by,e,bw,bA,bB=bz[0];if(bx&&bx[0]){bA=bx[0].ownerDocument||bx[0]}if(!bA.createDocumentFragment){bA=av}if(bz.length===1&&typeof bB==="string"&&bB.length<512&&bA===av&&bB.charAt(0)==="<"&&!O.test(bB)&&(b.support.checkClone||!o.test(bB))&&(b.support.html5Clone||!ah.test(bB))){e=true;bw=b.fragments[bB];if(bw&&bw!==1){by=bw}}if(!by){by=bA.createDocumentFragment();b.clean(bz,bA,by,bv)}if(e){b.fragments[bB]=bw?by:1}return{fragment:by,cacheable:e}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bv){b.fn[e]=function(bw){var bz=[],bC=b(bw),bB=this.length===1&&this[0].parentNode;if(bB&&bB.nodeType===11&&bB.childNodes.length===1&&bC.length===1){bC[bv](this[0]);return this}else{for(var bA=0,bx=bC.length;bA<bx;bA++){var by=(bA>0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1></$2>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]==="<table>"&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB<bG;bB++){E(bz[bB])}}else{E(bz)}}if(bz.nodeType){bI.push(bz)}else{bI=b.merge(bI,bz)}}if(bH){bF=function(bL){return !bL.type||bm.test(bL.type)};for(bE=0;bI[bE];bE++){if(bA&&b.nodeName(bI[bE],"script")&&(!bI[bE].type||bI[bE].type.toLowerCase()==="text/javascript")){bA.push(bI[bE].parentNode?bI[bE].parentNode.removeChild(bI[bE]):bI[bE])}else{if(bI[bE].nodeType===1){var bJ=b.grep(bI[bE].getElementsByTagName("script"),bF);bI.splice.apply(bI,[bE+1,0].concat(bJ))}bH.appendChild(bI[bE])}}}return bI},cleanData:function(bv){var by,bw,e=b.cache,bB=b.event.special,bA=b.support.deleteExpando;for(var bz=0,bx;(bx=bv[bz])!=null;bz++){if(bx.nodeName&&b.noData[bx.nodeName.toLowerCase()]){continue}bw=bx[b.expando];if(bw){by=e[bw];if(by&&by.events){for(var bC in by.events){if(bB[bC]){b.event.remove(bx,bC)}else{b.removeEvent(bx,bC,by.handle)}}if(by.handle){by.handle.elem=null}}if(bA){delete bx[b.expando]}else{if(bx.removeAttribute){bx.removeAttribute(b.expando)}}delete e[bw]}}}});function bo(e,bv){if(bv.src){b.ajax({url:bv.src,async:false,dataType:"script"})}else{b.globalEval((bv.text||bv.textContent||bv.innerHTML||"").replace(aN,"/*$0*/"))}if(bv.parentNode){bv.parentNode.removeChild(bv)}}var ak=/alpha\([^)]*\)/i,au=/opacity=([^)]*)/,z=/([A-Z]|^ms)/g,bc=/^-?\d+(?:px)?$/i,bn=/^-?\d/,I=/^([\-+])=([\-+.\de]+)/,a7={position:"absolute",visibility:"hidden",display:"block"},an=["Left","Right"],a1=["Top","Bottom"],Z,aI,aX;b.fn.css=function(e,bv){if(arguments.length===2&&bv===L){return this}return b.access(this,e,bv,true,function(bx,bw,by){return by!==L?b.style(bx,bw,by):b.css(bx,bw)})};b.extend({cssHooks:{opacity:{get:function(bw,bv){if(bv){var e=Z(bw,"opacity","opacity");return e===""?"1":e}else{return bw.style.opacity}}}},cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(bx,bw,bD,by){if(!bx||bx.nodeType===3||bx.nodeType===8||!bx.style){return}var bB,bC,bz=b.camelCase(bw),bv=bx.style,bE=b.cssHooks[bz];bw=b.cssProps[bz]||bz;if(bD!==L){bC=typeof bD;if(bC==="string"&&(bB=I.exec(bD))){bD=(+(bB[1]+1)*+bB[2])+parseFloat(b.css(bx,bw));bC="number"}if(bD==null||bC==="number"&&isNaN(bD)){return}if(bC==="number"&&!b.cssNumber[bz]){bD+="px"}if(!bE||!("set" in bE)||(bD=bE.set(bx,bD))!==L){try{bv[bw]=bD}catch(bA){}}}else{if(bE&&"get" in bE&&(bB=bE.get(bx,false,by))!==L){return bB}return bv[bw]}},css:function(by,bx,bv){var bw,e;bx=b.camelCase(bx);e=b.cssHooks[bx];bx=b.cssProps[bx]||bx;if(bx==="cssFloat"){bx="float"}if(e&&"get" in e&&(bw=e.get(by,true,bv))!==L){return bw}else{if(Z){return Z(by,bx)}}},swap:function(bx,bw,by){var e={};for(var bv in bw){e[bv]=bx.style[bv];bx.style[bv]=bw[bv]}by.call(bx);for(bv in bw){bx.style[bv]=e[bv]}}});b.curCSS=b.css;b.each(["height","width"],function(bv,e){b.cssHooks[e]={get:function(by,bx,bw){var bz;if(bx){if(by.offsetWidth!==0){return p(by,e,bw)}else{b.swap(by,a7,function(){bz=p(by,e,bw)})}return bz}},set:function(bw,bx){if(bc.test(bx)){bx=parseFloat(bx);if(bx>=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx<e;bx++){if(!bv){bA-=parseFloat(b.css(by,"padding"+bz[bx]))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}else{bA-=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}}}return bA+"px"}bA=Z(by,bw,bw);if(bA<0||bA==null){bA=by.style[bw]||0}bA=parseFloat(bA)||0;if(bv){for(;bx<e;bx++){bA+=parseFloat(b.css(by,"padding"+bz[bx]))||0;if(bv!=="padding"){bA+=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}}}return bA+"px"}if(b.expr&&b.expr.filters){b.expr.filters.hidden=function(bw){var bv=bw.offsetWidth,e=bw.offsetHeight;return(bv===0&&e===0)||(!b.support.reliableHiddenOffsets&&((bw.style&&bw.style.display)||b.css(bw,"display"))==="none")};b.expr.filters.visible=function(e){return !b.expr.filters.hidden(e)}}var k=/%20/g,ap=/\[\]$/,bs=/\r?\n/g,bq=/#.*$/,aD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aZ=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aM=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,aQ=/^(?:GET|HEAD)$/,c=/^\/\//,M=/\?/,a6=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw<bz;bw++){bv=bx[bw];bC=/^\+/.test(bv);if(bC){bv=bv.substr(1)||"*"}bB=e[bv]=e[bv]||[];bB[bC?"unshift":"push"](bA)}}}}function aW(bv,bE,bz,bD,bB,bx){bB=bB||bE.dataTypes[0];bx=bx||{};bx[bB]=true;var bA=bv[bB],bw=0,e=bA?bA.length:0,by=(bv===aa),bC;for(;bw<e&&(by||!bC);bw++){bC=bA[bw](bE,bz,bD);if(typeof bC==="string"){if(!by||bx[bC]){bC=L}else{bE.dataTypes.unshift(bC);bC=aW(bv,bE,bz,bD,bC,bx)}}}if((by||!bC)&&!bx["*"]){bC=aW(bv,bE,bz,bD,"*",bx)}return bC}function am(bw,bx){var bv,e,by=b.ajaxSettings.flatOptions||{};for(bv in bx){if(bx[bv]!==L){(by[bv]?bw:(e||(e={})))[bv]=bx[bv]}}if(e){b.extend(true,bw,e)}}b.fn.extend({load:function(bw,bz,bA){if(typeof bw!=="string"&&A){return A.apply(this,arguments)}else{if(!this.length){return this}}var by=bw.indexOf(" ");if(by>=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("<div>").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA<bw;bA++){if(bA===1){for(bE in bH.converters){if(typeof bE==="string"){bG[bE.toLowerCase()]=bH.converters[bE]}}}bx=bC;bC=bD[bA];if(bC==="*"){bC=bx}else{if(bx!=="*"&&bx!==bC){by=bx+" "+bC;bF=bG[by]||bG["* "+bC];if(!bF){e=L;for(bv in bG){bB=bv.split(" ");if(bB[0]===bx||bB[0]==="*"){e=bG[bB[1]+" "+bC];if(e){bv=bG[bv];if(bv===true){bF=e}else{if(e===true){bF=bv}}break}}}}if(!(bF||e)){b.error("No conversion from "+by.replace(" "," to "))}if(bF!==true){bz=bF?bF(bz):e(bv(bz))}}}}return bz}var aC=b.now(),u=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+(aC++)}});b.ajaxPrefilter("json jsonp",function(bD,bA,bC){var bx=bD.contentType==="application/x-www-form-urlencoded"&&(typeof bD.data==="string");if(bD.dataTypes[0]==="jsonp"||bD.jsonp!==false&&(u.test(bD.url)||bx&&u.test(bD.data))){var bB,bw=bD.jsonpCallback=b.isFunction(bD.jsonpCallback)?bD.jsonpCallback():bD.jsonpCallback,bz=bb[bw],e=bD.url,by=bD.data,bv="$1"+bw+"$2";if(bD.jsonp!==false){e=e.replace(u,bv);if(bD.url===e){if(bx){by=by.replace(u,bv)}if(bD.data===by){e+=(/\?/.test(e)?"&":"?")+bD.jsonp+"="+bw}}}bD.url=e;bD.data=by;bb[bw]=function(bE){bB=[bE]};bC.always(function(){bb[bw]=bz;if(bB&&b.isFunction(bz)){bb[bw](bB[0])}});bD.converters["script json"]=function(){if(!bB){b.error(bw+" was not called")}return bB[0]};bD.dataTypes[0]="json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){b.globalEval(e);return e}}});b.ajaxPrefilter("script",function(e){if(e.cache===L){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});b.ajaxTransport("script",function(bw){if(bw.crossDomain){var e,bv=av.head||av.getElementsByTagName("head")[0]||av.documentElement;return{send:function(bx,by){e=av.createElement("script");e.async="async";if(bw.scriptCharset){e.charset=bw.scriptCharset}e.src=bw.url;e.onload=e.onreadystatechange=function(bA,bz){if(bz||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bv&&e.parentNode){bv.removeChild(e)}e=L;if(!bz){by(200,"success")}}};bv.insertBefore(e,bv.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var B=bb.ActiveXObject?function(){for(var e in N){N[e](0,1)}}:false,y=0,N;function aL(){try{return new bb.XMLHttpRequest()}catch(bv){}}function aj(){try{return new bb.ActiveXObject("Microsoft.XMLHTTP")}catch(bv){}}b.ajaxSettings.xhr=bb.ActiveXObject?function(){return !this.isLocal&&aL()||aj()}:aL;(function(e){b.extend(b.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(b.ajaxSettings.xhr());if(b.support.ajax){b.ajaxTransport(function(e){if(!e.crossDomain||b.support.cors){var bv;return{send:function(bB,bw){var bA=e.xhr(),bz,by;if(e.username){bA.open(e.type,e.url,e.async,e.username,e.password)}else{bA.open(e.type,e.url,e.async)}if(e.xhrFields){for(by in e.xhrFields){bA[by]=e.xhrFields[by]}}if(e.mimeType&&bA.overrideMimeType){bA.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!bB["X-Requested-With"]){bB["X-Requested-With"]="XMLHttpRequest"}try{for(by in bB){bA.setRequestHeader(by,bB[by])}}catch(bx){}bA.send((e.hasContent&&e.data)||null);bv=function(bK,bE){var bF,bD,bC,bI,bH;try{if(bv&&(bE||bA.readyState===4)){bv=L;if(bz){bA.onreadystatechange=b.noop;if(B){delete N[bz]}}if(bE){if(bA.readyState!==4){bA.abort()}}else{bF=bA.status;bC=bA.getAllResponseHeaders();bI={};bH=bA.responseXML;if(bH&&bH.documentElement){bI.xml=bH}bI.text=bA.responseText;try{bD=bA.statusText}catch(bJ){bD=""}if(!bF&&e.isLocal&&!e.crossDomain){bF=bI.text?200:404}else{if(bF===1223){bF=204}}}}}catch(bG){if(!bE){bw(-1,bG)}}if(bI){bw(bF,bD,bI,bC)}};if(!e.async||bA.readyState===4){bv()}else{bz=++y;if(B){if(!N){N={};b(bb).unload(B)}N[bz]=bv}bA.onreadystatechange=bv}},abort:function(){if(bv){bv(0,1)}}}}})}var Q={},a8,m,aB=/^(?:toggle|show|hide)$/,aT=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,a3,aH=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],a4;b.fn.extend({show:function(bx,bA,bz){var bw,by;if(bx||bx===0){return this.animate(a0("show",3),bx,bA,bz)}else{for(var bv=0,e=this.length;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(!b._data(bw,"olddisplay")&&by==="none"){by=bw.style.display=""}if(by===""&&b.css(bw,"display")==="none"){b._data(bw,"olddisplay",x(bw.nodeName))}}}for(bv=0;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(by===""||by==="none"){bw.style.display=b._data(bw,"olddisplay")||""}}}return this}},hide:function(bx,bA,bz){if(bx||bx===0){return this.animate(a0("hide",3),bx,bA,bz)}else{var bw,by,bv=0,e=this.length;for(;bv<e;bv++){bw=this[bv];if(bw.style){by=b.css(bw,"display");if(by!=="none"&&!b._data(bw,"olddisplay")){b._data(bw,"olddisplay",by)}}}for(bv=0;bv<e;bv++){if(this[bv].style){this[bv].style.display="none"}}return this}},_toggle:b.fn.toggle,toggle:function(bw,bv,bx){var e=typeof bw==="boolean";if(b.isFunction(bw)&&b.isFunction(bv)){this._toggle.apply(this,arguments)}else{if(bw==null||e){this.each(function(){var by=e?bw:b(this).is(":hidden");b(this)[by?"show":"hide"]()})}else{this.animate(a0("toggle",3),bw,bv,bx)}}return this},fadeTo:function(e,bx,bw,bv){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bx},e,bw,bv)},animate:function(bz,bw,by,bx){var e=b.speed(bw,by,bx);if(b.isEmptyObject(bz)){return this.each(e.complete,[false])}bz=b.extend({},bz);function bv(){if(e.queue===false){b._mark(this)}var bE=b.extend({},e),bK=this.nodeType===1,bI=bK&&b(this).is(":hidden"),bB,bF,bD,bJ,bH,bC,bG,bL,bA;bE.animatedProperties={};for(bD in bz){bB=b.camelCase(bD);if(bD!==bB){bz[bB]=bz[bD];delete bz[bD]}bF=bz[bB];if(b.isArray(bF)){bE.animatedProperties[bB]=bF[1];bF=bz[bB]=bF[0]}else{bE.animatedProperties[bB]=bE.specialEasing&&bE.specialEasing[bB]||bE.easing||"swing"}if(bF==="hide"&&bI||bF==="show"&&!bI){return bE.complete.call(this)}if(bK&&(bB==="height"||bB==="width")){bE.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(b.css(this,"display")==="inline"&&b.css(this,"float")==="none"){if(!b.support.inlineBlockNeedsLayout||x(this.nodeName)==="inline"){this.style.display="inline-block"}else{this.style.zoom=1}}}}if(bE.overflow!=null){this.style.overflow="hidden"}for(bD in bz){bJ=new b.fx(this,bE,bD);bF=bz[bD];if(aB.test(bF)){bA=b._data(this,"toggle"+bD)||(bF==="toggle"?bI?"show":"hide":0);if(bA){b._data(this,"toggle"+bD,bA==="show"?"hide":"show");bJ[bA]()}else{bJ[bF]()}}else{bH=aT.exec(bF);bC=bJ.cur();if(bH){bG=parseFloat(bH[2]);bL=bH[3]||(b.cssNumber[bD]?"":"px");if(bL!=="px"){b.style(this,bD,(bG||1)+bL);bC=((bG||1)/bJ.cur())*bC;b.style(this,bD,bC+bL)}if(bH[1]){bG=((bH[1]==="-="?-1:1)*bG)+bC}bJ.custom(bC,bG,bL)}else{bJ.custom(bC,bF,"")}}}return true}return e.queue===false?this.each(bv):this.queue(e.queue,bv)},stop:function(bw,bv,e){if(typeof bw!=="string"){e=bv;bv=bw;bw=L}if(bv&&bw!==false){this.queue(bw||"fx",[])}return this.each(function(){var bx,by=false,bA=b.timers,bz=b._data(this);if(!e){b._unmark(true,this)}function bB(bE,bF,bD){var bC=bF[bD];b.removeData(bE,bD,true);bC.stop(e)}if(bw==null){for(bx in bz){if(bz[bx]&&bz[bx].stop&&bx.indexOf(".run")===bx.length-4){bB(this,bz,bx)}}}else{if(bz[bx=bw+".run"]&&bz[bx].stop){bB(this,bz,bx)}}for(bx=bA.length;bx--;){if(bA[bx].elem===this&&(bw==null||bA[bx].queue===bw)){if(e){bA[bx](true)}else{bA[bx].saveState()}by=true;bA.splice(bx,1)}}if(!(e&&by)){b.dequeue(this,bw)}})}});function bh(){setTimeout(at,0);return(a4=b.now())}function at(){a4=L}function a0(bv,e){var bw={};b.each(aH.concat.apply([],aH.slice(0,e)),function(){bw[this]=bv});return bw}b.each({slideDown:a0("show",1),slideUp:a0("hide",1),slideToggle:a0("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bv){b.fn[e]=function(bw,by,bx){return this.animate(bv,bw,by,bx)}});b.extend({speed:function(bw,bx,bv){var e=bw&&typeof bw==="object"?b.extend({},bw):{complete:bv||!bv&&bx||b.isFunction(bw)&&bw,duration:bw,easing:bv&&bx||bx&&!b.isFunction(bx)&&bx};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;if(e.queue==null||e.queue===true){e.queue="fx"}e.old=e.complete;e.complete=function(by){if(b.isFunction(e.old)){e.old.call(this)}if(e.queue){b.dequeue(this,e.queue)}else{if(by!==false){b._unmark(this)}}};return e},easing:{linear:function(bw,bx,e,bv){return e+bv*bw},swing:function(bw,bx,e,bv){return((-Math.cos(bw*Math.PI)/2)+0.5)*bv+e}},timers:[],fx:function(bv,e,bw){this.options=e;this.elem=bv;this.prop=bw;e.orig=e.orig||{}}});b.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bv=b.css(this.elem,this.prop);return isNaN(e=parseFloat(bv))?!bv||bv==="auto"?0:bv:e},custom:function(bz,by,bx){var e=this,bw=b.fx;this.startTime=a4||bh();this.end=by;this.now=this.start=bz;this.pos=this.state=0;this.unit=bx||this.unit||(b.cssNumber[this.prop]?"":"px");function bv(bA){return e.step(bA)}bv.queue=this.options.queue;bv.elem=this.elem;bv.saveState=function(){if(e.options.hide&&b._data(e.elem,"fxshow"+e.prop)===L){b._data(e.elem,"fxshow"+e.prop,e.start)}};if(bv()&&b.timers.push(bv)&&!a3){a3=setInterval(bw.tick,bw.interval)}},show:function(){var e=b._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||b.style(this.elem,this.prop);this.options.show=true;if(e!==L){this.custom(this.cur(),e)}else{this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur())}b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b._data(this.elem,"fxshow"+this.prop)||b.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(by){var bA,bB,bv,bx=a4||bh(),e=true,bz=this.elem,bw=this.options;if(by||bx>=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e<bv.length;e++){bw=bv[e];if(!bw()&&bv[e]===bw){bv.splice(e--,1)}}if(!bv.length){b.fx.stop()}},interval:13,stop:function(){clearInterval(a3);a3=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){b.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=e.now+e.unit}else{e.elem[e.prop]=e.now}}}});b.each(["width","height"],function(e,bv){b.fx.step[bv]=function(bw){b.style(bw.elem,bv,Math.max(0,bw.now)+bw.unit)}});if(b.expr&&b.expr.filters){b.expr.filters.animated=function(e){return b.grep(b.timers,function(bv){return e===bv.elem}).length}}function x(bx){if(!Q[bx]){var e=av.body,bv=b("<"+bx+">").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);/*! + * jQuery UI 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(a,d){a.ui=a.ui||{};if(a.ui.version){return}a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(e,f){return typeof e==="number"?this.each(function(){var g=this;setTimeout(function(){a(g).focus();if(f){f.call(g)}},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){e=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{e=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!e.length?a(document):e},zIndex:function(h){if(h!==d){return this.css("zIndex",h)}if(this.length){var f=a(this[0]),e,g;while(f.length&&f[0]!==document){e=f.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){g=parseInt(f.css("zIndex"),10);if(!isNaN(g)&&g!==0){return g}}f=f.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});a.each(["Width","Height"],function(g,e){var f=e==="Width"?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"padding"+this,true))||0;if(i){l-=parseFloat(a.curCSS(m,"border"+this+"Width",true))||0}if(n){l-=parseFloat(a.curCSS(m,"margin"+this,true))||0}});return l}a.fn["inner"+e]=function(i){if(i===d){return k["inner"+e].call(this)}return this.each(function(){a(this).css(h,j(this,i)+"px")})};a.fn["outer"+e]=function(i,l){if(typeof i!=="number"){return k["outer"+e].call(this,i)}return this.each(function(){a(this).css(h,j(this,i,true,l)+"px")})}});function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(j)?!g.disabled:"a"==j?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.extend(a.expr[":"],{data:function(g,f,e){return !!a.data(g,e[3])},focusable:function(e){return c(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}});a(function(){var e=document.body,f=e.appendChild(f=document.createElement("div"));f.offsetHeight;a.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=f.offsetHeight===100;a.support.selectstart="onselectstart" in f;e.removeChild(f).style.display="none"});a.extend(a.ui,{plugin:{add:function(f,g,j){var h=a.ui[f].prototype;for(var e in j){h.plugins[e]=h.plugins[e]||[];h.plugins[e].push([g,j[e]])}},call:function(e,g,f){var j=e.plugins[g];if(!j||!e.element[0].parentNode){return}for(var h=0;h<j.length;h++){if(e.options[j[h][0]]){j[h][1].apply(e.element,f)}}}},contains:function(f,e){return document.compareDocumentPosition?f.compareDocumentPosition(e)&16:f!==e&&f.contains(e)},hasScroll:function(h,f){if(a(h).css("overflow")==="hidden"){return false}var e=(f&&f==="left")?"scrollLeft":"scrollTop",g=false;if(h[e]>0){return true}h[e]=1;g=(h[e]>0);h[e]=0;return g},isOverAxis:function(f,e,g){return(f>e)&&(f<(e+g))},isOver:function(j,f,i,h,e,g){return a.ui.isOverAxis(j,i,e)&&a.ui.isOverAxis(f,h,g)}})})(jQuery);/*! + * jQuery UI Widget 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Widget + */ +(function(b,d){if(b.cleanData){var c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)}}else{var a=b.fn.remove;b.fn.remove=function(e,f){return this.each(function(){if(!f){if(!e||b.filter(e,[this]).length){b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(g){}})}}return a.call(b(this),e,f)})}}b.widget=function(f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])};b.widget.bridge=function(f,e){b.fn[f]=function(i){var g=typeof i==="string",h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.charAt(0)==="_"){return j}if(g){this.each(function(){var k=b.data(this,f),l=k&&b.isFunction(k[i])?k[i].apply(k,h):k;if(l!==k&&l!==d){j=l;return false}})}else{this.each(function(){var k=b.data(this,f);if(k){k.option(i||{})._init()}else{b.data(this,f,new e(i,this))}})}return j}};b.Widget=function(e,f){if(arguments.length){this._createWidget(e,f)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(f,g){b.data(g,this.widgetName,this);this.element=b(g);this.options=b.extend(true,{},this.options,this._getCreateOptions(),f);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(f,g){var e=f;if(arguments.length===0){return b.extend({},this.options)}if(typeof f==="string"){if(g===d){return this.options[f]}e={};e[f]=g}this._setOptions(e);return this},_setOptions:function(f){var e=this;b.each(f,function(g,h){e._setOption(g,h)});return this},_setOption:function(e,f){this.options[e]=f;if(e==="disabled"){this.widget()[f?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",f)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(e,f,g){var j,i,h=this.options[e];g=g||{};f=b.Event(f);f.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();f.target=this.element[0];i=f.originalEvent;if(i){for(j in i){if(!(j in f)){f[j]=i[j]}}}this.element.trigger(f,g);return !(b.isFunction(h)&&h.call(this.element[0],f,g)===false||f.isDefaultPrevented())}}})(jQuery);/*! + * jQuery UI Mouse 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Mouse + * + * Depends: + * jquery.ui.widget.js + */ +(function(b,c){var a=false;b(document).mouseup(function(d){a=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(e){return d._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(true===b.data(e.target,d.widgetName+".preventClickEvent")){b.removeData(e.target,d.widgetName+".preventClickEvent");e.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(f){if(a){return}(this._mouseStarted&&this._mouseUp(f));this._mouseDownEvent=f;var e=this,g=(f.which==1),d=(typeof this.options.cancel=="string"&&f.target.nodeName?b(f.target).closest(this.options.cancel).length:false);if(!g||d||!this._mouseCapture(f)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=(this._mouseStart(f)!==false);if(!this._mouseStarted){f.preventDefault();return true}}if(true===b.data(f.target,this.widgetName+".preventClickEvent")){b.removeData(f.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(h){return e._mouseMove(h)};this._mouseUpDelegate=function(h){return e._mouseUp(h)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);f.preventDefault();a=true;return true},_mouseMove:function(d){if(b.browser.msie&&!(document.documentMode>=9)&&!d.button){return this._mouseUp(d)}if(this._mouseStarted){this._mouseDrag(d);return d.preventDefault()}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this._mouseDrag(d):this._mouseUp(d))}return !this._mouseStarted},_mouseUp:function(d){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(d.target==this._mouseDownEvent.target){b.data(d.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(d)}return false},_mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},_mouseDelayMet:function(d){return this.mouseDelayMet},_mouseStart:function(d){},_mouseDrag:function(d){},_mouseStop:function(d){},_mouseCapture:function(d){return true}})})(jQuery);(function(c,d){c.widget("ui.resizable",c.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000},_create:function(){var f=this,k=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(k.aspectRatio),aspectRatio:k.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:k.helper||k.ghost||k.animate?k.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=k.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var l=this.handles.split(",");this.handles={};for(var g=0;g<l.length;g++){var j=c.trim(l[g]),e="ui-resizable-"+j;var h=c('<div class="ui-resizable-handle '+e+'"></div>');if(/sw|se|ne|nw/.test(j)){h.css({zIndex:++k.zIndex})}if("se"==j){h.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[j]=".ui-resizable-"+j;this.element.append(h)}}this._renderAxis=function(q){q=q||this.element;for(var n in this.handles){if(this.handles[n].constructor==String){this.handles[n]=c(this.handles[n],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var o=c(this.handles[n],this.element),p=0;p=/sw|ne|nw|se|n|s/.test(n)?o.outerHeight():o.outerWidth();var m=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");q.css(m,p);this._proportionallyResize()}if(!c(this.handles[n]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!f.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}f.axis=i&&i[1]?i[1]:"se"}});if(k.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){if(k.disabled){return}c(this).removeClass("ui-resizable-autohide");f._handles.show()},function(){if(k.disabled){return}if(!f.resizing){c(this).addClass("ui-resizable-autohide");f._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var e=function(g){c(g).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){e(this.element);var f=this.element;f.after(this.originalElement.css({position:f.css("position"),width:f.outerWidth(),height:f.outerHeight(),top:f.css("top"),left:f.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);e(this.originalElement);return this},_mouseCapture:function(f){var g=false;for(var e in this.handles){if(c(this.handles[e])[0]==f.target){g=true}}return !this.options.disabled&&g},_mouseStart:function(g){var j=this.options,f=this.element.position(),e=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(e.is(".ui-draggable")||(/absolute/).test(e.css("position"))){e.css({position:"absolute",top:f.top,left:f.left})}this._renderProxy();var k=b(this.helper.css("left")),h=b(this.helper.css("top"));if(j.containment){k+=c(j.containment).scrollLeft()||0;h+=c(j.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:k,top:h};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:k,top:h};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:g.pageX,top:g.pageY};this.aspectRatio=(typeof j.aspectRatio=="number")?j.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var i=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",i=="auto"?this.axis+"-resize":i);e.addClass("ui-resizable-resizing");this._propagate("start",g);return true},_mouseDrag:function(e){var h=this.helper,g=this.options,m={},q=this,j=this.originalMousePosition,n=this.axis;var r=(e.pageX-j.left)||0,p=(e.pageY-j.top)||0;var i=this._change[n];if(!i){return false}var l=i.apply(this,[e,r,p]),k=c.browser.msie&&c.browser.version<7,f=this.sizeDiff;this._updateVirtualBoundaries(e.shiftKey);if(this._aspectRatio||e.shiftKey){l=this._updateRatio(l,e)}l=this._respectSize(l,e);this._propagate("resize",e);h.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(l);this._trigger("resize",e,this.ui());return false},_mouseStop:function(h){this.resizing=false;var i=this.options,m=this;if(this._helper){var g=this._proportionallyResizeElements,e=g.length&&(/textarea/i).test(g[0].nodeName),f=e&&c.ui.hasScroll(g[0],"left")?0:m.sizeDiff.height,k=e?0:m.sizeDiff.width;var n={width:(m.helper.width()-k),height:(m.helper.height()-f)},j=(parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left))||null,l=(parseInt(m.element.css("top"),10)+(m.position.top-m.originalPosition.top))||null;if(!i.animate){this.element.css(c.extend(n,{top:l,left:j}))}m.helper.height(m.size.height);m.helper.width(m.size.width);if(this._helper&&!i.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",h);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(g){var j=this.options,i,h,f,k,e;e={minWidth:a(j.minWidth)?j.minWidth:0,maxWidth:a(j.maxWidth)?j.maxWidth:Infinity,minHeight:a(j.minHeight)?j.minHeight:0,maxHeight:a(j.maxHeight)?j.maxHeight:Infinity};if(this._aspectRatio||g){i=e.minHeight*this.aspectRatio;f=e.minWidth/this.aspectRatio;h=e.maxHeight*this.aspectRatio;k=e.maxWidth/this.aspectRatio;if(i>e.minWidth){e.minWidth=i}if(f>e.minHeight){e.minHeight=f}if(h<e.maxWidth){e.maxWidth=h}if(k<e.maxHeight){e.maxHeight=k}}this._vBoundaries=e},_updateCache:function(e){var f=this.options;this.offset=this.helper.offset();if(a(e.left)){this.position.left=e.left}if(a(e.top)){this.position.top=e.top}if(a(e.height)){this.size.height=e.height}if(a(e.width)){this.size.width=e.width}},_updateRatio:function(h,g){var i=this.options,j=this.position,f=this.size,e=this.axis;if(a(h.height)){h.width=(h.height*this.aspectRatio)}else{if(a(h.width)){h.height=(h.width/this.aspectRatio)}}if(e=="sw"){h.left=j.left+(f.width-h.width);h.top=null}if(e=="nw"){h.top=j.top+(f.height-h.height);h.left=j.left+(f.width-h.width)}return h},_respectSize:function(l,g){var j=this.helper,i=this._vBoundaries,r=this._aspectRatio||g.shiftKey,q=this.axis,t=a(l.width)&&i.maxWidth&&(i.maxWidth<l.width),m=a(l.height)&&i.maxHeight&&(i.maxHeight<l.height),h=a(l.width)&&i.minWidth&&(i.minWidth>l.width),s=a(l.height)&&i.minHeight&&(i.minHeight>l.height);if(h){l.width=i.minWidth}if(s){l.height=i.minHeight}if(t){l.width=i.maxWidth}if(m){l.height=i.maxHeight}var f=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height;var k=/sw|nw|w/.test(q),e=/nw|ne|n/.test(q);if(h&&k){l.left=f-i.minWidth}if(t&&k){l.left=f-i.maxWidth}if(s&&e){l.top=p-i.minHeight}if(m&&e){l.top=p-i.maxHeight}var n=!l.width&&!l.height;if(n&&!l.left&&l.top){l.top=null}else{if(n&&!l.top&&l.left){l.left=null}}return l},_proportionallyResize:function(){var k=this.options;if(!this._proportionallyResizeElements.length){return}var g=this.helper||this.element;for(var f=0;f<this._proportionallyResizeElements.length;f++){var h=this._proportionallyResizeElements[f];if(!this.borderDif){var e=[h.css("borderTopWidth"),h.css("borderRightWidth"),h.css("borderBottomWidth"),h.css("borderLeftWidth")],j=[h.css("paddingTop"),h.css("paddingRight"),h.css("paddingBottom"),h.css("paddingLeft")];this.borderDif=c.map(e,function(l,n){var m=parseInt(l,10)||0,o=parseInt(j[n],10)||0;return m+o})}if(c.browser.msie&&!(!(c(g).is(":hidden")||c(g).parents(":hidden").length))){continue}h.css({height:(g.height()-this.borderDif[0]-this.borderDif[2])||0,width:(g.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var f=this.element,i=this.options;this.elementOffset=f.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var e=c.browser.msie&&c.browser.version<7,g=(e?1:0),h=(e?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+h,height:this.element.outerHeight()+h,position:"absolute",left:this.elementOffset.left-g+"px",top:this.elementOffset.top-g+"px",zIndex:++i.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(g,f,e){return{width:this.originalSize.width+f}},w:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{left:i.left+f,width:g.width-f}},n:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{top:i.top+e,height:g.height-e}},s:function(g,f,e){return{height:this.originalSize.height+e}},se:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},sw:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[g,f,e]))},ne:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},nw:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[g,f,e]))}},_propagate:function(f,e){c.ui.plugin.call(this,f,[e,this.ui()]);(f!="resize"&&this._trigger(f,e,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});c.extend(c.ui.resizable,{version:"1.8.18"});c.ui.plugin.add("resizable","alsoResize",{start:function(f,g){var e=c(this).data("resizable"),i=e.options;var h=function(j){c(j).each(function(){var k=c(this);k.data("resizable-alsoresize",{width:parseInt(k.width(),10),height:parseInt(k.height(),10),left:parseInt(k.css("left"),10),top:parseInt(k.css("top"),10)})})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.parentNode){if(i.alsoResize.length){i.alsoResize=i.alsoResize[0];h(i.alsoResize)}else{c.each(i.alsoResize,function(j){h(j)})}}else{h(i.alsoResize)}},resize:function(g,i){var f=c(this).data("resizable"),j=f.options,h=f.originalSize,l=f.originalPosition;var k={height:(f.size.height-h.height)||0,width:(f.size.width-h.width)||0,top:(f.position.top-l.top)||0,left:(f.position.left-l.left)||0},e=function(m,n){c(m).each(function(){var q=c(this),r=c(this).data("resizable-alsoresize"),p={},o=n&&n.length?n:q.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];c.each(o,function(s,u){var t=(r[u]||0)+(k[u]||0);if(t&&t>=0){p[u]=t||null}});q.css(p)})};if(typeof(j.alsoResize)=="object"&&!j.alsoResize.nodeType){c.each(j.alsoResize,function(m,n){e(m,n)})}else{e(j.alsoResize)}},stop:function(e,f){c(this).removeData("resizable-alsoresize")}});c.ui.plugin.add("resizable","animate",{stop:function(i,n){var p=c(this).data("resizable"),j=p.options;var h=p._proportionallyResizeElements,e=h.length&&(/textarea/i).test(h[0].nodeName),f=e&&c.ui.hasScroll(h[0],"left")?0:p.sizeDiff.height,l=e?0:p.sizeDiff.width;var g={width:(p.size.width-l),height:(p.size.height-f)},k=(parseInt(p.element.css("left"),10)+(p.position.left-p.originalPosition.left))||null,m=(parseInt(p.element.css("top"),10)+(p.position.top-p.originalPosition.top))||null;p.element.animate(c.extend(g,m&&k?{top:m,left:k}:{}),{duration:j.animateDuration,easing:j.animateEasing,step:function(){var o={width:parseInt(p.element.css("width"),10),height:parseInt(p.element.css("height"),10),top:parseInt(p.element.css("top"),10),left:parseInt(p.element.css("left"),10)};if(h&&h.length){c(h[0]).css({width:o.width,height:o.height})}p._updateCache(o);p._propagate("resize",i)}})}});c.ui.plugin.add("resizable","containment",{start:function(f,r){var t=c(this).data("resizable"),j=t.options,l=t.element;var g=j.containment,k=(g instanceof c)?g.get(0):(/parent/.test(g))?l.parent().get(0):g;if(!k){return}t.containerElement=c(k);if(/document/.test(g)||g==document){t.containerOffset={left:0,top:0};t.containerPosition={left:0,top:0};t.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var n=c(k),i=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){i[p]=b(n.css("padding"+o))});t.containerOffset=n.offset();t.containerPosition=n.position();t.containerSize={height:(n.innerHeight()-i[3]),width:(n.innerWidth()-i[1])};var q=t.containerOffset,e=t.containerSize.height,m=t.containerSize.width,h=(c.ui.hasScroll(k,"left")?k.scrollWidth:m),s=(c.ui.hasScroll(k)?k.scrollHeight:e);t.parentData={element:k,left:q.left,top:q.top,width:h,height:s}}},resize:function(g,q){var t=c(this).data("resizable"),i=t.options,f=t.containerSize,p=t.containerOffset,m=t.size,n=t.position,r=t._aspectRatio||g.shiftKey,e={top:0,left:0},h=t.containerElement;if(h[0]!=document&&(/static/).test(h.css("position"))){e=p}if(n.left<(t._helper?p.left:0)){t.size.width=t.size.width+(t._helper?(t.position.left-p.left):(t.position.left-e.left));if(r){t.size.height=t.size.width/i.aspectRatio}t.position.left=i.helper?p.left:0}if(n.top<(t._helper?p.top:0)){t.size.height=t.size.height+(t._helper?(t.position.top-p.top):t.position.top);if(r){t.size.width=t.size.height*i.aspectRatio}t.position.top=t._helper?p.top:0}t.offset.left=t.parentData.left+t.position.left;t.offset.top=t.parentData.top+t.position.top;var l=Math.abs((t._helper?t.offset.left-e.left:(t.offset.left-e.left))+t.sizeDiff.width),s=Math.abs((t._helper?t.offset.top-e.top:(t.offset.top-p.top))+t.sizeDiff.height);var k=t.containerElement.get(0)==t.element.parent().get(0),j=/relative|absolute/.test(t.containerElement.css("position"));if(k&&j){l-=t.parentData.left}if(l+t.size.width>=t.parentData.width){t.size.width=t.parentData.width-l;if(r){t.size.height=t.size.width/t.aspectRatio}}if(s+t.size.height>=t.parentData.height){t.size.height=t.parentData.height-s;if(r){t.size.width=t.size.height*t.aspectRatio}}},stop:function(f,n){var q=c(this).data("resizable"),g=q.options,l=q.position,m=q.containerOffset,e=q.containerPosition,i=q.containerElement;var j=c(q.helper),r=j.offset(),p=j.outerWidth()-q.sizeDiff.width,k=j.outerHeight()-q.sizeDiff.height;if(q._helper&&!g.animate&&(/relative/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}if(q._helper&&!g.animate&&(/static/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}}});c.ui.plugin.add("resizable","ghost",{start:function(g,h){var e=c(this).data("resizable"),i=e.options,f=e.size;e.ghost=e.originalElement.clone();e.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:"");e.ghost.appendTo(e.helper)},resize:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost){e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})}},stop:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost&&e.helper){e.helper.get(0).removeChild(e.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(e,m){var p=c(this).data("resizable"),h=p.options,k=p.size,i=p.originalSize,j=p.originalPosition,n=p.axis,l=h._aspectRatio||e.shiftKey;h.grid=typeof h.grid=="number"?[h.grid,h.grid]:h.grid;var g=Math.round((k.width-i.width)/(h.grid[0]||1))*(h.grid[0]||1),f=Math.round((k.height-i.height)/(h.grid[1]||1))*(h.grid[1]||1);if(/^(se|s|e)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f}else{if(/^(ne)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f}else{if(/^(sw)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.left=j.left-g}else{p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f;p.position.left=j.left-g}}}}});var b=function(e){return parseInt(e,10)||0};var a=function(e){return !isNaN(parseInt(e,10))}})(jQuery);/*! + * jQuery hashchange event - v1.3 - 7/21/2010 + * http://benalman.com/projects/jquery-hashchange-plugin/ + * + * Copyright (c) 2010 "Cowboy" Ben Alman + * Dual licensed under the MIT and GPL licenses. + * http://benalman.com/about/license/ + */ +(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1};a.window=function(d){return c(window)._scrollable()};c.fn._scrollable=function(){return this.map(function(){var e=this,d=!e.nodeName||c.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!d){return e}var f=(e.contentWindow||e).document||e.ownerDocument||e;return c.browser.safari||f.compatMode=="BackCompat"?f.body:f.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this._scrollable().each(function(){var l=this,j=c(l),k=f,i,g={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}k=c(k,this);case"object":if(k.is||k.style){i=(k=c(k)).offset()}}c.each(d.axis.split(""),function(q,r){var s=r=="x"?"Left":"Top",u=s.toLowerCase(),p="scroll"+s,o=l[p],n=a.max(l,r);if(i){g[p]=i[u]+(m?0:o-j.offset()[u]);if(d.margin){g[p]-=parseInt(k.css("margin"+s))||0;g[p]-=parseInt(k.css("border"+s+"Width"))||0}g[p]+=d.offset[u]||0;if(d.over[u]){g[p]+=k[r=="x"?"width":"height"]()*d.over[u]}}else{var t=k[u];g[p]=t.slice&&t.slice(-1)=="%"?parseFloat(t)/100*n:t}if(/^\d+$/.test(g[p])){g[p]=g[p]<=0?0:Math.min(g[p],n)}if(!q&&d.queue){if(o!=g[p]){h(d.onAfterFirst)}delete g[p]}});h(d.onAfter);function h(n){j.animate(g,e,d.easing,n&&function(){n.call(this,f,d)})}}).end()};a.max=function(j,i){var h=i=="x"?"Width":"Height",e="scroll"+h;if(!c(j).is("html,body")){return j[e]-c(j)[h.toLowerCase()]()}var g="client"+h,f=j.ownerDocument.documentElement,d=j.ownerDocument.body;return Math.max(f[e],d[e])-Math.min(f[g],d[g])};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);/*! + PowerTip - v1.2.0 - 2013-04-03 + http://stevenbenner.github.com/jquery-powertip/ + Copyright (c) 2013 Steven Benner (http://stevenbenner.com/). + Released under MIT license. + https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt +*/ +(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(k){var A=k(document),s=k(window),w=k("body");var n="displayController",e="hasActiveHover",d="forcedOpen",u="hasMouseMove",f="mouseOnToPopup",g="originalTitle",y="powertip",o="powertipjq",l="powertiptarget",E=180/Math.PI;var c={isTipOpen:false,isFixedTipOpen:false,isClosing:false,tipOpenImminent:false,activeHover:null,currentX:0,currentY:0,previousX:0,previousY:0,desyncTimeout:null,mouseTrackingActive:false,delayInProgress:false,windowWidth:0,windowHeight:0,scrollTop:0,scrollLeft:0};var p={none:0,top:1,bottom:2,left:4,right:8};k.fn.powerTip=function(F,N){if(!this.length){return this}if(k.type(F)==="string"&&k.powerTip[F]){return k.powerTip[F].call(this,this,N)}var O=k.extend({},k.fn.powerTip.defaults,F),G=new x(O);h();this.each(function M(){var R=k(this),Q=R.data(y),P=R.data(o),T=R.data(l),S;if(R.data(n)){k.powerTip.destroy(R)}S=R.attr("title");if(!Q&&!T&&!P&&S){R.data(y,S);R.data(g,S);R.removeAttr("title")}R.data(n,new t(R,O,G))});if(!O.manual){this.on({"mouseenter.powertip":function J(P){k.powerTip.show(this,P)},"mouseleave.powertip":function L(){k.powerTip.hide(this)},"focus.powertip":function K(){k.powerTip.show(this)},"blur.powertip":function H(){k.powerTip.hide(this,true)},"keydown.powertip":function I(P){if(P.keyCode===27){k.powerTip.hide(this,true)}}})}return this};k.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false};k.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};k.powerTip={show:function z(F,G){if(G){i(G);c.previousX=G.pageX;c.previousY=G.pageY;k(F).data(n).show()}else{k(F).first().data(n).show(true,true)}return F},reposition:function r(F){k(F).first().data(n).resetPosition();return F},hide:function D(G,F){if(G){k(G).first().data(n).hide(F)}else{if(c.activeHover){c.activeHover.data(n).hide(true)}}return G},destroy:function C(G){k(G).off(".powertip").each(function F(){var I=k(this),H=[g,n,e,d];if(I.data(g)){I.attr("title",I.data(g));H.push(y)}I.removeData(H)});return G}};k.powerTip.showTip=k.powerTip.show;k.powerTip.closeTip=k.powerTip.hide;function b(){var F=this;F.top="auto";F.left="auto";F.right="auto";F.bottom="auto";F.set=function(H,G){if(k.isNumeric(G)){F[H]=Math.round(G)}}}function t(K,N,F){var J=null;function L(P,Q){M();if(!K.data(e)){if(!P){c.tipOpenImminent=true;J=setTimeout(function O(){J=null;I()},N.intentPollInterval)}else{if(Q){K.data(d,true)}F.showTip(K)}}}function G(P){M();c.tipOpenImminent=false;if(K.data(e)){K.data(d,false);if(!P){c.delayInProgress=true;J=setTimeout(function O(){J=null;F.hideTip(K);c.delayInProgress=false},N.closeDelay)}else{F.hideTip(K)}}}function I(){var Q=Math.abs(c.previousX-c.currentX),O=Math.abs(c.previousY-c.currentY),P=Q+O;if(P<N.intentSensitivity){F.showTip(K)}else{c.previousX=c.currentX;c.previousY=c.currentY;L()}}function M(){J=clearTimeout(J);c.delayInProgress=false}function H(){F.resetPosition(K)}this.show=L;this.hide=G;this.cancel=M;this.resetPosition=H}function j(){function G(M,L,J,O,P){var K=L.split("-")[0],N=new b(),I;if(q(M)){I=H(M,K)}else{I=F(M,K)}switch(L){case"n":N.set("left",I.left-(J/2));N.set("bottom",c.windowHeight-I.top+P);break;case"e":N.set("left",I.left+P);N.set("top",I.top-(O/2));break;case"s":N.set("left",I.left-(J/2));N.set("top",I.top+P);break;case"w":N.set("top",I.top-(O/2));N.set("right",c.windowWidth-I.left+P);break;case"nw":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"nw-alt":N.set("left",I.left);N.set("bottom",c.windowHeight-I.top+P);break;case"ne":N.set("left",I.left-20);N.set("bottom",c.windowHeight-I.top+P);break;case"ne-alt":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left);break;case"sw":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"sw-alt":N.set("left",I.left);N.set("top",I.top+P);break;case"se":N.set("left",I.left-20);N.set("top",I.top+P);break;case"se-alt":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left);break}return N}function F(K,J){var O=K.offset(),N=K.outerWidth(),I=K.outerHeight(),M,L;switch(J){case"n":M=O.left+N/2;L=O.top;break;case"e":M=O.left+N;L=O.top+I/2;break;case"s":M=O.left+N/2;L=O.top+I;break;case"w":M=O.left;L=O.top+I/2;break;case"nw":M=O.left;L=O.top;break;case"ne":M=O.left+N;L=O.top;break;case"sw":M=O.left;L=O.top+I;break;case"se":M=O.left+N;L=O.top+I;break}return{top:L,left:M}}function H(O,K){var S=O.closest("svg")[0],N=O[0],W=S.createSVGPoint(),L=N.getBBox(),V=N.getScreenCTM(),M=L.width/2,Q=L.height/2,P=[],I=["nw","n","ne","e","se","s","sw","w"],U,X,R,T;function J(){P.push(W.matrixTransform(V))}W.x=L.x;W.y=L.y;J();W.x+=M;J();W.x+=M;J();W.y+=Q;J();W.y+=Q;J();W.x-=M;J();W.x-=M;J();W.y-=Q;J();if(P[0].y!==P[1].y||P[0].x!==P[7].x){X=Math.atan2(V.b,V.a)*E;R=Math.ceil(((X%360)-22.5)/45);if(R<1){R+=8}while(R--){I.push(I.shift())}}for(T=0;T<P.length;T++){if(I[T]===K){U=P[T];break}}return{top:U.y+c.scrollTop,left:U.x+c.scrollLeft}}this.compute=G}function x(Q){var P=new j(),O=k("#"+Q.popupId);if(O.length===0){O=k("<div/>",{id:Q.popupId});if(w.length===0){w=k("body")}w.append(O)}if(Q.followMouse){if(!O.data(u)){A.on("mousemove",M);s.on("scroll",M);O.data(u,true)}}if(Q.mouseOnToPopup){O.on({mouseenter:function L(){if(O.data(f)){if(c.activeHover){c.activeHover.data(n).cancel()}}},mouseleave:function N(){if(c.activeHover){c.activeHover.data(n).hide()}}})}function I(S){S.data(e,true);O.queue(function R(T){H(S);T()})}function H(S){var U;if(!S.data(e)){return}if(c.isTipOpen){if(!c.isClosing){K(c.activeHover)}O.delay(100).queue(function R(V){H(S);V()});return}S.trigger("powerTipPreRender");U=B(S);if(U){O.empty().append(U)}else{return}S.trigger("powerTipRender");c.activeHover=S;c.isTipOpen=true;O.data(f,Q.mouseOnToPopup);if(!Q.followMouse){G(S);c.isFixedTipOpen=true}else{M()}O.fadeIn(Q.fadeInTime,function T(){if(!c.desyncTimeout){c.desyncTimeout=setInterval(J,500)}S.trigger("powerTipOpen")})}function K(R){c.isClosing=true;c.activeHover=null;c.isTipOpen=false;c.desyncTimeout=clearInterval(c.desyncTimeout);R.data(e,false);R.data(d,false);O.fadeOut(Q.fadeOutTime,function S(){var T=new b();c.isClosing=false;c.isFixedTipOpen=false;O.removeClass();T.set("top",c.currentY+Q.offset);T.set("left",c.currentX+Q.offset);O.css(T);R.trigger("powerTipClose")})}function M(){if(!c.isFixedTipOpen&&(c.isTipOpen||(c.tipOpenImminent&&O.data(u)))){var R=O.outerWidth(),V=O.outerHeight(),U=new b(),S,T;U.set("top",c.currentY+Q.offset);U.set("left",c.currentX+Q.offset);S=m(U,R,V);if(S!==p.none){T=a(S);if(T===1){if(S===p.right){U.set("left",c.windowWidth-R)}else{if(S===p.bottom){U.set("top",c.scrollTop+c.windowHeight-V)}}}else{U.set("left",c.currentX-R-Q.offset);U.set("top",c.currentY-V-Q.offset)}}O.css(U)}}function G(S){var R,T;if(Q.smartPlacement){R=k.fn.powerTip.smartPlacementLists[Q.placement];k.each(R,function(U,W){var V=m(F(S,W),O.outerWidth(),O.outerHeight());T=W;if(V===p.none){return false}})}else{F(S,Q.placement);T=Q.placement}O.addClass(T)}function F(U,T){var R=0,S,W,V=new b();V.set("top",0);V.set("left",0);O.css(V);do{S=O.outerWidth();W=O.outerHeight();V=P.compute(U,T,S,W,Q.offset);O.css(V)}while(++R<=5&&(S!==O.outerWidth()||W!==O.outerHeight()));return V}function J(){var R=false;if(c.isTipOpen&&!c.isClosing&&!c.delayInProgress){if(c.activeHover.data(e)===false||c.activeHover.is(":disabled")){R=true}else{if(!v(c.activeHover)&&!c.activeHover.is(":focus")&&!c.activeHover.data(d)){if(O.data(f)){if(!v(O)){R=true}}else{R=true}}}if(R){K(c.activeHover)}}}this.showTip=I;this.hideTip=K;this.resetPosition=G}function q(F){return window.SVGElement&&F[0] instanceof SVGElement}function h(){if(!c.mouseTrackingActive){c.mouseTrackingActive=true;k(function H(){c.scrollLeft=s.scrollLeft();c.scrollTop=s.scrollTop();c.windowWidth=s.width();c.windowHeight=s.height()});A.on("mousemove",i);s.on({resize:function G(){c.windowWidth=s.width();c.windowHeight=s.height()},scroll:function F(){var I=s.scrollLeft(),J=s.scrollTop();if(I!==c.scrollLeft){c.currentX+=I-c.scrollLeft;c.scrollLeft=I}if(J!==c.scrollTop){c.currentY+=J-c.scrollTop;c.scrollTop=J}}})}}function i(F){c.currentX=F.pageX;c.currentY=F.pageY}function v(F){var H=F.offset(),J=F[0].getBoundingClientRect(),I=J.right-J.left,G=J.bottom-J.top;return c.currentX>=H.left&&c.currentX<=H.left+I&&c.currentY>=H.top&&c.currentY<=H.top+G}function B(I){var G=I.data(y),F=I.data(o),K=I.data(l),H,J;if(G){if(k.isFunction(G)){G=G.call(I[0])}J=G}else{if(F){if(k.isFunction(F)){F=F.call(I[0])}if(F.length>0){J=F.clone(true,true)}}else{if(K){H=k("#"+K);if(H.length>0){J=H.html()}}}}return J}function m(M,L,K){var G=c.scrollTop,J=c.scrollLeft,I=G+c.windowHeight,F=J+c.windowWidth,H=p.none;if(M.top<G||Math.abs(M.bottom-c.windowHeight)-K<G){H|=p.top}if(M.top+K>I||Math.abs(M.bottom-c.windowHeight)>I){H|=p.bottom}if(M.left<J||M.right+L>F){H|=p.left}if(M.left+L>F||M.right<J){H|=p.right}return H}function a(G){var F=0;while(G){G&=G-1;F++}return F}}));/*! + * jQuery UI Touch Punch 0.2.3 + * + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return}var d=b.ui.mouse.prototype,f=d._mouseInit,c=d._mouseDestroy,a;function e(h,i){if(h.originalEvent.touches.length>1){return}h.preventDefault();var j=h.originalEvent.changedTouches[0],g=document.createEvent("MouseEvents");g.initMouseEvent(i,true,true,window,1,j.screenX,j.screenY,j.clientX,j.clientY,false,false,false,false,0,null);h.target.dispatchEvent(g)}d._touchStart=function(h){var g=this;if(a||!g._mouseCapture(h.originalEvent.changedTouches[0])){return}a=true;g._touchMoved=false;e(h,"mouseover");e(h,"mousemove");e(h,"mousedown")};d._touchMove=function(g){if(!a){return}this._touchMoved=true;e(g,"mousemove")};d._touchEnd=function(g){if(!a){return}e(g,"mouseup");e(g,"mouseout");if(!this._touchMoved){e(g,"click")}a=false};d._mouseInit=function(){var g=this;g.element.bind({touchstart:b.proxy(g,"_touchStart"),touchmove:b.proxy(g,"_touchMove"),touchend:b.proxy(g,"_touchEnd")});f.call(g)};d._mouseDestroy=function(){var g=this;g.element.unbind({touchstart:b.proxy(g,"_touchStart"),touchmove:b.proxy(g,"_touchMove"),touchend:b.proxy(g,"_touchEnd")});c.call(g)}})(jQuery);/*! + * SmartMenus jQuery Plugin - v1.0.0 - January 27, 2016 + * http://www.smartmenus.org/ + * + * Copyright Vasil Dinkov, Vadikom Web Ltd. + * http://vadikom.com + * + * Licensed MIT + */ +(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module==="object"&&typeof module.exports==="object"){module.exports=a(require("jquery"))}else{a(jQuery)}}}(function(a){var b=[],e=!!window.createPopup,f=false,d="ontouchstart" in window,h=false,g=window.requestAnimationFrame||function(l){return setTimeout(l,1000/60)},c=window.cancelAnimationFrame||function(l){clearTimeout(l)};function k(m){var n=".smartmenus_mouse";if(!h&&!m){var o=true,l=null;a(document).bind(i([["mousemove",function(s){var t={x:s.pageX,y:s.pageY,timeStamp:new Date().getTime()};if(l){var q=Math.abs(l.x-t.x),p=Math.abs(l.y-t.y);if((q>0||p>0)&&q<=2&&p<=2&&t.timeStamp-l.timeStamp<=300){f=true;if(o){var r=a(s.target).closest("a");if(r.is("a")){a.each(b,function(){if(a.contains(this.$root[0],r[0])){this.itemEnter({currentTarget:r[0]});return false}})}o=false}}}l=t}],[d?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut",function(p){if(j(p.originalEvent)){f=false}}]],n));h=true}else{if(h&&m){a(document).unbind(n);h=false}}}function j(l){return !/^(4|mouse)$/.test(l.pointerType)}function i(l,n){if(!n){n=""}var m={};a.each(l,function(o,p){m[p[0].split(" ").join(n+" ")+n]=p[1]});return m}a.SmartMenus=function(m,l){this.$root=a(m);this.opts=l;this.rootId="";this.accessIdPrefix="";this.$subArrow=null;this.activatedItems=[];this.visibleSubMenus=[];this.showTimeout=0;this.hideTimeout=0;this.scrollTimeout=0;this.clickActivated=false;this.focusActivated=false;this.zIndexInc=0;this.idInc=0;this.$firstLink=null;this.$firstSub=null;this.disabled=false;this.$disableOverlay=null;this.$touchScrollingSub=null;this.cssTransforms3d="perspective" in m.style||"webkitPerspective" in m.style;this.wasCollapsible=false;this.init()};a.extend(a.SmartMenus,{hideAll:function(){a.each(b,function(){this.menuHideAll()})},destroy:function(){while(b.length){b[0].destroy()}k(true)},prototype:{init:function(n){var l=this;if(!n){b.push(this);this.rootId=(new Date().getTime()+Math.random()+"").replace(/\D/g,"");this.accessIdPrefix="sm-"+this.rootId+"-";if(this.$root.hasClass("sm-rtl")){this.opts.rightToLeftSubMenus=true}var r=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).bind(i([["mouseover focusin",a.proxy(this.rootOver,this)],["mouseout focusout",a.proxy(this.rootOut,this)],["keydown",a.proxy(this.rootKeyDown,this)]],r)).delegate("a",i([["mouseenter",a.proxy(this.itemEnter,this)],["mouseleave",a.proxy(this.itemLeave,this)],["mousedown",a.proxy(this.itemDown,this)],["focus",a.proxy(this.itemFocus,this)],["blur",a.proxy(this.itemBlur,this)],["click",a.proxy(this.itemClick,this)]],r));r+=this.rootId;if(this.opts.hideOnClick){a(document).bind(i([["touchstart",a.proxy(this.docTouchStart,this)],["touchmove",a.proxy(this.docTouchMove,this)],["touchend",a.proxy(this.docTouchEnd,this)],["click",a.proxy(this.docClick,this)]],r))}a(window).bind(i([["resize orientationchange",a.proxy(this.winResize,this)]],r));if(this.opts.subIndicators){this.$subArrow=a("<span/>").addClass("sub-arrow");if(this.opts.subIndicatorsText){this.$subArrow.html(this.opts.subIndicatorsText)}}k()}this.$firstSub=this.$root.find("ul").each(function(){l.menuInit(a(this))}).eq(0);this.$firstLink=this.$root.find("a").eq(0);if(this.opts.markCurrentItem){var p=/(index|default)\.[^#\?\/]*/i,m=/#.*/,q=window.location.href.replace(p,""),o=q.replace(m,"");this.$root.find("a").each(function(){var s=this.href.replace(p,""),t=a(this);if(s==q||s==o){t.addClass("current");if(l.opts.markCurrentTree){t.parentsUntil("[data-smartmenus-id]","ul").each(function(){a(this).dataSM("parent-a").addClass("current")})}}})}this.wasCollapsible=this.isCollapsible()},destroy:function(m){if(!m){var n=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").unbind(n).undelegate(n);n+=this.rootId;a(document).unbind(n);a(window).unbind(n);if(this.opts.subIndicators){this.$subArrow=null}}this.menuHideAll();var l=this;this.$root.find("ul").each(function(){var o=a(this);if(o.dataSM("scroll-arrows")){o.dataSM("scroll-arrows").remove()}if(o.dataSM("shown-before")){if(l.opts.subMenusMinWidth||l.opts.subMenusMaxWidth){o.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap")}if(o.dataSM("scroll-arrows")){o.dataSM("scroll-arrows").remove()}o.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})}if((o.attr("id")||"").indexOf(l.accessIdPrefix)==0){o.removeAttr("id")}}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("ie-shim").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded");this.$root.find("a.has-submenu").each(function(){var o=a(this);if(o.attr("id").indexOf(l.accessIdPrefix)==0){o.removeAttr("id")}}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub");if(this.opts.subIndicators){this.$root.find("span.sub-arrow").remove()}if(this.opts.markCurrentItem){this.$root.find("a.current").removeClass("current")}if(!m){this.$root=null;this.$firstLink=null;this.$firstSub=null;if(this.$disableOverlay){this.$disableOverlay.remove();this.$disableOverlay=null}b.splice(a.inArray(this,b),1)}},disable:function(l){if(!this.disabled){this.menuHideAll();if(!l&&!this.opts.isPopup&&this.$root.is(":visible")){var m=this.$root.offset();this.$disableOverlay=a('<div class="sm-jquery-disable-overlay"/>').css({position:"absolute",top:m.top,left:m.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(true),opacity:0}).appendTo(document.body)}this.disabled=true}},docClick:function(l){if(this.$touchScrollingSub){this.$touchScrollingSub=null;return}if(this.visibleSubMenus.length&&!a.contains(this.$root[0],l.target)||a(l.target).is("a")){this.menuHideAll()}},docTouchEnd:function(m){if(!this.lastTouch){return}if(this.visibleSubMenus.length&&(this.lastTouch.x2===undefined||this.lastTouch.x1==this.lastTouch.x2)&&(this.lastTouch.y2===undefined||this.lastTouch.y1==this.lastTouch.y2)&&(!this.lastTouch.target||!a.contains(this.$root[0],this.lastTouch.target))){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}var l=this;this.hideTimeout=setTimeout(function(){l.menuHideAll()},350)}this.lastTouch=null},docTouchMove:function(m){if(!this.lastTouch){return}var l=m.originalEvent.touches[0];this.lastTouch.x2=l.pageX;this.lastTouch.y2=l.pageY},docTouchStart:function(m){var l=m.originalEvent.touches[0];this.lastTouch={x1:l.pageX,y1:l.pageY,target:l.target}},enable:function(){if(this.disabled){if(this.$disableOverlay){this.$disableOverlay.remove();this.$disableOverlay=null}this.disabled=false}},getClosestMenu:function(m){var l=a(m).closest("ul");while(l.dataSM("in-mega")){l=l.parent().closest("ul")}return l[0]||null},getHeight:function(l){return this.getOffset(l,true)},getOffset:function(n,l){var m;if(n.css("display")=="none"){m={position:n[0].style.position,visibility:n[0].style.visibility};n.css({position:"absolute",visibility:"hidden"}).show()}var o=n[0].getBoundingClientRect&&n[0].getBoundingClientRect(),p=o&&(l?o.height||o.bottom-o.top:o.width||o.right-o.left);if(!p&&p!==0){p=l?n[0].offsetHeight:n[0].offsetWidth}if(m){n.hide().css(m)}return p},getStartZIndex:function(l){var m=parseInt(this[l?"$root":"$firstSub"].css("z-index"));if(!l&&isNaN(m)){m=parseInt(this.$root.css("z-index"))}return !isNaN(m)?m:1},getTouchPoint:function(l){return l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0]||l},getViewport:function(l){var m=l?"Height":"Width",o=document.documentElement["client"+m],n=window["inner"+m];if(n){o=Math.min(o,n)}return o},getViewportHeight:function(){return this.getViewport(true)},getViewportWidth:function(){return this.getViewport()},getWidth:function(l){return this.getOffset(l)},handleEvents:function(){return !this.disabled&&this.isCSSOn()},handleItemEvents:function(l){return this.handleEvents()&&!this.isLinkInMegaMenu(l)},isCollapsible:function(){return this.$firstSub.css("position")=="static"},isCSSOn:function(){return this.$firstLink.css("display")=="block"},isFixed:function(){var l=this.$root.css("position")=="fixed";if(!l){this.$root.parentsUntil("body").each(function(){if(a(this).css("position")=="fixed"){l=true;return false}})}return l},isLinkInMegaMenu:function(l){return a(this.getClosestMenu(l[0])).hasClass("mega-menu")},isTouchMode:function(){return !f||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(p,l){var n=p.closest("ul"),q=n.dataSM("level");if(q>1&&(!this.activatedItems[q-2]||this.activatedItems[q-2][0]!=n.dataSM("parent-a")[0])){var m=this;a(n.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(n).each(function(){m.itemActivate(a(this).dataSM("parent-a"))})}if(!this.isCollapsible()||l){this.menuHideSubMenus(!this.activatedItems[q-1]||this.activatedItems[q-1][0]!=p[0]?q-1:q)}this.activatedItems[q-1]=p;if(this.$root.triggerHandler("activate.smapi",p[0])===false){return}var o=p.dataSM("sub");if(o&&(this.isTouchMode()||(!this.opts.showOnClick||this.clickActivated))){this.menuShow(o)}},itemBlur:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}this.$root.triggerHandler("blur.smapi",l[0])},itemClick:function(o){var n=a(o.currentTarget);if(!this.handleItemEvents(n)){return}if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==n.closest("ul")[0]){this.$touchScrollingSub=null;o.stopPropagation();return false}if(this.$root.triggerHandler("click.smapi",n[0])===false){return false}var p=a(o.target).is("span.sub-arrow"),m=n.dataSM("sub"),l=m?m.dataSM("level")==2:false;if(m&&!m.is(":visible")){if(this.opts.showOnClick&&l){this.clickActivated=true}this.itemActivate(n);if(m.is(":visible")){this.focusActivated=true;return false}}else{if(this.isCollapsible()&&p){this.itemActivate(n);this.menuHide(m);return false}}if(this.opts.showOnClick&&l||n.hasClass("disabled")||this.$root.triggerHandler("select.smapi",n[0])===false){return false}},itemDown:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}l.dataSM("mousedown",true)},itemEnter:function(n){var m=a(n.currentTarget);if(!this.handleItemEvents(m)){return}if(!this.isTouchMode()){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}var l=this;this.showTimeout=setTimeout(function(){l.itemActivate(m)},this.opts.showOnClick&&m.closest("ul").dataSM("level")==1?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",m[0])},itemFocus:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}if(this.focusActivated&&(!this.isTouchMode()||!l.dataSM("mousedown"))&&(!this.activatedItems.length||this.activatedItems[this.activatedItems.length-1][0]!=l[0])){this.itemActivate(l,true)}this.$root.triggerHandler("focus.smapi",l[0])},itemLeave:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}if(!this.isTouchMode()){l[0].blur();if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}}l.removeDataSM("mousedown");this.$root.triggerHandler("mouseleave.smapi",l[0])},menuHide:function(m){if(this.$root.triggerHandler("beforehide.smapi",m[0])===false){return}m.stop(true,true);if(m.css("display")!="none"){var l=function(){m.css("z-index","")};if(this.isCollapsible()){if(this.opts.collapsibleHideFunction){this.opts.collapsibleHideFunction.call(this,m,l)}else{m.hide(this.opts.collapsibleHideDuration,l)}}else{if(this.opts.hideFunction){this.opts.hideFunction.call(this,m,l)}else{m.hide(this.opts.hideDuration,l)}}if(m.dataSM("ie-shim")){m.dataSM("ie-shim").remove().css({"-webkit-transform":"",transform:""})}if(m.dataSM("scroll")){this.menuScrollStop(m);m.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).unbind(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()}m.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false");m.attr({"aria-expanded":"false","aria-hidden":"true"});var n=m.dataSM("level");this.activatedItems.splice(n-1,1);this.visibleSubMenus.splice(a.inArray(m,this.visibleSubMenus),1);this.$root.triggerHandler("hide.smapi",m[0])}},menuHideAll:function(){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}var m=this.opts.isPopup?1:0;for(var l=this.visibleSubMenus.length-1;l>=m;l--){this.menuHide(this.visibleSubMenus[l])}if(this.opts.isPopup){this.$root.stop(true,true);if(this.$root.is(":visible")){if(this.opts.hideFunction){this.opts.hideFunction.call(this,this.$root)}else{this.$root.hide(this.opts.hideDuration)}if(this.$root.dataSM("ie-shim")){this.$root.dataSM("ie-shim").remove()}}}this.activatedItems=[];this.visibleSubMenus=[];this.clickActivated=false;this.focusActivated=false;this.zIndexInc=0;this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(n){for(var l=this.activatedItems.length-1;l>=n;l--){var m=this.activatedItems[l].dataSM("sub");if(m){this.menuHide(m)}}},menuIframeShim:function(l){if(e&&this.opts.overlapControlsInIE&&!l.dataSM("ie-shim")){l.dataSM("ie-shim",a("<iframe/>").attr({src:"javascript:0",tabindex:-9}).css({position:"absolute",top:"auto",left:"0",opacity:0,border:"0"}))}},menuInit:function(l){if(!l.dataSM("in-mega")){if(l.hasClass("mega-menu")){l.find("ul").dataSM("in-mega",true)}var q=2,m=l[0];while((m=m.parentNode.parentNode)!=this.$root[0]){q++}var n=l.prevAll("a").eq(-1);if(!n.length){n=l.prevAll().find("a").eq(-1)}n.addClass("has-submenu").dataSM("sub",l);l.dataSM("parent-a",n).dataSM("level",q).parent().dataSM("sub",l);var o=n.attr("id")||this.accessIdPrefix+(++this.idInc),p=l.attr("id")||this.accessIdPrefix+(++this.idInc);n.attr({id:o,"aria-haspopup":"true","aria-controls":p,"aria-expanded":"false"});l.attr({id:p,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"});if(this.opts.subIndicators){n[this.opts.subIndicatorsPos](this.$subArrow.clone())}}},menuPosition:function(K){var r=K.dataSM("parent-a"),D=r.closest("li"),E=D.parent(),l=K.dataSM("level"),t=this.getWidth(K),J=this.getHeight(K),u=r.offset(),o=u.left,m=u.top,q=this.getWidth(r),F=this.getHeight(r),H=a(window),v=H.scrollLeft(),s=H.scrollTop(),z=this.getViewportWidth(),L=this.getViewportHeight(),w=E.parent().is("[data-sm-horizontal-sub]")||l==2&&!E.hasClass("sm-vertical"),B=this.opts.rightToLeftSubMenus&&!D.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&D.is("[data-sm-reverse]"),p=l==2?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,n=l==2?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY,C,A;if(w){C=B?q-t-p:p;A=this.opts.bottomToTopSubMenus?-J-n:F+n}else{C=B?p-t:q-p;A=this.opts.bottomToTopSubMenus?F-n-J:n}if(this.opts.keepInViewport){var N=o+C,M=m+A;if(B&&N<v){C=w?v-N+C:q-p}else{if(!B&&N+t>v+z){C=w?v+z-t-N+C:p-t}}if(!w){if(J<L&&M+J>s+L){A+=s+L-J-M}else{if(J>=L||M<s){A+=s-M}}}if(w&&(M+J>s+L+0.49||M<s)||!w&&J>L+0.49){var G=this;if(!K.dataSM("scroll-arrows")){K.dataSM("scroll-arrows",a([a('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0],a('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]]).bind({mouseenter:function(){K.dataSM("scroll").up=a(this).hasClass("scroll-up");G.menuScroll(K)},mouseleave:function(x){G.menuScrollStop(K);G.menuScrollOut(K,x)},"mousewheel DOMMouseScroll":function(x){x.preventDefault()}}).insertAfter(K))}var I=".smartmenus_scroll";K.dataSM("scroll",{y:this.cssTransforms3d?0:A-F,step:1,itemH:F,subH:J,arrowDownH:this.getHeight(K.dataSM("scroll-arrows").eq(1))}).bind(i([["mouseover",function(x){G.menuScrollOver(K,x)}],["mouseout",function(x){G.menuScrollOut(K,x)}],["mousewheel DOMMouseScroll",function(x){G.menuScrollMousewheel(K,x)}]],I)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:C+(parseInt(K.css("border-left-width"))||0),width:t-(parseInt(K.css("border-left-width"))||0)-(parseInt(K.css("border-right-width"))||0),zIndex:K.css("z-index")}).eq(w&&this.opts.bottomToTopSubMenus?0:1).show();if(this.isFixed()){K.css({"touch-action":"none","-ms-touch-action":"none"}).bind(i([[d?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp",function(x){G.menuScrollTouch(K,x)}]],I))}}}K.css({top:"auto",left:"0",marginLeft:C,marginTop:A-F});this.menuIframeShim(K);if(K.dataSM("ie-shim")){K.dataSM("ie-shim").css({zIndex:K.css("z-index"),width:t,height:J,marginLeft:C,marginTop:A-F})}},menuScroll:function(r,m,n){var p=r.dataSM("scroll"),q=r.dataSM("scroll-arrows"),o=p.up?p.upEnd:p.downEnd,s;if(!m&&p.momentum){p.momentum*=0.92;s=p.momentum;if(s<0.5){this.menuScrollStop(r);return}}else{s=n||(m||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(p.step))}var l=r.dataSM("level");if(this.activatedItems[l-1]&&this.activatedItems[l-1].dataSM("sub")&&this.activatedItems[l-1].dataSM("sub").is(":visible")){this.menuHideSubMenus(l-1)}p.y=p.up&&o<=p.y||!p.up&&o>=p.y?p.y:(Math.abs(o-p.y)>s?p.y+(p.up?s:-s):o);r.add(r.dataSM("ie-shim")).css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+p.y+"px, 0)",transform:"translate3d(0, "+p.y+"px, 0)"}:{marginTop:p.y});if(f&&(p.up&&p.y>p.downEnd||!p.up&&p.y<p.upEnd)){q.eq(p.up?1:0).show()}if(p.y==o){if(f){q.eq(p.up?0:1).hide()}this.menuScrollStop(r)}else{if(!m){if(this.opts.scrollAccelerate&&p.step<this.opts.scrollStep){p.step+=0.2}var t=this;this.scrollTimeout=g(function(){t.menuScroll(r)})}}},menuScrollMousewheel:function(m,n){if(this.getClosestMenu(n.target)==m[0]){n=n.originalEvent;var l=(n.wheelDelta||-n.detail)>0;if(m.dataSM("scroll-arrows").eq(l?0:1).is(":visible")){m.dataSM("scroll").up=l;this.menuScroll(m,true)}}n.preventDefault()},menuScrollOut:function(l,m){if(f){if(!/^scroll-(up|down)/.test((m.relatedTarget||"").className)&&(l[0]!=m.relatedTarget&&!a.contains(l[0],m.relatedTarget)||this.getClosestMenu(m.relatedTarget)!=l[0])){l.dataSM("scroll-arrows").css("visibility","hidden")}}},menuScrollOver:function(n,o){if(f){if(!/^scroll-(up|down)/.test(o.target.className)&&this.getClosestMenu(o.target)==n[0]){this.menuScrollRefreshData(n);var m=n.dataSM("scroll"),l=a(window).scrollTop()-n.dataSM("parent-a").offset().top-m.itemH;n.dataSM("scroll-arrows").eq(0).css("margin-top",l).end().eq(1).css("margin-top",l+this.getViewportHeight()-m.arrowDownH).end().css("visibility","visible")}}},menuScrollRefreshData:function(n){var m=n.dataSM("scroll"),l=a(window).scrollTop()-n.dataSM("parent-a").offset().top-m.itemH;if(this.cssTransforms3d){l=-(parseFloat(n.css("margin-top"))-l)}a.extend(m,{upEnd:l,downEnd:l+this.getViewportHeight()-m.subH})},menuScrollStop:function(l){if(this.scrollTimeout){c(this.scrollTimeout);this.scrollTimeout=0;l.dataSM("scroll").step=1;return true}},menuScrollTouch:function(p,q){q=q.originalEvent;if(j(q)){var m=this.getTouchPoint(q);if(this.getClosestMenu(m.target)==p[0]){var o=p.dataSM("scroll");if(/(start|down)$/i.test(q.type)){if(this.menuScrollStop(p)){q.preventDefault();this.$touchScrollingSub=p}else{this.$touchScrollingSub=null}this.menuScrollRefreshData(p);a.extend(o,{touchStartY:m.pageY,touchStartTime:q.timeStamp})}else{if(/move$/i.test(q.type)){var n=o.touchY!==undefined?o.touchY:o.touchStartY;if(n!==undefined&&n!=m.pageY){this.$touchScrollingSub=p;var l=n<m.pageY;if(o.up!==undefined&&o.up!=l){a.extend(o,{touchStartY:m.pageY,touchStartTime:q.timeStamp})}a.extend(o,{up:l,touchY:m.pageY});this.menuScroll(p,true,Math.abs(m.pageY-n))}q.preventDefault()}else{if(o.touchY!==undefined){if(o.momentum=Math.pow(Math.abs(m.pageY-o.touchStartY)/(q.timeStamp-o.touchStartTime),2)*15){this.menuScrollStop(p);this.menuScroll(p);q.preventDefault()}delete o.touchY}}}}}},menuShow:function(n){if(!n.dataSM("beforefirstshowfired")){n.dataSM("beforefirstshowfired",true);if(this.$root.triggerHandler("beforefirstshow.smapi",n[0])===false){return}}if(this.$root.triggerHandler("beforeshow.smapi",n[0])===false){return}n.dataSM("shown-before",true).stop(true,true);if(!n.is(":visible")){var m=n.dataSM("parent-a");if(this.opts.keepHighlighted||this.isCollapsible()){m.addClass("highlighted")}if(this.isCollapsible()){n.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""})}else{n.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1);if(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth){n.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap");if(this.opts.subMenusMinWidth){n.css("min-width",this.opts.subMenusMinWidth)}if(this.opts.subMenusMaxWidth){var o=this.getWidth(n);n.css("max-width",this.opts.subMenusMaxWidth);if(o>this.getWidth(n)){n.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}}}this.menuPosition(n);if(n.dataSM("ie-shim")){n.dataSM("ie-shim").insertBefore(n)}}var l=function(){n.css("overflow","")};if(this.isCollapsible()){if(this.opts.collapsibleShowFunction){this.opts.collapsibleShowFunction.call(this,n,l)}else{n.show(this.opts.collapsibleShowDuration,l)}}else{if(this.opts.showFunction){this.opts.showFunction.call(this,n,l)}else{n.show(this.opts.showDuration,l)}}m.attr("aria-expanded","true");n.attr({"aria-expanded":"true","aria-hidden":"false"});this.visibleSubMenus.push(n);this.$root.triggerHandler("show.smapi",n[0])}},popupHide:function(l){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}var m=this;this.hideTimeout=setTimeout(function(){m.menuHideAll()},l?1:this.opts.hideTimeout)},popupShow:function(o,n){if(!this.opts.isPopup){alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.');return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}this.$root.dataSM("shown-before",true).stop(true,true);if(!this.$root.is(":visible")){this.$root.css({left:o,top:n});this.menuIframeShim(this.$root);if(this.$root.dataSM("ie-shim")){this.$root.dataSM("ie-shim").css({zIndex:this.$root.css("z-index"),width:this.getWidth(this.$root),height:this.getHeight(this.$root),left:o,top:n}).insertBefore(this.$root)}var m=this,l=function(){m.$root.css("overflow","")};if(this.opts.showFunction){this.opts.showFunction.call(this,this.$root,l)}else{this.$root.show(this.opts.showDuration,l)}this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(true);this.init(true)},rootKeyDown:function(o){if(!this.handleEvents()){return}switch(o.keyCode){case 27:var m=this.activatedItems[0];if(m){this.menuHideAll();m[0].focus();var n=m.dataSM("sub");if(n){this.menuHide(n)}}break;case 32:var l=a(o.target);if(l.is("a")&&this.handleItemEvents(l)){var n=l.dataSM("sub");if(n&&!n.is(":visible")){this.itemClick({currentTarget:o.target});o.preventDefault()}}break}},rootOut:function(m){if(!this.handleEvents()||this.isTouchMode()||m.target==this.$root[0]){return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}if(!this.opts.showOnClick||!this.opts.hideOnClick){var l=this;this.hideTimeout=setTimeout(function(){l.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(l){if(!this.handleEvents()||this.isTouchMode()||l.target==this.$root[0]){return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}},winResize:function(m){if(!this.handleEvents()){if(this.$disableOverlay){var n=this.$root.offset();this.$disableOverlay.css({top:n.top,left:n.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}return}if(!("onorientationchange" in window)||m.type=="orientationchange"){var l=this.isCollapsible();if(!(this.wasCollapsible&&l)){if(this.activatedItems.length){this.activatedItems[this.activatedItems.length-1][0].blur()}this.menuHideAll()}this.wasCollapsible=l}}}});a.fn.dataSM=function(l,m){if(m){return this.data(l+"_smartmenus",m)}return this.data(l+"_smartmenus")};a.fn.removeDataSM=function(l){return this.removeData(l+"_smartmenus")};a.fn.smartmenus=function(m){if(typeof m=="string"){var l=arguments,o=m;Array.prototype.shift.call(l);return this.each(function(){var p=a(this).data("smartmenus");if(p&&p[o]){p[o].apply(p,l)}})}var n=a.extend({},a.fn.smartmenus.defaults,m);return this.each(function(){new a.SmartMenus(this,n)})};a.fn.smartmenus.defaults={isPopup:false,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:true,subIndicatorsPos:"prepend",subIndicatorsText:"+",scrollStep:30,scrollAccelerate:true,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(m,l){m.fadeOut(200,l)},collapsibleShowDuration:0,collapsibleShowFunction:function(m,l){m.slideDown(200,l)},collapsibleHideDuration:0,collapsibleHideFunction:function(m,l){m.slideUp(200,l)},showOnClick:false,hideOnClick:true,noMouseOver:false,keepInViewport:true,keepHighlighted:true,markCurrentItem:false,markCurrentTree:true,rightToLeftSubMenus:false,bottomToTopSubMenus:false,overlapControlsInIE:true};return a}));
\ No newline at end of file diff --git a/docs/menu.js b/docs/menu.js new file mode 100644 index 0000000..97db4c2 --- /dev/null +++ b/docs/menu.js @@ -0,0 +1,26 @@ +function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { + function makeTree(data,relPath) { + var result=''; + if ('children' in data) { + result+='<ul>'; + for (var i in data.children) { + result+='<li><a href="'+relPath+data.children[i].url+'">'+ + data.children[i].text+'</a>'+ + makeTree(data.children[i],relPath)+'</li>'; + } + result+='</ul>'; + } + return result; + } + + $('#main-nav').append(makeTree(menudata,relPath)); + $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); + if (searchEnabled) { + if (serverSide) { + $('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><div class="left"><form id="FSearchBox" action="'+searchPage+'" method="get"><img id="MSearchSelect" src="'+relPath+'search/mag.png" alt=""/><input type="text" id="MSearchField" name="query" value="'+search+'" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div><div class="right"></div></div></li>'); + } else { + $('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><span class="left"><img id="MSearchSelect" src="'+relPath+'search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/><input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/></span><span class="right"><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="'+relPath+'search/close.png" alt=""/></a></span></div></li>'); + } + } + $('#main-menu').smartmenus(); +} diff --git a/docs/menudata.js b/docs/menudata.js new file mode 100644 index 0000000..4398a4d --- /dev/null +++ b/docs/menudata.js @@ -0,0 +1,19 @@ +var menudata={children:[ +{text:"Main Page",url:"index.html"}, +{text:"Related Pages",url:"pages.html"}, +{text:"Classes",url:"annotated.html",children:[ +{text:"Class List",url:"annotated.html"}, +{text:"Class Index",url:"classes.html"}, +{text:"Class Members",url:"functions.html",children:[ +{text:"All",url:"functions.html"}, +{text:"Variables",url:"functions_vars.html"}]}]}, +{text:"Files",url:"files.html",children:[ +{text:"File List",url:"files.html"}, +{text:"File Members",url:"globals.html",children:[ +{text:"All",url:"globals.html",children:[ +{text:"p",url:"globals.html#index_p"}]}, +{text:"Functions",url:"globals_func.html",children:[ +{text:"p",url:"globals_func.html#index_p"}]}, +{text:"Variables",url:"globals_vars.html"}, +{text:"Typedefs",url:"globals_type.html"}, +{text:"Macros",url:"globals_defs.html"}]}]}]} diff --git a/docs/nav_f.png b/docs/nav_f.png Binary files differnew file mode 100644 index 0000000..72a58a5 --- /dev/null +++ b/docs/nav_f.png diff --git a/docs/nav_g.png b/docs/nav_g.png Binary files differnew file mode 100644 index 0000000..2093a23 --- /dev/null +++ b/docs/nav_g.png diff --git a/docs/nav_h.png b/docs/nav_h.png Binary files differnew file mode 100644 index 0000000..33389b1 --- /dev/null +++ b/docs/nav_h.png diff --git a/docs/open.png b/docs/open.png Binary files differnew file mode 100644 index 0000000..30f75c7 --- /dev/null +++ b/docs/open.png diff --git a/docs/pages.html b/docs/pages.html new file mode 100644 index 0000000..51ec993 --- /dev/null +++ b/docs/pages.html @@ -0,0 +1,80 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Related Pages</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="headertitle"> +<div class="title">Related Pages</div> </div> +</div><!--header--> +<div class="contents"> +<div class="textblock">Here is a list of all related documentation pages:</div><div class="directory"> +<table class="directory"> +<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a class="el" href="todo.html" target="_self">Todo List</a></td><td class="desc"></td></tr> +</table> +</div><!-- directory --> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom_8h.html b/docs/prom_8h.html new file mode 100644 index 0000000..c7ce8f5 --- /dev/null +++ b/docs/prom_8h.html @@ -0,0 +1,117 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>Include <a class="el" href="prom_8h.html" title="Include prom.h to include the entire public API. ">prom.h</a> to include the entire public API. +<a href="#details">More...</a></p> +<div class="textblock"><code>#include "<a class="el" href="prom__alloc_8h_source.html">prom_alloc.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__collector_8h_source.html">prom_collector.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__collector__registry_8h_source.html">prom_collector_registry.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__counter_8h_source.html">prom_counter.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__gauge_8h_source.html">prom_gauge.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__histogram_8h_source.html">prom_histogram.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__histogram__buckets_8h_source.html">prom_histogram_buckets.h</a>"</code><br /> +<code>#include "prom_linked_list.h"</code><br /> +<code>#include "prom_map.h"</code><br /> +<code>#include "<a class="el" href="prom__metric_8h_source.html">prom_metric.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__metric__sample_8h_source.html">prom_metric_sample.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__metric__sample__histogram_8h_source.html">prom_metric_sample_histogram.h</a>"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom_8h__incl.png" border="0" usemap="#prom_2include_2prom_8h" alt=""/></div> +<map name="prom_2include_2prom_8h" id="prom_2include_2prom_8h"> +<area shape="rect" id="node2" href="prom__alloc_8h.html" title="memory management " alt="" coords="173,80,279,107"/> +<area shape="rect" id="node5" href="prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="1021,155,1151,181"/> +<area shape="rect" id="node6" href="prom__map_8h_source.html" title="prom_map.h" alt="" coords="1079,229,1183,256"/> +<area shape="rect" id="node7" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="919,229,1037,256"/> +<area shape="rect" id="node8" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="844,311,1016,338"/> +<area shape="rect" id="node9" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="1099,304,1259,345"/> +<area shape="rect" id="node10" href="prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="914,80,1101,107"/> +<area shape="rect" id="node11" href="prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="671,155,794,181"/> +<area shape="rect" id="node12" href="prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="533,155,647,181"/> +<area shape="rect" id="node13" href="prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="485,80,626,107"/> +<area shape="rect" id="node14" href="prom__histogram__buckets_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="260,155,459,181"/> +<area shape="rect" id="node15" href="prom__linked__list_8h_source.html" title="prom_linked_list.h" alt="" coords="5,80,148,107"/> +</map> +</div> +</div> +<p><a href="prom_8h_source.html">Go to the source code of this file.</a></p> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Include <a class="el" href="prom_8h.html" title="Include prom.h to include the entire public API. ">prom.h</a> to include the entire public API. </p> +</div></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom_8h__dep__incl.dot b/docs/prom_8h__dep__incl.dot new file mode 100644 index 0000000..e630766 --- /dev/null +++ b/docs/prom_8h__dep__incl.dot @@ -0,0 +1,8 @@ +digraph "prom/include/prom.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node14 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node14 -> Node15 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node15 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; +} diff --git a/docs/prom_8h__dep__incl.map b/docs/prom_8h__dep__incl.map new file mode 100644 index 0000000..2881d48 --- /dev/null +++ b/docs/prom_8h__dep__incl.map @@ -0,0 +1,3 @@ +<map id="prom/include/prom.h" name="prom/include/prom.h"> +<area shape="rect" id="node2" href="$promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="5,80,215,107"/> +</map> diff --git a/docs/prom_8h__dep__incl.md5 b/docs/prom_8h__dep__incl.md5 new file mode 100644 index 0000000..4b9c5b7 --- /dev/null +++ b/docs/prom_8h__dep__incl.md5 @@ -0,0 +1 @@ +f447616eb8315fa589f0311f234bb94a
\ No newline at end of file diff --git a/docs/prom_8h__dep__incl.png b/docs/prom_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..8f25d62 --- /dev/null +++ b/docs/prom_8h__dep__incl.png diff --git a/docs/prom_8h__incl.dot b/docs/prom_8h__incl.dot new file mode 100644 index 0000000..e23705b --- /dev/null +++ b/docs/prom_8h__incl.dot @@ -0,0 +1,51 @@ +digraph "prom/include/prom.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector_8h.html",tooltip="A Prometheus collector returns a collection of metrics. "]; + Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; + Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom_map.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__map_8h_source.html"]; + Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom_metric_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node5 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 [label="prom_metric_sample\l_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node6 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="prom_collector_registry.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector__registry_8h.html",tooltip="The collector registry registers collectors for metric exposition. "]; + Node7 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="prom_counter.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__counter_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#counter "]; + Node8 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node8 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 [label="prom_gauge.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__gauge_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#gauge "]; + Node10 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 [label="prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node11 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node12 [label="prom_histogram_buckets.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram__buckets_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node0 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node13 [label="prom_linked_list.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__linked__list_8h_source.html"]; + Node13 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom_8h__incl.map b/docs/prom_8h__incl.map new file mode 100644 index 0000000..f8280de --- /dev/null +++ b/docs/prom_8h__incl.map @@ -0,0 +1,14 @@ +<map id="prom/include/prom.h" name="prom/include/prom.h"> +<area shape="rect" id="node2" href="$prom__alloc_8h.html" title="memory management " alt="" coords="173,80,279,107"/> +<area shape="rect" id="node5" href="$prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="1021,155,1151,181"/> +<area shape="rect" id="node6" href="$prom__map_8h_source.html" title="prom_map.h" alt="" coords="1079,229,1183,256"/> +<area shape="rect" id="node7" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="919,229,1037,256"/> +<area shape="rect" id="node8" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="844,311,1016,338"/> +<area shape="rect" id="node9" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="1099,304,1259,345"/> +<area shape="rect" id="node10" href="$prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="914,80,1101,107"/> +<area shape="rect" id="node11" href="$prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="671,155,794,181"/> +<area shape="rect" id="node12" href="$prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="533,155,647,181"/> +<area shape="rect" id="node13" href="$prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="485,80,626,107"/> +<area shape="rect" id="node14" href="$prom__histogram__buckets_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="260,155,459,181"/> +<area shape="rect" id="node15" href="$prom__linked__list_8h_source.html" title="prom_linked_list.h" alt="" coords="5,80,148,107"/> +</map> diff --git a/docs/prom_8h__incl.md5 b/docs/prom_8h__incl.md5 new file mode 100644 index 0000000..74d8431 --- /dev/null +++ b/docs/prom_8h__incl.md5 @@ -0,0 +1 @@ +dff60c1f9e7587cb80e299960395a051
\ No newline at end of file diff --git a/docs/prom_8h__incl.png b/docs/prom_8h__incl.png Binary files differnew file mode 100644 index 0000000..83ece20 --- /dev/null +++ b/docs/prom_8h__incl.png diff --git a/docs/prom_8h_source.html b/docs/prom_8h_source.html new file mode 100644 index 0000000..969dc8a --- /dev/null +++ b/docs/prom_8h_source.html @@ -0,0 +1,89 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> <span class="preprocessor">#ifndef PROM_INCLUDED</span></div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span> <span class="preprocessor">#define PROM_INCLUDED</span></div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> </div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="preprocessor">#include "<a class="code" href="prom__alloc_8h.html">prom_alloc.h</a>"</span></div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="preprocessor">#include "<a class="code" href="prom__collector_8h.html">prom_collector.h</a>"</span></div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="preprocessor">#include "<a class="code" href="prom__collector__registry_8h.html">prom_collector_registry.h</a>"</span></div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="preprocessor">#include "<a class="code" href="prom__counter_8h.html">prom_counter.h</a>"</span></div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> <span class="preprocessor">#include "<a class="code" href="prom__gauge_8h.html">prom_gauge.h</a>"</span></div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> <span class="preprocessor">#include "<a class="code" href="prom__histogram_8h.html">prom_histogram.h</a>"</span></div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> <span class="preprocessor">#include "<a class="code" href="prom__histogram__buckets_8h.html">prom_histogram_buckets.h</a>"</span></div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span> <span class="preprocessor">#include "prom_linked_list.h"</span></div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <span class="preprocessor">#include "prom_map.h"</span></div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="preprocessor">#include "<a class="code" href="prom__metric_8h.html">prom_metric.h</a>"</span></div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="preprocessor">#include "<a class="code" href="prom__metric__sample_8h.html">prom_metric_sample.h</a>"</span></div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="preprocessor">#include "<a class="code" href="prom__metric__sample__histogram_8h.html">prom_metric_sample_histogram.h</a>"</span></div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> </div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> <span class="preprocessor">#endif // PROM_INCLUDED</span></div><div class="ttc" id="prom__gauge_8h_html"><div class="ttname"><a href="prom__gauge_8h.html">prom_gauge.h</a></div><div class="ttdoc">https://prometheus.io/docs/concepts/metric_types/#gauge </div></div> +<div class="ttc" id="prom__collector_8h_html"><div class="ttname"><a href="prom__collector_8h.html">prom_collector.h</a></div><div class="ttdoc">A Prometheus collector returns a collection of metrics. </div></div> +<div class="ttc" id="prom__histogram_8h_html"><div class="ttname"><a href="prom__histogram_8h.html">prom_histogram.h</a></div><div class="ttdoc">https://prometheus.io/docs/concepts/metric_types/#histogram </div></div> +<div class="ttc" id="prom__metric__sample_8h_html"><div class="ttname"><a href="prom__metric__sample_8h.html">prom_metric_sample.h</a></div><div class="ttdoc">Functions for interfacting with metric samples directly. </div></div> +<div class="ttc" id="prom__counter_8h_html"><div class="ttname"><a href="prom__counter_8h.html">prom_counter.h</a></div><div class="ttdoc">https://prometheus.io/docs/concepts/metric_types/#counter </div></div> +<div class="ttc" id="prom__metric__sample__histogram_8h_html"><div class="ttname"><a href="prom__metric__sample__histogram_8h.html">prom_metric_sample_histogram.h</a></div><div class="ttdoc">Functions for interacting with histogram metric samples directly. </div></div> +<div class="ttc" id="prom__alloc_8h_html"><div class="ttname"><a href="prom__alloc_8h.html">prom_alloc.h</a></div><div class="ttdoc">memory management </div></div> +<div class="ttc" id="prom__metric_8h_html"><div class="ttname"><a href="prom__metric_8h.html">prom_metric.h</a></div><div class="ttdoc">Functions for retrieving metric samples from metrics given an ordered set of labels. </div></div> +<div class="ttc" id="prom__collector__registry_8h_html"><div class="ttname"><a href="prom__collector__registry_8h.html">prom_collector_registry.h</a></div><div class="ttdoc">The collector registry registers collectors for metric exposition. </div></div> +<div class="ttc" id="prom__histogram__buckets_8h_html"><div class="ttname"><a href="prom__histogram__buckets_8h.html">prom_histogram_buckets.h</a></div><div class="ttdoc">https://prometheus.io/docs/concepts/metric_types/#histogram </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__alloc_8h.html b/docs/prom__alloc_8h.html new file mode 100644 index 0000000..ad8bbab --- /dev/null +++ b/docs/prom__alloc_8h.html @@ -0,0 +1,190 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_alloc.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#define-members">Macros</a> </div> + <div class="headertitle"> +<div class="title">prom_alloc.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>memory management +<a href="#details">More...</a></p> +<div class="textblock"><code>#include <stdlib.h></code><br /> +<code>#include <string.h></code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom_alloc.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__alloc_8h__incl.png" border="0" usemap="#prom_2include_2prom__alloc_8h" alt=""/></div> +<map name="prom_2include_2prom__alloc_8h" id="prom_2include_2prom__alloc_8h"> +</map> +</div> +</div><div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__alloc_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__alloc_8hdep" alt=""/></div> +<map name="prom_2include_2prom__alloc_8hdep" id="prom_2include_2prom__alloc_8hdep"> +<area shape="rect" id="node2" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="24,80,181,107"/> +</map> +</div> +</div> +<p><a href="prom__alloc_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> +Macros</h2></td></tr> +<tr class="memitem:ae1613c091e07daa2bfa4303ef5628827"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__alloc_8h.html#ae1613c091e07daa2bfa4303ef5628827">prom_malloc</a>   malloc</td></tr> +<tr class="memdesc:ae1613c091e07daa2bfa4303ef5628827"><td class="mdescLeft"> </td><td class="mdescRight">Redefine this macro if you wish to override it. <a href="#ae1613c091e07daa2bfa4303ef5628827">More...</a><br /></td></tr> +<tr class="separator:ae1613c091e07daa2bfa4303ef5628827"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:aab8dc4629c851a8c59cc721bd2f7c6f3"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__alloc_8h.html#aab8dc4629c851a8c59cc721bd2f7c6f3">prom_realloc</a>   realloc</td></tr> +<tr class="memdesc:aab8dc4629c851a8c59cc721bd2f7c6f3"><td class="mdescLeft"> </td><td class="mdescRight">Redefine this macro if you wish to override it. <a href="#aab8dc4629c851a8c59cc721bd2f7c6f3">More...</a><br /></td></tr> +<tr class="separator:aab8dc4629c851a8c59cc721bd2f7c6f3"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a21faa2fafc84c8ca25467fe9cb0a55f3"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__alloc_8h.html#a21faa2fafc84c8ca25467fe9cb0a55f3">prom_strdup</a>   strdup</td></tr> +<tr class="memdesc:a21faa2fafc84c8ca25467fe9cb0a55f3"><td class="mdescLeft"> </td><td class="mdescRight">Redefine this macro if you wish to override it. <a href="#a21faa2fafc84c8ca25467fe9cb0a55f3">More...</a><br /></td></tr> +<tr class="separator:a21faa2fafc84c8ca25467fe9cb0a55f3"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a19b2231f9b45a520bbbcf046ed5d81ef"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__alloc_8h.html#a19b2231f9b45a520bbbcf046ed5d81ef">prom_free</a>   free</td></tr> +<tr class="memdesc:a19b2231f9b45a520bbbcf046ed5d81ef"><td class="mdescLeft"> </td><td class="mdescRight">Redefine this macro if you wish to override it. <a href="#a19b2231f9b45a520bbbcf046ed5d81ef">More...</a><br /></td></tr> +<tr class="separator:a19b2231f9b45a520bbbcf046ed5d81ef"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>memory management </p> +</div><h2 class="groupheader">Macro Definition Documentation</h2> +<a id="a19b2231f9b45a520bbbcf046ed5d81ef"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a19b2231f9b45a520bbbcf046ed5d81ef">◆ </a></span>prom_free</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define prom_free   free</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Redefine this macro if you wish to override it. </p> +<p>The default value is free. </p> + +</div> +</div> +<a id="ae1613c091e07daa2bfa4303ef5628827"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ae1613c091e07daa2bfa4303ef5628827">◆ </a></span>prom_malloc</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define prom_malloc   malloc</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Redefine this macro if you wish to override it. </p> +<p>The default value is malloc. </p> + +</div> +</div> +<a id="aab8dc4629c851a8c59cc721bd2f7c6f3"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aab8dc4629c851a8c59cc721bd2f7c6f3">◆ </a></span>prom_realloc</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define prom_realloc   realloc</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Redefine this macro if you wish to override it. </p> +<p>The default value is realloc. </p> + +</div> +</div> +<a id="a21faa2fafc84c8ca25467fe9cb0a55f3"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a21faa2fafc84c8ca25467fe9cb0a55f3">◆ </a></span>prom_strdup</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define prom_strdup   strdup</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Redefine this macro if you wish to override it. </p> +<p>The default value is strdup. </p> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__alloc_8h__dep__incl.map b/docs/prom__alloc_8h__dep__incl.map new file mode 100644 index 0000000..a737d21 --- /dev/null +++ b/docs/prom__alloc_8h__dep__incl.map @@ -0,0 +1,3 @@ +<map id="prom/include/prom_alloc.h" name="prom/include/prom_alloc.h"> +<area shape="rect" id="node2" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="24,80,181,107"/> +</map> diff --git a/docs/prom__alloc_8h__dep__incl.md5 b/docs/prom__alloc_8h__dep__incl.md5 new file mode 100644 index 0000000..bdb7be0 --- /dev/null +++ b/docs/prom__alloc_8h__dep__incl.md5 @@ -0,0 +1 @@ +5b924c712bed7489a2830deb6f9f3c5c
\ No newline at end of file diff --git a/docs/prom__alloc_8h__dep__incl.png b/docs/prom__alloc_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..cd70aa2 --- /dev/null +++ b/docs/prom__alloc_8h__dep__incl.png diff --git a/docs/prom__alloc_8h__incl.map b/docs/prom__alloc_8h__incl.map new file mode 100644 index 0000000..2b2df31 --- /dev/null +++ b/docs/prom__alloc_8h__incl.map @@ -0,0 +1,2 @@ +<map id="prom/include/prom_alloc.h" name="prom/include/prom_alloc.h"> +</map> diff --git a/docs/prom__alloc_8h__incl.md5 b/docs/prom__alloc_8h__incl.md5 new file mode 100644 index 0000000..726c631 --- /dev/null +++ b/docs/prom__alloc_8h__incl.md5 @@ -0,0 +1 @@ +ca0ae2ac88b74acddef29bf677e42e80
\ No newline at end of file diff --git a/docs/prom__alloc_8h__incl.png b/docs/prom__alloc_8h__incl.png Binary files differnew file mode 100644 index 0000000..00f7f0a --- /dev/null +++ b/docs/prom__alloc_8h__incl.png diff --git a/docs/prom__alloc_8h_source.html b/docs/prom__alloc_8h_source.html new file mode 100644 index 0000000..aafc81c --- /dev/null +++ b/docs/prom__alloc_8h_source.html @@ -0,0 +1,79 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_alloc.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_alloc.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__alloc_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef PROM_ALLOC_H</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define PROM_ALLOC_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="prom__alloc_8h.html#ae1613c091e07daa2bfa4303ef5628827"> 31</a></span> <span class="preprocessor">#define prom_malloc malloc</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="prom__alloc_8h.html#aab8dc4629c851a8c59cc721bd2f7c6f3"> 36</a></span> <span class="preprocessor">#define prom_realloc realloc</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="prom__alloc_8h.html#a21faa2fafc84c8ca25467fe9cb0a55f3"> 41</a></span> <span class="preprocessor">#define prom_strdup strdup</span></div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="prom__alloc_8h.html#a19b2231f9b45a520bbbcf046ed5d81ef"> 46</a></span> <span class="preprocessor">#define prom_free free</span></div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="preprocessor">#endif // PROM_ALLOC_H</span></div></div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__collector_8h.html b/docs/prom__collector_8h.html new file mode 100644 index 0000000..2d2c907 --- /dev/null +++ b/docs/prom__collector_8h.html @@ -0,0 +1,394 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_collector.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> </div> + <div class="headertitle"> +<div class="title">prom_collector.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>A Prometheus collector returns a collection of metrics. +<a href="#details">More...</a></p> +<div class="textblock"><code>#include "prom_map.h"</code><br /> +<code>#include "<a class="el" href="prom__metric_8h_source.html">prom_metric.h</a>"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom_collector.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__collector_8h__incl.png" border="0" usemap="#prom_2include_2prom__collector_8h" alt=""/></div> +<map name="prom_2include_2prom__collector_8h" id="prom_2include_2prom__collector_8h"> +<area shape="rect" id="node2" href="prom__map_8h_source.html" title="prom_map.h" alt="" coords="5,80,109,107"/> +<area shape="rect" id="node3" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="133,80,251,107"/> +<area shape="rect" id="node4" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="10,162,182,189"/> +<area shape="rect" id="node5" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="207,155,367,196"/> +</map> +</div> +</div><div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__collector_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__collector_8hdep" alt=""/></div> +<map name="prom_2include_2prom__collector_8hdep" id="prom_2include_2prom__collector_8hdep"> +<area shape="rect" id="node2" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="5,169,163,196"/> +<area shape="rect" id="node3" href="prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="121,80,329,121"/> +<area shape="rect" id="node4" href="promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="187,169,397,196"/> +</map> +</div> +</div> +<p><a href="prom__collector_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:a28cf36f114f69a96508c044c44716f9c"><td class="memItemLeft" align="right" valign="top"><a id="a28cf36f114f69a96508c044c44716f9c"></a> +typedef struct prom_collector </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a></td></tr> +<tr class="memdesc:a28cf36f114f69a96508c044c44716f9c"><td class="mdescLeft"> </td><td class="mdescRight">A prometheus collector calls collect to prepare metrics and return them to the registry to which it is registered. <br /></td></tr> +<tr class="separator:a28cf36f114f69a96508c044c44716f9c"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:af87330edd48cdb8e1074517e734b1e40"><td class="memItemLeft" align="right" valign="top">typedef prom_map_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40">prom_collect_fn</a>(<a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *self)</td></tr> +<tr class="memdesc:af87330edd48cdb8e1074517e734b1e40"><td class="mdescLeft"> </td><td class="mdescRight">The function responsible for preparing metric data and returning metrics for a given collector. <a href="#af87330edd48cdb8e1074517e734b1e40">More...</a><br /></td></tr> +<tr class="separator:af87330edd48cdb8e1074517e734b1e40"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a4300cf33b6f8e4457df385c3d2a51a4b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#a4300cf33b6f8e4457df385c3d2a51a4b">prom_collector_new</a> (const char *name)</td></tr> +<tr class="memdesc:a4300cf33b6f8e4457df385c3d2a51a4b"><td class="mdescLeft"> </td><td class="mdescRight">Create a collector. <a href="#a4300cf33b6f8e4457df385c3d2a51a4b">More...</a><br /></td></tr> +<tr class="separator:a4300cf33b6f8e4457df385c3d2a51a4b"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:af50746bb4af87eda617fa08237e3834e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#af50746bb4af87eda617fa08237e3834e">prom_collector_process_new</a> (const char *limits_path, const char *stat_path)</td></tr> +<tr class="memdesc:af50746bb4af87eda617fa08237e3834e"><td class="mdescLeft"> </td><td class="mdescRight">Construct a prom_collector_t* which includes the default process metrics. <a href="#af50746bb4af87eda617fa08237e3834e">More...</a><br /></td></tr> +<tr class="separator:af50746bb4af87eda617fa08237e3834e"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a037b72b2edb81a477999a7dfc08758c7"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#a037b72b2edb81a477999a7dfc08758c7">prom_collector_destroy</a> (<a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *self)</td></tr> +<tr class="memdesc:a037b72b2edb81a477999a7dfc08758c7"><td class="mdescLeft"> </td><td class="mdescRight">Destroy a collector. <a href="#a037b72b2edb81a477999a7dfc08758c7">More...</a><br /></td></tr> +<tr class="separator:a037b72b2edb81a477999a7dfc08758c7"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a875b72940cd578ee76c71f1f4853f139"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#a875b72940cd578ee76c71f1f4853f139">prom_collector_free_generic</a> (void *gen)</td></tr> +<tr class="memdesc:a875b72940cd578ee76c71f1f4853f139"><td class="mdescLeft"> </td><td class="mdescRight">Frees a collector passed as a void pointer. <a href="#a875b72940cd578ee76c71f1f4853f139">More...</a><br /></td></tr> +<tr class="separator:a875b72940cd578ee76c71f1f4853f139"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a12c297cce0a30ee4149f2b486d9f0337"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#a12c297cce0a30ee4149f2b486d9f0337">prom_collector_destroy_generic</a> (void *gen)</td></tr> +<tr class="memdesc:a12c297cce0a30ee4149f2b486d9f0337"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a collector passed as a void pointer. <a href="#a12c297cce0a30ee4149f2b486d9f0337">More...</a><br /></td></tr> +<tr class="separator:a12c297cce0a30ee4149f2b486d9f0337"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:abd87021bd63f759d55642685a74874ee"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#abd87021bd63f759d55642685a74874ee">prom_collector_add_metric</a> (<a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *self, <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *metric)</td></tr> +<tr class="memdesc:abd87021bd63f759d55642685a74874ee"><td class="mdescLeft"> </td><td class="mdescRight">Add a metric to a collector. <a href="#abd87021bd63f759d55642685a74874ee">More...</a><br /></td></tr> +<tr class="separator:abd87021bd63f759d55642685a74874ee"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a9929cb81f4fb49ffca8aa880a4699650"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector_8h.html#a9929cb81f4fb49ffca8aa880a4699650">prom_collector_set_collect_fn</a> (<a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *self, <a class="el" href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40">prom_collect_fn</a> *fn)</td></tr> +<tr class="memdesc:a9929cb81f4fb49ffca8aa880a4699650"><td class="mdescLeft"> </td><td class="mdescRight">The collect function is responsible for doing any work involving a set of metrics and then returning them for metric exposition. <a href="#a9929cb81f4fb49ffca8aa880a4699650">More...</a><br /></td></tr> +<tr class="separator:a9929cb81f4fb49ffca8aa880a4699650"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>A Prometheus collector returns a collection of metrics. </p> +</div><h2 class="groupheader">Typedef Documentation</h2> +<a id="af87330edd48cdb8e1074517e734b1e40"></a> +<h2 class="memtitle"><span class="permalink"><a href="#af87330edd48cdb8e1074517e734b1e40">◆ </a></span>prom_collect_fn</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">typedef prom_map_t* prom_collect_fn(<a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *self)</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>The function responsible for preparing metric data and returning metrics for a given collector. </p> +<p>If you use the default collector registry, this should not concern you. If you are using a custom collector, you may set this function on your collector to do additional work before returning the contained metrics.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The prom_map_t* containing the collected metrics </dd></dl> + +</div> +</div> +<h2 class="groupheader">Function Documentation</h2> +<a id="abd87021bd63f759d55642685a74874ee"></a> +<h2 class="memtitle"><span class="permalink"><a href="#abd87021bd63f759d55642685a74874ee">◆ </a></span>prom_collector_add_metric()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_add_metric </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype"><a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> * </td> + <td class="paramname"><em>metric</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Add a metric to a collector. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_t* </td></tr> + <tr><td class="paramname">metric</td><td>the prom_metric_t* to add to the prom_collector_t* passed as self. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure. </dd></dl> + +</div> +</div> +<a id="a037b72b2edb81a477999a7dfc08758c7"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a037b72b2edb81a477999a7dfc08758c7">◆ </a></span>prom_collector_destroy()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_destroy </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Destroy a collector. </p> +<p>You MUST set self to NULL after destruction. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure. </dd></dl> + +</div> +</div> +<a id="a12c297cce0a30ee4149f2b486d9f0337"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a12c297cce0a30ee4149f2b486d9f0337">◆ </a></span>prom_collector_destroy_generic()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_destroy_generic </td> + <td>(</td> + <td class="paramtype">void * </td> + <td class="paramname"><em>gen</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Destroys a collector passed as a void pointer. </p> +<p>You MUST set self to NULL after destruction. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">gen</td><td>The target prom_collector_t* represented as a void* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure. </dd></dl> + +</div> +</div> +<a id="a875b72940cd578ee76c71f1f4853f139"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a875b72940cd578ee76c71f1f4853f139">◆ </a></span>prom_collector_free_generic()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">void prom_collector_free_generic </td> + <td>(</td> + <td class="paramtype">void * </td> + <td class="paramname"><em>gen</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Frees a collector passed as a void pointer. </p> +<p>You MUST set self to NULL after destruction. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">gen</td><td>The target prom_collector_t* represented as a void* </td></tr> + </table> + </dd> +</dl> + +</div> +</div> +<a id="a4300cf33b6f8e4457df385c3d2a51a4b"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a4300cf33b6f8e4457df385c3d2a51a4b">◆ </a></span>prom_collector_new()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a>* prom_collector_new </td> + <td>(</td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>name</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Create a collector. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">name</td><td>The name of the collector. The name MUST NOT be default or process. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_collector_t* </dd></dl> + +</div> +</div> +<a id="af50746bb4af87eda617fa08237e3834e"></a> +<h2 class="memtitle"><span class="permalink"><a href="#af50746bb4af87eda617fa08237e3834e">◆ </a></span>prom_collector_process_new()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a>* prom_collector_process_new </td> + <td>(</td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>limits_path</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>stat_path</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Construct a prom_collector_t* which includes the default process metrics. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">limits_path</td><td>Pass NULL to discover the path to the /proc/[pid]/limits file associated with process ID assigned by the host environment. Otherwise, pass a string to said path. </td></tr> + <tr><td class="paramname">stat_path</td><td>Pass NULL to discover the path to the /proc/[pid]/stat file associated with process ID assigned by the host environment. Otherwise, pass a string to said path. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_collector_t* </dd></dl> + +</div> +</div> +<a id="a9929cb81f4fb49ffca8aa880a4699650"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a9929cb81f4fb49ffca8aa880a4699650">◆ </a></span>prom_collector_set_collect_fn()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_set_collect_fn </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype"><a class="el" href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40">prom_collect_fn</a> * </td> + <td class="paramname"><em>fn</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>The collect function is responsible for doing any work involving a set of metrics and then returning them for metric exposition. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_t* </td></tr> + <tr><td class="paramname">fn</td><td>The prom_collect_fn* which will be responsible for handling any metric collection operations before returning the collected metrics for exposition. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure. </dd></dl> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__collector_8h__dep__incl.dot b/docs/prom__collector_8h__dep__incl.dot new file mode 100644 index 0000000..3510f62 --- /dev/null +++ b/docs/prom__collector_8h__dep__incl.dot @@ -0,0 +1,13 @@ +digraph "prom/include/prom_collector.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node6 [label="prom/include/prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node6 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node7 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; + Node6 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="prom/include/prom_collector\l_registry.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector__registry_8h.html",tooltip="The collector registry registers collectors for metric exposition. "]; + Node9 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__collector_8h__dep__incl.map b/docs/prom__collector_8h__dep__incl.map new file mode 100644 index 0000000..cd35408 --- /dev/null +++ b/docs/prom__collector_8h__dep__incl.map @@ -0,0 +1,5 @@ +<map id="prom/include/prom_collector.h" name="prom/include/prom_collector.h"> +<area shape="rect" id="node2" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="5,169,163,196"/> +<area shape="rect" id="node3" href="$prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="121,80,329,121"/> +<area shape="rect" id="node4" href="$promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="187,169,397,196"/> +</map> diff --git a/docs/prom__collector_8h__dep__incl.md5 b/docs/prom__collector_8h__dep__incl.md5 new file mode 100644 index 0000000..1df5832 --- /dev/null +++ b/docs/prom__collector_8h__dep__incl.md5 @@ -0,0 +1 @@ +dcee52eb811bae7086fe3047a905fe5f
\ No newline at end of file diff --git a/docs/prom__collector_8h__dep__incl.png b/docs/prom__collector_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..edfa370 --- /dev/null +++ b/docs/prom__collector_8h__dep__incl.png diff --git a/docs/prom__collector_8h__incl.dot b/docs/prom__collector_8h__incl.dot new file mode 100644 index 0000000..4127250 --- /dev/null +++ b/docs/prom__collector_8h__incl.dot @@ -0,0 +1,18 @@ +digraph "prom/include/prom_collector.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; + Node0 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom_map.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__map_8h_source.html"]; + Node0 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom_metric_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node4 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom_metric_sample\l_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node5 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__collector_8h__incl.map b/docs/prom__collector_8h__incl.map new file mode 100644 index 0000000..a6586ce --- /dev/null +++ b/docs/prom__collector_8h__incl.map @@ -0,0 +1,6 @@ +<map id="prom/include/prom_collector.h" name="prom/include/prom_collector.h"> +<area shape="rect" id="node2" href="$prom__map_8h_source.html" title="prom_map.h" alt="" coords="5,80,109,107"/> +<area shape="rect" id="node3" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="133,80,251,107"/> +<area shape="rect" id="node4" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="10,162,182,189"/> +<area shape="rect" id="node5" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="207,155,367,196"/> +</map> diff --git a/docs/prom__collector_8h__incl.md5 b/docs/prom__collector_8h__incl.md5 new file mode 100644 index 0000000..bd63e6e --- /dev/null +++ b/docs/prom__collector_8h__incl.md5 @@ -0,0 +1 @@ +09d2f46fa501f75ec3e79295a53fe6a8
\ No newline at end of file diff --git a/docs/prom__collector_8h__incl.png b/docs/prom__collector_8h__incl.png Binary files differnew file mode 100644 index 0000000..0031d34 --- /dev/null +++ b/docs/prom__collector_8h__incl.png diff --git a/docs/prom__collector_8h_source.html b/docs/prom__collector_8h_source.html new file mode 100644 index 0000000..1e21e05 --- /dev/null +++ b/docs/prom__collector_8h_source.html @@ -0,0 +1,90 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_collector.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_collector.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__collector_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#ifndef PROM_COLLECTOR_H</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#define PROM_COLLECTOR_H</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> </div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include "prom_map.h"</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include "<a class="code" href="prom__metric_8h.html">prom_metric.h</a>"</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c"> 32</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span>prom_collector <a class="code" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a>;</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40"> 43</a></span> <span class="keyword">typedef</span> prom_map_t* <a class="code" href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40">prom_collect_fn</a>(<a class="code" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a>* <span class="keyword">self</span>);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <a class="code" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a>* <a class="code" href="prom__collector_8h.html#a4300cf33b6f8e4457df385c3d2a51a4b">prom_collector_new</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name);</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> </div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <a class="code" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a>* <a class="code" href="prom__collector_8h.html#af50746bb4af87eda617fa08237e3834e">prom_collector_process_new</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *limits_path, <span class="keyword">const</span> <span class="keywordtype">char</span> *stat_path);</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector_8h.html#a037b72b2edb81a477999a7dfc08758c7">prom_collector_destroy</a>(<a class="code" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> </div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="keywordtype">void</span> <a class="code" href="prom__collector_8h.html#a875b72940cd578ee76c71f1f4853f139">prom_collector_free_generic</a>(<span class="keywordtype">void</span> *gen);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector_8h.html#a12c297cce0a30ee4149f2b486d9f0337">prom_collector_destroy_generic</a>(<span class="keywordtype">void</span> *gen);</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector_8h.html#abd87021bd63f759d55642685a74874ee">prom_collector_add_metric</a>(<a class="code" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *<span class="keyword">self</span>, <a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *metric);</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> </div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector_8h.html#a9929cb81f4fb49ffca8aa880a4699650">prom_collector_set_collect_fn</a>(<a class="code" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *<span class="keyword">self</span>, <a class="code" href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40">prom_collect_fn</a> *fn);</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="preprocessor">#endif // PROM_COLLECTOR_H</span></div><div class="ttc" id="prom__collector_8h_html_a28cf36f114f69a96508c044c44716f9c"><div class="ttname"><a href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a></div><div class="ttdeci">struct prom_collector prom_collector_t</div><div class="ttdoc">A prometheus collector calls collect to prepare metrics and return them to the registry to which it i...</div><div class="ttdef"><b>Definition:</b> prom_collector.h:32</div></div> +<div class="ttc" id="prom__metric_8h_html_afd1bd014c48955d6c2c36aa8a8cbb889"><div class="ttname"><a href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a></div><div class="ttdeci">struct prom_metric prom_metric_t</div><div class="ttdoc">A prometheus metric. </div><div class="ttdef"><b>Definition:</b> prom_metric.h:34</div></div> +<div class="ttc" id="prom__collector_8h_html_abd87021bd63f759d55642685a74874ee"><div class="ttname"><a href="prom__collector_8h.html#abd87021bd63f759d55642685a74874ee">prom_collector_add_metric</a></div><div class="ttdeci">int prom_collector_add_metric(prom_collector_t *self, prom_metric_t *metric)</div><div class="ttdoc">Add a metric to a collector. </div></div> +<div class="ttc" id="prom__collector_8h_html_a037b72b2edb81a477999a7dfc08758c7"><div class="ttname"><a href="prom__collector_8h.html#a037b72b2edb81a477999a7dfc08758c7">prom_collector_destroy</a></div><div class="ttdeci">int prom_collector_destroy(prom_collector_t *self)</div><div class="ttdoc">Destroy a collector. </div></div> +<div class="ttc" id="prom__collector_8h_html_a9929cb81f4fb49ffca8aa880a4699650"><div class="ttname"><a href="prom__collector_8h.html#a9929cb81f4fb49ffca8aa880a4699650">prom_collector_set_collect_fn</a></div><div class="ttdeci">int prom_collector_set_collect_fn(prom_collector_t *self, prom_collect_fn *fn)</div><div class="ttdoc">The collect function is responsible for doing any work involving a set of metrics and then returning ...</div></div> +<div class="ttc" id="prom__collector_8h_html_a4300cf33b6f8e4457df385c3d2a51a4b"><div class="ttname"><a href="prom__collector_8h.html#a4300cf33b6f8e4457df385c3d2a51a4b">prom_collector_new</a></div><div class="ttdeci">prom_collector_t * prom_collector_new(const char *name)</div><div class="ttdoc">Create a collector. </div></div> +<div class="ttc" id="prom__collector_8h_html_a875b72940cd578ee76c71f1f4853f139"><div class="ttname"><a href="prom__collector_8h.html#a875b72940cd578ee76c71f1f4853f139">prom_collector_free_generic</a></div><div class="ttdeci">void prom_collector_free_generic(void *gen)</div><div class="ttdoc">Frees a collector passed as a void pointer. </div></div> +<div class="ttc" id="prom__collector_8h_html_af50746bb4af87eda617fa08237e3834e"><div class="ttname"><a href="prom__collector_8h.html#af50746bb4af87eda617fa08237e3834e">prom_collector_process_new</a></div><div class="ttdeci">prom_collector_t * prom_collector_process_new(const char *limits_path, const char *stat_path)</div><div class="ttdoc">Construct a prom_collector_t* which includes the default process metrics. </div></div> +<div class="ttc" id="prom__metric_8h_html"><div class="ttname"><a href="prom__metric_8h.html">prom_metric.h</a></div><div class="ttdoc">Functions for retrieving metric samples from metrics given an ordered set of labels. </div></div> +<div class="ttc" id="prom__collector_8h_html_a12c297cce0a30ee4149f2b486d9f0337"><div class="ttname"><a href="prom__collector_8h.html#a12c297cce0a30ee4149f2b486d9f0337">prom_collector_destroy_generic</a></div><div class="ttdeci">int prom_collector_destroy_generic(void *gen)</div><div class="ttdoc">Destroys a collector passed as a void pointer. </div></div> +<div class="ttc" id="prom__collector_8h_html_af87330edd48cdb8e1074517e734b1e40"><div class="ttname"><a href="prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40">prom_collect_fn</a></div><div class="ttdeci">prom_map_t * prom_collect_fn(prom_collector_t *self)</div><div class="ttdoc">The function responsible for preparing metric data and returning metrics for a given collector...</div><div class="ttdef"><b>Definition:</b> prom_collector.h:43</div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__collector__registry_8h.html b/docs/prom__collector__registry_8h.html new file mode 100644 index 0000000..22af601 --- /dev/null +++ b/docs/prom__collector__registry_8h.html @@ -0,0 +1,442 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_collector_registry.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> | +<a href="#var-members">Variables</a> </div> + <div class="headertitle"> +<div class="title">prom_collector_registry.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>The collector registry registers collectors for metric exposition. +<a href="#details">More...</a></p> +<div class="textblock"><code>#include "<a class="el" href="prom__collector_8h_source.html">prom_collector.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__metric_8h_source.html">prom_metric.h</a>"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom_collector_registry.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__collector__registry_8h__incl.png" border="0" usemap="#prom_2include_2prom__collector__registry_8h" alt=""/></div> +<map name="prom_2include_2prom__collector__registry_8h" id="prom_2include_2prom__collector__registry_8h"> +<area shape="rect" id="node2" href="prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="24,95,155,121"/> +<area shape="rect" id="node4" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="133,169,251,196"/> +<area shape="rect" id="node3" href="prom__map_8h_source.html" title="prom_map.h" alt="" coords="5,169,109,196"/> +<area shape="rect" id="node5" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="11,251,183,278"/> +<area shape="rect" id="node6" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="208,244,368,285"/> +</map> +</div> +</div><div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__collector__registry_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__collector__registry_8hdep" alt=""/></div> +<map name="prom_2include_2prom__collector__registry_8hdep" id="prom_2include_2prom__collector__registry_8hdep"> +<area shape="rect" id="node2" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="5,95,163,121"/> +<area shape="rect" id="node3" href="promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="187,95,397,121"/> +</map> +</div> +</div> +<p><a href="prom__collector__registry_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:a20f07748401fbbde9efc8a718f9bc202"><td class="memItemLeft" align="right" valign="top"><a id="a20f07748401fbbde9efc8a718f9bc202"></a> +typedef struct prom_collector_registry </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a></td></tr> +<tr class="memdesc:a20f07748401fbbde9efc8a718f9bc202"><td class="mdescLeft"> </td><td class="mdescRight">A prom_registry_t is responsible for registering metrics and briding them to the string exposition format. <br /></td></tr> +<tr class="separator:a20f07748401fbbde9efc8a718f9bc202"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:aaf1421bd744f0dbbdaba7e64cec11f54"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54">prom_collector_registry_default_init</a> (void)</td></tr> +<tr class="memdesc:aaf1421bd744f0dbbdaba7e64cec11f54"><td class="mdescLeft"> </td><td class="mdescRight">Initializes the default collector registry and enables metric collection on the executing process. <a href="#aaf1421bd744f0dbbdaba7e64cec11f54">More...</a><br /></td></tr> +<tr class="separator:aaf1421bd744f0dbbdaba7e64cec11f54"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:ab5d622258998978c528253f07e2903b8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#ab5d622258998978c528253f07e2903b8">prom_collector_registry_new</a> (const char *name)</td></tr> +<tr class="memdesc:ab5d622258998978c528253f07e2903b8"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a prom_collector_registry_t*. <a href="#ab5d622258998978c528253f07e2903b8">More...</a><br /></td></tr> +<tr class="separator:ab5d622258998978c528253f07e2903b8"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:ad3854e6e40b6f741fde53dc65f0ecd87"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#ad3854e6e40b6f741fde53dc65f0ecd87">prom_collector_registry_destroy</a> (<a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *self)</td></tr> +<tr class="memdesc:ad3854e6e40b6f741fde53dc65f0ecd87"><td class="mdescLeft"> </td><td class="mdescRight">Destroy a collector registry. <a href="#ad3854e6e40b6f741fde53dc65f0ecd87">More...</a><br /></td></tr> +<tr class="separator:ad3854e6e40b6f741fde53dc65f0ecd87"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a0d59bf988de4ee29e076910fa7135071"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#a0d59bf988de4ee29e076910fa7135071">prom_collector_registry_enable_process_metrics</a> (<a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *self)</td></tr> +<tr class="memdesc:a0d59bf988de4ee29e076910fa7135071"><td class="mdescLeft"> </td><td class="mdescRight">Enable process metrics on the given collector registry. <a href="#a0d59bf988de4ee29e076910fa7135071">More...</a><br /></td></tr> +<tr class="separator:a0d59bf988de4ee29e076910fa7135071"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a113683f4e15ad9240a37ed2139ddaea6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#a113683f4e15ad9240a37ed2139ddaea6">prom_collector_registry_must_register_metric</a> (<a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *metric)</td></tr> +<tr class="memdesc:a113683f4e15ad9240a37ed2139ddaea6"><td class="mdescLeft"> </td><td class="mdescRight">Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. <a href="#a113683f4e15ad9240a37ed2139ddaea6">More...</a><br /></td></tr> +<tr class="separator:a113683f4e15ad9240a37ed2139ddaea6"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:aa735fa0fbe03d6d9a0d11eb4792ec761"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#aa735fa0fbe03d6d9a0d11eb4792ec761">prom_collector_registry_register_metric</a> (<a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *metric)</td></tr> +<tr class="memdesc:aa735fa0fbe03d6d9a0d11eb4792ec761"><td class="mdescLeft"> </td><td class="mdescRight">Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. <a href="#aa735fa0fbe03d6d9a0d11eb4792ec761">More...</a><br /></td></tr> +<tr class="separator:aa735fa0fbe03d6d9a0d11eb4792ec761"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a42203da085c6c6f2bc3ba31501683882"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#a42203da085c6c6f2bc3ba31501683882">prom_collector_registry_register_collector</a> (<a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *self, <a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *collector)</td></tr> +<tr class="memdesc:a42203da085c6c6f2bc3ba31501683882"><td class="mdescLeft"> </td><td class="mdescRight">Register a collector with the given registry. <a href="#a42203da085c6c6f2bc3ba31501683882">More...</a><br /></td></tr> +<tr class="separator:a42203da085c6c6f2bc3ba31501683882"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a0149a2702ae0b3ff39d57904d613c14f"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#a0149a2702ae0b3ff39d57904d613c14f">prom_collector_registry_bridge</a> (<a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *self)</td></tr> +<tr class="memdesc:a0149a2702ae0b3ff39d57904d613c14f"><td class="mdescLeft"> </td><td class="mdescRight">Returns a string in the default metric exposition format. <a href="#a0149a2702ae0b3ff39d57904d613c14f">More...</a><br /></td></tr> +<tr class="separator:a0149a2702ae0b3ff39d57904d613c14f"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:acf002221c3239584723f9fb15c53e15e"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#acf002221c3239584723f9fb15c53e15e">prom_collector_registry_validate_metric_name</a> (<a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *self, const char *metric_name)</td></tr> +<tr class="memdesc:acf002221c3239584723f9fb15c53e15e"><td class="mdescLeft"> </td><td class="mdescRight">Validates that the given metric name complies with the specification: <a href="#acf002221c3239584723f9fb15c53e15e">More...</a><br /></td></tr> +<tr class="separator:acf002221c3239584723f9fb15c53e15e"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a> +Variables</h2></td></tr> +<tr class="memitem:a6092b48e150390c1927da5fe8914981b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__collector__registry_8h.html#a6092b48e150390c1927da5fe8914981b">PROM_COLLECTOR_REGISTRY_DEFAULT</a></td></tr> +<tr class="memdesc:a6092b48e150390c1927da5fe8914981b"><td class="mdescLeft"> </td><td class="mdescRight">Initialize the default registry by calling prom_collector_registry_init within your program. <a href="#a6092b48e150390c1927da5fe8914981b">More...</a><br /></td></tr> +<tr class="separator:a6092b48e150390c1927da5fe8914981b"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>The collector registry registers collectors for metric exposition. </p> +</div><h2 class="groupheader">Function Documentation</h2> +<a id="a0149a2702ae0b3ff39d57904d613c14f"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a0149a2702ae0b3ff39d57904d613c14f">◆ </a></span>prom_collector_registry_bridge()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">const char* prom_collector_registry_bridge </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Returns a string in the default metric exposition format. </p> +<p>The string MUST be freed to avoid unnecessary heap memory growth.</p> +<p>Reference: <a href="https://prometheus.io/docs/instrumenting/exposition_formats/">https://prometheus.io/docs/instrumenting/exposition_formats/</a></p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_registry_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The string int he default metric exposition format. </dd></dl> + +</div> +</div> +<a id="aaf1421bd744f0dbbdaba7e64cec11f54"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aaf1421bd744f0dbbdaba7e64cec11f54">◆ </a></span>prom_collector_registry_default_init()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_registry_default_init </td> + <td>(</td> + <td class="paramtype">void </td> + <td class="paramname"></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Initializes the default collector registry and enables metric collection on the executing process. </p> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="ad3854e6e40b6f741fde53dc65f0ecd87"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ad3854e6e40b6f741fde53dc65f0ecd87">◆ </a></span>prom_collector_registry_destroy()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_registry_destroy </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Destroy a collector registry. </p> +<p>You MUST set self to NULL after destruction. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_registry_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="a0d59bf988de4ee29e076910fa7135071"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a0d59bf988de4ee29e076910fa7135071">◆ </a></span>prom_collector_registry_enable_process_metrics()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_registry_enable_process_metrics </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Enable process metrics on the given collector registry. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_registry_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="a113683f4e15ad9240a37ed2139ddaea6"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a113683f4e15ad9240a37ed2139ddaea6">◆ </a></span>prom_collector_registry_must_register_metric()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a>* prom_collector_registry_must_register_metric </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> * </td> + <td class="paramname"><em>metric</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. </p> +<p>The metric to be registered MUST NOT already be registered with the given . If so, the program will halt. It returns a prom_metric_t* to simplify metric creation and registration. Furthermore, PROM_DEFAULT_COLLECTOR_REGISTRY must be registered via <a class="el" href="prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54" title="Initializes the default collector registry and enables metric collection on the executing process...">prom_collector_registry_default_init()</a> prior to calling this function. The metric will be added to the default registry's default collector.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">metric</td><td>The metric to register on PROM_DEFAULT_COLLECTOR_REGISTRY* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The registered prom_metric_t* </dd></dl> + +</div> +</div> +<a id="ab5d622258998978c528253f07e2903b8"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ab5d622258998978c528253f07e2903b8">◆ </a></span>prom_collector_registry_new()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a>* prom_collector_registry_new </td> + <td>(</td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>name</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Constructs a prom_collector_registry_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">name</td><td>The name of the collector registry. It MUST NOT be default. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_collector_registry_t* </dd></dl> + +</div> +</div> +<a id="a42203da085c6c6f2bc3ba31501683882"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a42203da085c6c6f2bc3ba31501683882">◆ </a></span>prom_collector_registry_register_collector()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_registry_register_collector </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype"><a class="el" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> * </td> + <td class="paramname"><em>collector</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Register a collector with the given registry. </p> +<p>Returns a non-zero integer value on failure. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_registry_t* </td></tr> + <tr><td class="paramname">collector</td><td>The prom_collector_t* to register onto the prom_collector_registry_t* as self </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="aa735fa0fbe03d6d9a0d11eb4792ec761"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aa735fa0fbe03d6d9a0d11eb4792ec761">◆ </a></span>prom_collector_registry_register_metric()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_registry_register_metric </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> * </td> + <td class="paramname"><em>metric</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. </p> +<p>Returns an non-zero integer value on failure.</p> +<p>See prom_collector_registry_must_register_metric.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">metric</td><td>The metric to register on PROM_DEFAULT_COLLECTOR_REGISTRY* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="acf002221c3239584723f9fb15c53e15e"></a> +<h2 class="memtitle"><span class="permalink"><a href="#acf002221c3239584723f9fb15c53e15e">◆ </a></span>prom_collector_registry_validate_metric_name()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_collector_registry_validate_metric_name </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>metric_name</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Validates that the given metric name complies with the specification: </p> +<p>Reference: <a href="https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels">https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels</a></p> +<p>Returns a non-zero integer value on failure.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_collector_registry_t* </td></tr> + <tr><td class="paramname">metric_name</td><td>The metric name to validate </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure </dd></dl> + +</div> +</div> +<h2 class="groupheader">Variable Documentation</h2> +<a id="a6092b48e150390c1927da5fe8914981b"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a6092b48e150390c1927da5fe8914981b">◆ </a></span>PROM_COLLECTOR_REGISTRY_DEFAULT</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a>* PROM_COLLECTOR_REGISTRY_DEFAULT</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Initialize the default registry by calling prom_collector_registry_init within your program. </p> +<p>You MUST NOT modify this value. </p> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__collector__registry_8h__dep__incl.dot b/docs/prom__collector__registry_8h__dep__incl.dot new file mode 100644 index 0000000..18cfa2e --- /dev/null +++ b/docs/prom__collector__registry_8h__dep__incl.dot @@ -0,0 +1,10 @@ +digraph "prom/include/prom_collector_registry.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node7 [label="prom/include/prom_collector\l_registry.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node7 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node8 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; +} diff --git a/docs/prom__collector__registry_8h__dep__incl.map b/docs/prom__collector__registry_8h__dep__incl.map new file mode 100644 index 0000000..50e0594 --- /dev/null +++ b/docs/prom__collector__registry_8h__dep__incl.map @@ -0,0 +1,4 @@ +<map id="prom/include/prom_collector_registry.h" name="prom/include/prom_collector_registry.h"> +<area shape="rect" id="node2" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="5,95,163,121"/> +<area shape="rect" id="node3" href="$promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="187,95,397,121"/> +</map> diff --git a/docs/prom__collector__registry_8h__dep__incl.md5 b/docs/prom__collector__registry_8h__dep__incl.md5 new file mode 100644 index 0000000..38641f3 --- /dev/null +++ b/docs/prom__collector__registry_8h__dep__incl.md5 @@ -0,0 +1 @@ +5a1243c1b32399d7faa747e6b084c4b1
\ No newline at end of file diff --git a/docs/prom__collector__registry_8h__dep__incl.png b/docs/prom__collector__registry_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..ee24ede --- /dev/null +++ b/docs/prom__collector__registry_8h__dep__incl.png diff --git a/docs/prom__collector__registry_8h__incl.dot b/docs/prom__collector__registry_8h__incl.dot new file mode 100644 index 0000000..57b5c64 --- /dev/null +++ b/docs/prom__collector__registry_8h__incl.dot @@ -0,0 +1,22 @@ +digraph "prom/include/prom_collector_registry.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom_collector\l_registry.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector_8h.html",tooltip="A Prometheus collector returns a collection of metrics. "]; + Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; + Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom_map.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__map_8h_source.html"]; + Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom_metric_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node5 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 [label="prom_metric_sample\l_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node6 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__collector__registry_8h__incl.map b/docs/prom__collector__registry_8h__incl.map new file mode 100644 index 0000000..d1056b4 --- /dev/null +++ b/docs/prom__collector__registry_8h__incl.map @@ -0,0 +1,7 @@ +<map id="prom/include/prom_collector_registry.h" name="prom/include/prom_collector_registry.h"> +<area shape="rect" id="node2" href="$prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="24,95,155,121"/> +<area shape="rect" id="node4" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="133,169,251,196"/> +<area shape="rect" id="node3" href="$prom__map_8h_source.html" title="prom_map.h" alt="" coords="5,169,109,196"/> +<area shape="rect" id="node5" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="11,251,183,278"/> +<area shape="rect" id="node6" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="208,244,368,285"/> +</map> diff --git a/docs/prom__collector__registry_8h__incl.md5 b/docs/prom__collector__registry_8h__incl.md5 new file mode 100644 index 0000000..6fbc15c --- /dev/null +++ b/docs/prom__collector__registry_8h__incl.md5 @@ -0,0 +1 @@ +72a7bb4f70815b45c471e5067710d62d
\ No newline at end of file diff --git a/docs/prom__collector__registry_8h__incl.png b/docs/prom__collector__registry_8h__incl.png Binary files differnew file mode 100644 index 0000000..8efbae6 --- /dev/null +++ b/docs/prom__collector__registry_8h__incl.png diff --git a/docs/prom__collector__registry_8h_source.html b/docs/prom__collector__registry_8h_source.html new file mode 100644 index 0000000..b5f3d03 --- /dev/null +++ b/docs/prom__collector__registry_8h_source.html @@ -0,0 +1,94 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_collector_registry.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_collector_registry.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__collector__registry_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef PROM_REGISTRY_H</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define PROM_REGISTRY_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include "<a class="code" href="prom__collector_8h.html">prom_collector.h</a>"</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include "<a class="code" href="prom__metric_8h.html">prom_metric.h</a>"</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202"> 31</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span>prom_collector_registry <a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a>;</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="keyword">extern</span> <a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *<a class="code" href="prom__collector__registry_8h.html#a6092b48e150390c1927da5fe8914981b">PROM_COLLECTOR_REGISTRY_DEFAULT</a>;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54">prom_collector_registry_default_init</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a>* <a class="code" href="prom__collector__registry_8h.html#ab5d622258998978c528253f07e2903b8">prom_collector_registry_new</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name);</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> </div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector__registry_8h.html#ad3854e6e40b6f741fde53dc65f0ecd87">prom_collector_registry_destroy</a>(<a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector__registry_8h.html#a0d59bf988de4ee29e076910fa7135071">prom_collector_registry_enable_process_metrics</a>(<a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a>* <a class="code" href="prom__collector__registry_8h.html#a113683f4e15ad9240a37ed2139ddaea6">prom_collector_registry_must_register_metric</a>(<a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *metric);</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector__registry_8h.html#aa735fa0fbe03d6d9a0d11eb4792ec761">prom_collector_registry_register_metric</a>(<a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *metric);</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> </div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector__registry_8h.html#a42203da085c6c6f2bc3ba31501683882">prom_collector_registry_register_collector</a>(<a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *<span class="keyword">self</span>, <a class="code" href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a> *collector);</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="prom__collector__registry_8h.html#a0149a2702ae0b3ff39d57904d613c14f">prom_collector_registry_bridge</a>(<a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> <span class="keywordtype">int</span> <a class="code" href="prom__collector__registry_8h.html#acf002221c3239584723f9fb15c53e15e">prom_collector_registry_validate_metric_name</a>(<a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *<span class="keyword">self</span>,</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *metric_name);</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="preprocessor">#endif // PROM_H</span></div><div class="ttc" id="prom__collector_8h_html_a28cf36f114f69a96508c044c44716f9c"><div class="ttname"><a href="prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c">prom_collector_t</a></div><div class="ttdeci">struct prom_collector prom_collector_t</div><div class="ttdoc">A prometheus collector calls collect to prepare metrics and return them to the registry to which it i...</div><div class="ttdef"><b>Definition:</b> prom_collector.h:32</div></div> +<div class="ttc" id="prom__collector__registry_8h_html_a0149a2702ae0b3ff39d57904d613c14f"><div class="ttname"><a href="prom__collector__registry_8h.html#a0149a2702ae0b3ff39d57904d613c14f">prom_collector_registry_bridge</a></div><div class="ttdeci">const char * prom_collector_registry_bridge(prom_collector_registry_t *self)</div><div class="ttdoc">Returns a string in the default metric exposition format. </div></div> +<div class="ttc" id="prom__collector__registry_8h_html_ad3854e6e40b6f741fde53dc65f0ecd87"><div class="ttname"><a href="prom__collector__registry_8h.html#ad3854e6e40b6f741fde53dc65f0ecd87">prom_collector_registry_destroy</a></div><div class="ttdeci">int prom_collector_registry_destroy(prom_collector_registry_t *self)</div><div class="ttdoc">Destroy a collector registry. </div></div> +<div class="ttc" id="prom__metric_8h_html_afd1bd014c48955d6c2c36aa8a8cbb889"><div class="ttname"><a href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a></div><div class="ttdeci">struct prom_metric prom_metric_t</div><div class="ttdoc">A prometheus metric. </div><div class="ttdef"><b>Definition:</b> prom_metric.h:34</div></div> +<div class="ttc" id="prom__collector__registry_8h_html_aaf1421bd744f0dbbdaba7e64cec11f54"><div class="ttname"><a href="prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54">prom_collector_registry_default_init</a></div><div class="ttdeci">int prom_collector_registry_default_init(void)</div><div class="ttdoc">Initializes the default collector registry and enables metric collection on the executing process...</div></div> +<div class="ttc" id="prom__collector_8h_html"><div class="ttname"><a href="prom__collector_8h.html">prom_collector.h</a></div><div class="ttdoc">A Prometheus collector returns a collection of metrics. </div></div> +<div class="ttc" id="prom__collector__registry_8h_html_ab5d622258998978c528253f07e2903b8"><div class="ttname"><a href="prom__collector__registry_8h.html#ab5d622258998978c528253f07e2903b8">prom_collector_registry_new</a></div><div class="ttdeci">prom_collector_registry_t * prom_collector_registry_new(const char *name)</div><div class="ttdoc">Constructs a prom_collector_registry_t*. </div></div> +<div class="ttc" id="prom__collector__registry_8h_html_a0d59bf988de4ee29e076910fa7135071"><div class="ttname"><a href="prom__collector__registry_8h.html#a0d59bf988de4ee29e076910fa7135071">prom_collector_registry_enable_process_metrics</a></div><div class="ttdeci">int prom_collector_registry_enable_process_metrics(prom_collector_registry_t *self)</div><div class="ttdoc">Enable process metrics on the given collector registry. </div></div> +<div class="ttc" id="prom__collector__registry_8h_html_a20f07748401fbbde9efc8a718f9bc202"><div class="ttname"><a href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a></div><div class="ttdeci">struct prom_collector_registry prom_collector_registry_t</div><div class="ttdoc">A prom_registry_t is responsible for registering metrics and briding them to the string exposition fo...</div><div class="ttdef"><b>Definition:</b> prom_collector_registry.h:31</div></div> +<div class="ttc" id="prom__collector__registry_8h_html_a113683f4e15ad9240a37ed2139ddaea6"><div class="ttname"><a href="prom__collector__registry_8h.html#a113683f4e15ad9240a37ed2139ddaea6">prom_collector_registry_must_register_metric</a></div><div class="ttdeci">prom_metric_t * prom_collector_registry_must_register_metric(prom_metric_t *metric)</div><div class="ttdoc">Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. ...</div></div> +<div class="ttc" id="prom__collector__registry_8h_html_a6092b48e150390c1927da5fe8914981b"><div class="ttname"><a href="prom__collector__registry_8h.html#a6092b48e150390c1927da5fe8914981b">PROM_COLLECTOR_REGISTRY_DEFAULT</a></div><div class="ttdeci">prom_collector_registry_t * PROM_COLLECTOR_REGISTRY_DEFAULT</div><div class="ttdoc">Initialize the default registry by calling prom_collector_registry_init within your program...</div></div> +<div class="ttc" id="prom__metric_8h_html"><div class="ttname"><a href="prom__metric_8h.html">prom_metric.h</a></div><div class="ttdoc">Functions for retrieving metric samples from metrics given an ordered set of labels. </div></div> +<div class="ttc" id="prom__collector__registry_8h_html_aa735fa0fbe03d6d9a0d11eb4792ec761"><div class="ttname"><a href="prom__collector__registry_8h.html#aa735fa0fbe03d6d9a0d11eb4792ec761">prom_collector_registry_register_metric</a></div><div class="ttdeci">int prom_collector_registry_register_metric(prom_metric_t *metric)</div><div class="ttdoc">Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. ...</div></div> +<div class="ttc" id="prom__collector__registry_8h_html_acf002221c3239584723f9fb15c53e15e"><div class="ttname"><a href="prom__collector__registry_8h.html#acf002221c3239584723f9fb15c53e15e">prom_collector_registry_validate_metric_name</a></div><div class="ttdeci">int prom_collector_registry_validate_metric_name(prom_collector_registry_t *self, const char *metric_name)</div><div class="ttdoc">Validates that the given metric name complies with the specification: </div></div> +<div class="ttc" id="prom__collector__registry_8h_html_a42203da085c6c6f2bc3ba31501683882"><div class="ttname"><a href="prom__collector__registry_8h.html#a42203da085c6c6f2bc3ba31501683882">prom_collector_registry_register_collector</a></div><div class="ttdeci">int prom_collector_registry_register_collector(prom_collector_registry_t *self, prom_collector_t *collector)</div><div class="ttdoc">Register a collector with the given registry. </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__counter_8h.html b/docs/prom__counter_8h.html new file mode 100644 index 0000000..18d078a --- /dev/null +++ b/docs/prom__counter_8h.html @@ -0,0 +1,326 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_counter.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> </div> + <div class="headertitle"> +<div class="title">prom_counter.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p><a href="https://prometheus.io/docs/concepts/metric_types/#counter">https://prometheus.io/docs/concepts/metric_types/#counter</a> +<a href="#details">More...</a></p> +<div class="textblock"><code>#include <stdlib.h></code><br /> +<code>#include "<a class="el" href="prom__metric_8h_source.html">prom_metric.h</a>"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom_counter.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__counter_8h__incl.png" border="0" usemap="#prom_2include_2prom__counter_8h" alt=""/></div> +<map name="prom_2include_2prom__counter_8h" id="prom_2include_2prom__counter_8h"> +<area shape="rect" id="node3" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="129,80,246,107"/> +<area shape="rect" id="node4" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="5,162,177,189"/> +<area shape="rect" id="node5" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="202,155,362,196"/> +</map> +</div> +</div><div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__counter_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__counter_8hdep" alt=""/></div> +<map name="prom_2include_2prom__counter_8hdep" id="prom_2include_2prom__counter_8hdep"> +<area shape="rect" id="node2" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="33,80,190,107"/> +</map> +</div> +</div> +<p><a href="prom__counter_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:a814ceed99a1d618334e51f4d0e160606"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a></td></tr> +<tr class="memdesc:a814ceed99a1d618334e51f4d0e160606"><td class="mdescLeft"> </td><td class="mdescRight">A prometheus counter. <a href="#a814ceed99a1d618334e51f4d0e160606">More...</a><br /></td></tr> +<tr class="separator:a814ceed99a1d618334e51f4d0e160606"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a3302a9f1a3556d17af9af29729be2651"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651">prom_counter_new</a> (const char *name, const char *help, size_t label_key_count, const char **label_keys)</td></tr> +<tr class="memdesc:a3302a9f1a3556d17af9af29729be2651"><td class="mdescLeft"> </td><td class="mdescRight">Construct a prom_counter_t*. <a href="#a3302a9f1a3556d17af9af29729be2651">More...</a><br /></td></tr> +<tr class="separator:a3302a9f1a3556d17af9af29729be2651"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:ac36abc71c11df1e774c8c102b1fdb78d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#ac36abc71c11df1e774c8c102b1fdb78d">prom_counter_destroy</a> (<a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *self)</td></tr> +<tr class="memdesc:ac36abc71c11df1e774c8c102b1fdb78d"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a prom_counter_t*. <a href="#ac36abc71c11df1e774c8c102b1fdb78d">More...</a><br /></td></tr> +<tr class="separator:ac36abc71c11df1e774c8c102b1fdb78d"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a315695fdd8b9b6fa59904bb2e35bfa35"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35">prom_counter_inc</a> (<a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *self, const char **label_values)</td></tr> +<tr class="memdesc:a315695fdd8b9b6fa59904bb2e35bfa35"><td class="mdescLeft"> </td><td class="mdescRight">Increment the prom_counter_t by 1. <a href="#a315695fdd8b9b6fa59904bb2e35bfa35">More...</a><br /></td></tr> +<tr class="separator:a315695fdd8b9b6fa59904bb2e35bfa35"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:addd8a7efc39e17d30b2267e5a0a626db"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#addd8a7efc39e17d30b2267e5a0a626db">prom_counter_add</a> (<a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *self, double r_value, const char **label_values)</td></tr> +<tr class="memdesc:addd8a7efc39e17d30b2267e5a0a626db"><td class="mdescLeft"> </td><td class="mdescRight">Add the value to the prom_counter_t*. <a href="#addd8a7efc39e17d30b2267e5a0a626db">More...</a><br /></td></tr> +<tr class="separator:addd8a7efc39e17d30b2267e5a0a626db"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p><a href="https://prometheus.io/docs/concepts/metric_types/#counter">https://prometheus.io/docs/concepts/metric_types/#counter</a> </p> +</div><h2 class="groupheader">Typedef Documentation</h2> +<a id="a814ceed99a1d618334e51f4d0e160606"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a814ceed99a1d618334e51f4d0e160606">◆ </a></span>prom_counter_t</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">typedef <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> <a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>A prometheus counter. </p> +<p>References</p><ul> +<li>See <a href="https://prometheus.io/docs/concepts/metric_types/#counter">https://prometheus.io/docs/concepts/metric_types/#counter</a> </li> +</ul> + +</div> +</div> +<h2 class="groupheader">Function Documentation</h2> +<a id="addd8a7efc39e17d30b2267e5a0a626db"></a> +<h2 class="memtitle"><span class="permalink"><a href="#addd8a7efc39e17d30b2267e5a0a626db">◆ </a></span>prom_counter_add()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_counter_add </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>r_value</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Add the value to the prom_counter_t*. </p> +<p>A non-zero integer value will be returned on failure. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_counter_t* </td></tr> + <tr><td class="paramname">r_value</td><td>The double to add to the prom_counter_t passed as self. The value MUST be greater than or equal to 0. </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the counter's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure.</dd></dl> +<p><em>Example</em> </p><pre class="fragment">// An example with labels +prom_counter_add(foo_counter, 22, (const char**) { "bar", "bang" }); + +// An example without labels +prom_counter_add(foo_counter, 22, NULL);</pre> +</div> +</div> +<a id="ac36abc71c11df1e774c8c102b1fdb78d"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ac36abc71c11df1e774c8c102b1fdb78d">◆ </a></span>prom_counter_destroy()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_counter_destroy </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Destroys a prom_counter_t*. </p> +<p>You must set self to NULL after destruction. A non-zero integer value will be returned on failure. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>A prom_counter_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure. </dd></dl> + +</div> +</div> +<a id="a315695fdd8b9b6fa59904bb2e35bfa35"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a315695fdd8b9b6fa59904bb2e35bfa35">◆ </a></span>prom_counter_inc()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_counter_inc </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Increment the prom_counter_t by 1. </p> +<p>A non-zero integer value will be returned on failure. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_counter_t* </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the counter's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure.</dd></dl> +<p><em>Example</em> </p><pre class="fragment">// An example with labels +prom_counter_inc(foo_counter, (const char**) { "bar", "bang" }); + +// An example without labels +prom_counter_inc(foo_counter, NULL);</pre> +</div> +</div> +<a id="a3302a9f1a3556d17af9af29729be2651"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a3302a9f1a3556d17af9af29729be2651">◆ </a></span>prom_counter_new()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a>* prom_counter_new </td> + <td>(</td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>name</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>help</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t </td> + <td class="paramname"><em>label_key_count</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_keys</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Construct a prom_counter_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">name</td><td>The name of the metric </td></tr> + <tr><td class="paramname">help</td><td>The metric description </td></tr> + <tr><td class="paramname">label_key_count</td><td>The number of labels associated with the given metric. Pass 0 if the metric does not require labels. </td></tr> + <tr><td class="paramname">label_keys</td><td>A collection of label keys. The number of keys MUST match the value passed as label_key_count. If no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_counter_t*</dd></dl> +<p><em>Example</em> </p><pre class="fragment">// An example with labels +prom_counter_new("foo", "foo is a counter with labels", 2, (const char**) { "one", "two" }); + +// An example without labels +prom_counter_new("foo", "foo is a counter without labels", 0, NULL);</pre> +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__counter_8h__dep__incl.dot b/docs/prom__counter_8h__dep__incl.dot new file mode 100644 index 0000000..6edb93a --- /dev/null +++ b/docs/prom__counter_8h__dep__incl.dot @@ -0,0 +1,10 @@ +digraph "prom/include/prom_counter.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node6 [label="prom/include/prom_counter.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node6 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node7 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; +} diff --git a/docs/prom__counter_8h__dep__incl.map b/docs/prom__counter_8h__dep__incl.map new file mode 100644 index 0000000..41bb7ee --- /dev/null +++ b/docs/prom__counter_8h__dep__incl.map @@ -0,0 +1,3 @@ +<map id="prom/include/prom_counter.h" name="prom/include/prom_counter.h"> +<area shape="rect" id="node2" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="33,80,190,107"/> +</map> diff --git a/docs/prom__counter_8h__dep__incl.md5 b/docs/prom__counter_8h__dep__incl.md5 new file mode 100644 index 0000000..ed9ac7f --- /dev/null +++ b/docs/prom__counter_8h__dep__incl.md5 @@ -0,0 +1 @@ +9a9ee0d2f72c4aa1d328ca051d3fd824
\ No newline at end of file diff --git a/docs/prom__counter_8h__dep__incl.png b/docs/prom__counter_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..5e2a532 --- /dev/null +++ b/docs/prom__counter_8h__dep__incl.png diff --git a/docs/prom__counter_8h__incl.dot b/docs/prom__counter_8h__incl.dot new file mode 100644 index 0000000..0ee6c85 --- /dev/null +++ b/docs/prom__counter_8h__incl.dot @@ -0,0 +1,18 @@ +digraph "prom/include/prom_counter.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom_counter.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node0 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; + Node0 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom_metric_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node4 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom_metric_sample\l_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node5 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__counter_8h__incl.map b/docs/prom__counter_8h__incl.map new file mode 100644 index 0000000..131414f --- /dev/null +++ b/docs/prom__counter_8h__incl.map @@ -0,0 +1,5 @@ +<map id="prom/include/prom_counter.h" name="prom/include/prom_counter.h"> +<area shape="rect" id="node3" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="129,80,246,107"/> +<area shape="rect" id="node4" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="5,162,177,189"/> +<area shape="rect" id="node5" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="202,155,362,196"/> +</map> diff --git a/docs/prom__counter_8h__incl.md5 b/docs/prom__counter_8h__incl.md5 new file mode 100644 index 0000000..719df5b --- /dev/null +++ b/docs/prom__counter_8h__incl.md5 @@ -0,0 +1 @@ +f79807ba83430dd8bb7c3aa0fdf691fd
\ No newline at end of file diff --git a/docs/prom__counter_8h__incl.png b/docs/prom__counter_8h__incl.png Binary files differnew file mode 100644 index 0000000..ca92dd3 --- /dev/null +++ b/docs/prom__counter_8h__incl.png diff --git a/docs/prom__counter_8h_source.html b/docs/prom__counter_8h_source.html new file mode 100644 index 0000000..8d3cc08 --- /dev/null +++ b/docs/prom__counter_8h_source.html @@ -0,0 +1,86 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_counter.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_counter.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__counter_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> </div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#ifndef PROM_COUNTER_H</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#define PROM_COUNTER_H</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include "<a class="code" href="prom__metric_8h.html">prom_metric.h</a>"</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606"> 36</a></span> <span class="keyword">typedef</span> <a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> <a class="code" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a>;</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <a class="code" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a>* <a class="code" href="prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651">prom_counter_new</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *help,</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordtype">size_t</span> label_key_count,</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> **label_keys);</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> <span class="keywordtype">int</span> <a class="code" href="prom__counter_8h.html#ac36abc71c11df1e774c8c102b1fdb78d">prom_counter_destroy</a>(<a class="code" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="keywordtype">int</span> <a class="code" href="prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35">prom_counter_inc</a>(<a class="code" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *<span class="keyword">self</span>, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> </div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="keywordtype">int</span> <a class="code" href="prom__counter_8h.html#addd8a7efc39e17d30b2267e5a0a626db">prom_counter_add</a>(<a class="code" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> r_value, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="preprocessor">#endif // PROM_COUNTER_H</span></div><div class="ttc" id="prom__counter_8h_html_addd8a7efc39e17d30b2267e5a0a626db"><div class="ttname"><a href="prom__counter_8h.html#addd8a7efc39e17d30b2267e5a0a626db">prom_counter_add</a></div><div class="ttdeci">int prom_counter_add(prom_counter_t *self, double r_value, const char **label_values)</div><div class="ttdoc">Add the value to the prom_counter_t*. </div></div> +<div class="ttc" id="prom__counter_8h_html_a315695fdd8b9b6fa59904bb2e35bfa35"><div class="ttname"><a href="prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35">prom_counter_inc</a></div><div class="ttdeci">int prom_counter_inc(prom_counter_t *self, const char **label_values)</div><div class="ttdoc">Increment the prom_counter_t by 1. </div></div> +<div class="ttc" id="prom__metric_8h_html_afd1bd014c48955d6c2c36aa8a8cbb889"><div class="ttname"><a href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a></div><div class="ttdeci">struct prom_metric prom_metric_t</div><div class="ttdoc">A prometheus metric. </div><div class="ttdef"><b>Definition:</b> prom_metric.h:34</div></div> +<div class="ttc" id="prom__counter_8h_html_a814ceed99a1d618334e51f4d0e160606"><div class="ttname"><a href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a></div><div class="ttdeci">prom_metric_t prom_counter_t</div><div class="ttdoc">A prometheus counter. </div><div class="ttdef"><b>Definition:</b> prom_counter.h:36</div></div> +<div class="ttc" id="prom__counter_8h_html_ac36abc71c11df1e774c8c102b1fdb78d"><div class="ttname"><a href="prom__counter_8h.html#ac36abc71c11df1e774c8c102b1fdb78d">prom_counter_destroy</a></div><div class="ttdeci">int prom_counter_destroy(prom_counter_t *self)</div><div class="ttdoc">Destroys a prom_counter_t*. </div></div> +<div class="ttc" id="prom__metric_8h_html"><div class="ttname"><a href="prom__metric_8h.html">prom_metric.h</a></div><div class="ttdoc">Functions for retrieving metric samples from metrics given an ordered set of labels. </div></div> +<div class="ttc" id="prom__counter_8h_html_a3302a9f1a3556d17af9af29729be2651"><div class="ttname"><a href="prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651">prom_counter_new</a></div><div class="ttdeci">prom_counter_t * prom_counter_new(const char *name, const char *help, size_t label_key_count, const char **label_keys)</div><div class="ttdoc">Construct a prom_counter_t*. </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__errors_8h.html b/docs/prom__errors_8h.html new file mode 100644 index 0000000..af72f2a --- /dev/null +++ b/docs/prom__errors_8h.html @@ -0,0 +1,136 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_errors.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.0</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#enum-members">Enumerations</a> | +<a href="#func-members">Functions</a> | +<a href="#var-members">Variables</a> </div> + <div class="headertitle"> +<div class="title">prom_errors.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>Prometheus client errors. +<a href="#details">More...</a></p> +<div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__errors_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__errors_8hdep" alt=""/></div> +<map name="prom_2include_2prom__errors_8hdep" id="prom_2include_2prom__errors_8hdep"> +<area shape="rect" id="node2" href="prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="93,244,312,271"/> +<area shape="rect" id="node3" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="389,408,547,435"/> +<area shape="rect" id="node4" href="prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="223,319,431,360"/> +<area shape="rect" id="node5" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="67,80,261,121"/> +<area shape="rect" id="node7" href="prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="487,244,699,271"/> +<area shape="rect" id="node8" href="prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="723,244,927,271"/> +<area shape="rect" id="node9" href="prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="1003,244,1234,271"/> +<area shape="rect" id="node10" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="393,80,588,121"/> +<area shape="rect" id="node6" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="387,169,594,196"/> +</map> +</div> +</div> +<p><a href="prom__errors_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:a8015021744851db1ed84f9602be7462f"><td class="memItemLeft" align="right" valign="top"><a id="a8015021744851db1ed84f9602be7462f"></a> +typedef enum <a class="el" href="prom__errors_8h.html#ae9dcc70f3217ae6f5cd331dbdef06602">prom_return_code</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__errors_8h.html#a8015021744851db1ed84f9602be7462f">int</a></td></tr> +<tr class="memdesc:a8015021744851db1ed84f9602be7462f"><td class="mdescLeft"> </td><td class="mdescRight">Contains returns codes for functions. <br /></td></tr> +<tr class="separator:a8015021744851db1ed84f9602be7462f"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a> +Enumerations</h2></td></tr> +<tr class="memitem:ae9dcc70f3217ae6f5cd331dbdef06602"><td class="memItemLeft" align="right" valign="top"><a id="ae9dcc70f3217ae6f5cd331dbdef06602"></a>enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__errors_8h.html#ae9dcc70f3217ae6f5cd331dbdef06602">prom_return_code</a> { <b>PROM_SUCCESS</b>, +<b>PROM_FAILURE</b> + }<tr class="memdesc:ae9dcc70f3217ae6f5cd331dbdef06602"><td class="mdescLeft"> </td><td class="mdescRight">Contains returns codes for functions. <br /></td></tr> +</td></tr> +<tr class="separator:ae9dcc70f3217ae6f5cd331dbdef06602"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:abf8afd95318ab657b0a641477ff459a9"><td class="memItemLeft" align="right" valign="top"><a id="abf8afd95318ab657b0a641477ff459a9"></a> +const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__errors_8h.html#abf8afd95318ab657b0a641477ff459a9">prom_err_get</a> (<a class="el" href="prom__errors_8h.html#a8015021744851db1ed84f9602be7462f">int</a>)</td></tr> +<tr class="memdesc:abf8afd95318ab657b0a641477ff459a9"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the string value for the given int. <br /></td></tr> +<tr class="separator:abf8afd95318ab657b0a641477ff459a9"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a> +Variables</h2></td></tr> +<tr class="memitem:a5c9aa17d6a3215d88d05d65a0f966973"><td class="memItemLeft" align="right" valign="top"><a id="a5c9aa17d6a3215d88d05d65a0f966973"></a> +const char * </td><td class="memItemRight" valign="bottom"><b>prom_return_code_map</b> [2]</td></tr> +<tr class="separator:a5c9aa17d6a3215d88d05d65a0f966973"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Prometheus client errors. </p> +</div></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__errors_8h__dep__incl.dot b/docs/prom__errors_8h__dep__incl.dot new file mode 100644 index 0000000..d95d597 --- /dev/null +++ b/docs/prom__errors_8h__dep__incl.dot @@ -0,0 +1,40 @@ +digraph "prom/include/prom_errors.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node1 [label="prom/include/prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom/include/prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector_8h.html",tooltip="A Prometheus collector returns a collection of metrics. "]; + Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node3 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; + Node2 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom/include/prom_collector\l_registry.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector__registry_8h.html",tooltip="The collector registry registers collectors for metric exposition. "]; + Node5 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 [label="prom/include/prom_metric\l_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node6 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="prom/include/prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node7 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="prom/include/prom_counter.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__counter_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#counter "]; + Node8 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="prom/include/prom_gauge.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__gauge_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#gauge "]; + Node9 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 [label="prom/include/prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node10 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 -> Node11 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 [label="prom/include/prom_metric\l_sample_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node11 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__errors_8h__dep__incl.map b/docs/prom__errors_8h__dep__incl.map new file mode 100644 index 0000000..40920fe --- /dev/null +++ b/docs/prom__errors_8h__dep__incl.map @@ -0,0 +1,11 @@ +<map id="prom/include/prom_errors.h" name="prom/include/prom_errors.h"> +<area shape="rect" id="node2" href="$prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="93,244,312,271"/> +<area shape="rect" id="node3" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="389,408,547,435"/> +<area shape="rect" id="node4" href="$prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="223,319,431,360"/> +<area shape="rect" id="node5" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="67,80,261,121"/> +<area shape="rect" id="node7" href="$prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="487,244,699,271"/> +<area shape="rect" id="node8" href="$prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="723,244,927,271"/> +<area shape="rect" id="node9" href="$prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="1003,244,1234,271"/> +<area shape="rect" id="node10" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="393,80,588,121"/> +<area shape="rect" id="node6" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="387,169,594,196"/> +</map> diff --git a/docs/prom__errors_8h__dep__incl.md5 b/docs/prom__errors_8h__dep__incl.md5 new file mode 100644 index 0000000..903362e --- /dev/null +++ b/docs/prom__errors_8h__dep__incl.md5 @@ -0,0 +1 @@ +5ec144d3428dc6e5fd755b94a8cb2c0f
\ No newline at end of file diff --git a/docs/prom__errors_8h__dep__incl.png b/docs/prom__errors_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..62bcc90 --- /dev/null +++ b/docs/prom__errors_8h__dep__incl.png diff --git a/docs/prom__errors_8h_source.html b/docs/prom__errors_8h_source.html new file mode 100644 index 0000000..92adc59 --- /dev/null +++ b/docs/prom__errors_8h_source.html @@ -0,0 +1,82 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_errors.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.0</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_errors.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__errors_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#ifndef PROM_ERRORS_INCLUDED</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#define PROM_ERRORS_INCLUDED</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> </div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="prom__errors_8h.html#ae9dcc70f3217ae6f5cd331dbdef06602"> 32</a></span> <span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="prom__errors_8h.html#ae9dcc70f3217ae6f5cd331dbdef06602">prom_return_code</a> {</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  PROM_SUCCESS,</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  PROM_FAILURE</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> } <a class="code" href="prom__errors_8h.html#a8015021744851db1ed84f9602be7462f">int</a>;</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> </div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* prom_return_code_map[2];</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="prom__errors_8h.html#abf8afd95318ab657b0a641477ff459a9">prom_err_get</a>(<a class="code" href="prom__errors_8h.html#a8015021744851db1ed84f9602be7462f">int</a>);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="preprocessor">#endif // PROM_ERRORS_INCLUDED</span></div><div class="ttc" id="prom__errors_8h_html_a8015021744851db1ed84f9602be7462f"><div class="ttname"><a href="prom__errors_8h.html#a8015021744851db1ed84f9602be7462f">int</a></div><div class="ttdeci">enum prom_return_code int</div><div class="ttdoc">Contains returns codes for functions. </div></div> +<div class="ttc" id="prom__errors_8h_html_ae9dcc70f3217ae6f5cd331dbdef06602"><div class="ttname"><a href="prom__errors_8h.html#ae9dcc70f3217ae6f5cd331dbdef06602">prom_return_code</a></div><div class="ttdeci">prom_return_code</div><div class="ttdoc">Contains returns codes for functions. </div><div class="ttdef"><b>Definition:</b> prom_errors.h:32</div></div> +<div class="ttc" id="prom__errors_8h_html_abf8afd95318ab657b0a641477ff459a9"><div class="ttname"><a href="prom__errors_8h.html#abf8afd95318ab657b0a641477ff459a9">prom_err_get</a></div><div class="ttdeci">const char * prom_err_get(int)</div><div class="ttdoc">Retrieve the string value for the given int. </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__gauge_8h.html b/docs/prom__gauge_8h.html new file mode 100644 index 0000000..8e463d4 --- /dev/null +++ b/docs/prom__gauge_8h.html @@ -0,0 +1,475 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_gauge.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> </div> + <div class="headertitle"> +<div class="title">prom_gauge.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p><a href="https://prometheus.io/docs/concepts/metric_types/#gauge">https://prometheus.io/docs/concepts/metric_types/#gauge</a> +<a href="#details">More...</a></p> +<div class="textblock"><code>#include <stdlib.h></code><br /> +<code>#include "<a class="el" href="prom__metric_8h_source.html">prom_metric.h</a>"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom_gauge.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__gauge_8h__incl.png" border="0" usemap="#prom_2include_2prom__gauge_8h" alt=""/></div> +<map name="prom_2include_2prom__gauge_8h" id="prom_2include_2prom__gauge_8h"> +<area shape="rect" id="node3" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="129,80,246,107"/> +<area shape="rect" id="node4" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="5,162,177,189"/> +<area shape="rect" id="node5" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="202,155,362,196"/> +</map> +</div> +</div><div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__gauge_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__gauge_8hdep" alt=""/></div> +<map name="prom_2include_2prom__gauge_8hdep" id="prom_2include_2prom__gauge_8hdep"> +<area shape="rect" id="node2" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="29,80,186,107"/> +</map> +</div> +</div> +<p><a href="prom__gauge_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:a09417d7e7bab055a48f8e13181d136a5"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a></td></tr> +<tr class="memdesc:a09417d7e7bab055a48f8e13181d136a5"><td class="mdescLeft"> </td><td class="mdescRight">A prometheus gauge. <a href="#a09417d7e7bab055a48f8e13181d136a5">More...</a><br /></td></tr> +<tr class="separator:a09417d7e7bab055a48f8e13181d136a5"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a5ecd07c83cf0981944a9256914571d70"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html#a5ecd07c83cf0981944a9256914571d70">prom_gauge_new</a> (const char *name, const char *help, size_t label_key_count, const char **label_keys)</td></tr> +<tr class="memdesc:a5ecd07c83cf0981944a9256914571d70"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a prom_gauge_t*. <a href="#a5ecd07c83cf0981944a9256914571d70">More...</a><br /></td></tr> +<tr class="separator:a5ecd07c83cf0981944a9256914571d70"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a2fc5dc11239cefdf59ae978be4bfd789"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html#a2fc5dc11239cefdf59ae978be4bfd789">prom_gauge_destroy</a> (<a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *self)</td></tr> +<tr class="memdesc:a2fc5dc11239cefdf59ae978be4bfd789"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a prom_gauge_t*. <a href="#a2fc5dc11239cefdf59ae978be4bfd789">More...</a><br /></td></tr> +<tr class="separator:a2fc5dc11239cefdf59ae978be4bfd789"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:ad953b12ea1f8a3c3b7a39e6c260d07a2"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html#ad953b12ea1f8a3c3b7a39e6c260d07a2">prom_gauge_inc</a> (<a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *self, const char **label_values)</td></tr> +<tr class="memdesc:ad953b12ea1f8a3c3b7a39e6c260d07a2"><td class="mdescLeft"> </td><td class="mdescRight">Increment the prom_gauge_t* by 1. <a href="#ad953b12ea1f8a3c3b7a39e6c260d07a2">More...</a><br /></td></tr> +<tr class="separator:ad953b12ea1f8a3c3b7a39e6c260d07a2"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:aa351ef4f2d917d7dae914df6d81c547b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html#aa351ef4f2d917d7dae914df6d81c547b">prom_gauge_dec</a> (<a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *self, const char **label_values)</td></tr> +<tr class="memdesc:aa351ef4f2d917d7dae914df6d81c547b"><td class="mdescLeft"> </td><td class="mdescRight">Decrement the prom_gauge_t* by 1. <a href="#aa351ef4f2d917d7dae914df6d81c547b">More...</a><br /></td></tr> +<tr class="separator:aa351ef4f2d917d7dae914df6d81c547b"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a96bc5b32abee5f99fbd4ae11bebd44c8"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html#a96bc5b32abee5f99fbd4ae11bebd44c8">prom_gauge_add</a> (<a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *self, double r_value, const char **label_values)</td></tr> +<tr class="memdesc:a96bc5b32abee5f99fbd4ae11bebd44c8"><td class="mdescLeft"> </td><td class="mdescRight">Add the value to the prom_gauge_t*. <a href="#a96bc5b32abee5f99fbd4ae11bebd44c8">More...</a><br /></td></tr> +<tr class="separator:a96bc5b32abee5f99fbd4ae11bebd44c8"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a7ae193d586176bff82a39cd65e2bc999"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html#a7ae193d586176bff82a39cd65e2bc999">prom_gauge_sub</a> (<a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *self, double r_value, const char **label_values)</td></tr> +<tr class="memdesc:a7ae193d586176bff82a39cd65e2bc999"><td class="mdescLeft"> </td><td class="mdescRight">Subtract the value to the prom_gauge. <a href="#a7ae193d586176bff82a39cd65e2bc999">More...</a><br /></td></tr> +<tr class="separator:a7ae193d586176bff82a39cd65e2bc999"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a04210b18bfb89aa6f3ddc72d7851a528"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__gauge_8h.html#a04210b18bfb89aa6f3ddc72d7851a528">prom_gauge_set</a> (<a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *self, double r_value, const char **label_values)</td></tr> +<tr class="memdesc:a04210b18bfb89aa6f3ddc72d7851a528"><td class="mdescLeft"> </td><td class="mdescRight">Set the value for the prom_gauge_t*. <a href="#a04210b18bfb89aa6f3ddc72d7851a528">More...</a><br /></td></tr> +<tr class="separator:a04210b18bfb89aa6f3ddc72d7851a528"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p><a href="https://prometheus.io/docs/concepts/metric_types/#gauge">https://prometheus.io/docs/concepts/metric_types/#gauge</a> </p> +</div><h2 class="groupheader">Typedef Documentation</h2> +<a id="a09417d7e7bab055a48f8e13181d136a5"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a09417d7e7bab055a48f8e13181d136a5">◆ </a></span>prom_gauge_t</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">typedef <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> <a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>A prometheus gauge. </p> +<p>References</p><ul> +<li>See <a href="https://prometheus.io/docs/concepts/metric_types/#gauge">https://prometheus.io/docs/concepts/metric_types/#gauge</a> </li> +</ul> + +</div> +</div> +<h2 class="groupheader">Function Documentation</h2> +<a id="a96bc5b32abee5f99fbd4ae11bebd44c8"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a96bc5b32abee5f99fbd4ae11bebd44c8">◆ </a></span>prom_gauge_add()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_gauge_add </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>r_value</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Add the value to the prom_gauge_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_gauge_t* </td></tr> + <tr><td class="paramname">r_value</td><td>The double to add to the prom_gauge_t passed as self. </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the gauge's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure.</dd></dl> +<p><em>Example</em> </p><pre class="fragment">// An example with labels +prom_gauge_add(foo_gauge 22, (const char**) { "bar", "bang" }); + +// An example without labels +prom_gauge_add(foo_gauge, 22, NULL);</pre> +</div> +</div> +<a id="aa351ef4f2d917d7dae914df6d81c547b"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aa351ef4f2d917d7dae914df6d81c547b">◆ </a></span>prom_gauge_dec()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_gauge_dec </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Decrement the prom_gauge_t* by 1. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_gauger_t* </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the gauge's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure. <em>Example</em> <pre class="fragment">// An example with labels +prom_gauge_dec(foo_gauge, (const char**) { "bar", "bang" }); + +// An example without labels +prom_gauge_dec(foo_gauge, NULL);</pre> </dd></dl> + +</div> +</div> +<a id="a2fc5dc11239cefdf59ae978be4bfd789"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a2fc5dc11239cefdf59ae978be4bfd789">◆ </a></span>prom_gauge_destroy()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_gauge_destroy </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Destroys a prom_gauge_t*. </p> +<p>You must set self to NULL after destruction. A non-zero integer value will be returned on failure. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_gauge_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="ad953b12ea1f8a3c3b7a39e6c260d07a2"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ad953b12ea1f8a3c3b7a39e6c260d07a2">◆ </a></span>prom_gauge_inc()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_gauge_inc </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Increment the prom_gauge_t* by 1. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_gauger_t* </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the gauge's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure <em>Example</em> <pre class="fragment">// An example with labels +prom_gauge_inc(foo_gauge, (const char**) { "bar", "bang" }); + +// An example without labels +prom_gauge_inc(foo_gauge, NULL);</pre> </dd></dl> + +</div> +</div> +<a id="a5ecd07c83cf0981944a9256914571d70"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a5ecd07c83cf0981944a9256914571d70">◆ </a></span>prom_gauge_new()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a>* prom_gauge_new </td> + <td>(</td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>name</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>help</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t </td> + <td class="paramname"><em>label_key_count</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_keys</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Constructs a prom_gauge_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">name</td><td>The name of the metric </td></tr> + <tr><td class="paramname">help</td><td>The metric description </td></tr> + <tr><td class="paramname">label_key_count</td><td>The number of labels associated with the given metric. Pass 0 if the metric does not require labels. </td></tr> + <tr><td class="paramname">label_keys</td><td>A collection of label keys. The number of keys MUST match the value passed as label_key_count. If no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_guage_t* <pre class="fragment">// An example with labels +prom_gauge_new("foo", "foo is a gauge with labels", 2, (const char**) { "one", "two" }); + +// An example without labels +prom_gauge_new("foo", "foo is a gauge without labels", 0, NULL);</pre> </dd></dl> + +</div> +</div> +<a id="a04210b18bfb89aa6f3ddc72d7851a528"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a04210b18bfb89aa6f3ddc72d7851a528">◆ </a></span>prom_gauge_set()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_gauge_set </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>r_value</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Set the value for the prom_gauge_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_gauge_t* </td></tr> + <tr><td class="paramname">r_value</td><td>The double to which the prom_gauge_t* passed as self will be set </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the gauge's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure.</dd></dl> +<p><em>Example</em> </p><pre class="fragment">// An example with labels +prom_gauge_set(foo_gauge 22, (const char**) { "bar", "bang" }); + +// An example without labels +prom_gauge_set(foo_gauge, 22, NULL);</pre> +</div> +</div> +<a id="a7ae193d586176bff82a39cd65e2bc999"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a7ae193d586176bff82a39cd65e2bc999">◆ </a></span>prom_gauge_sub()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_gauge_sub </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>r_value</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Subtract the value to the prom_gauge. </p> +<p>A non-zero integer value will be returned on failure. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_gauge_t* </td></tr> + <tr><td class="paramname">r_value</td><td>The double to add to the prom_gauge_t passed as self. </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the gauge's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure.</dd></dl> +<p><em>Example</em> </p><pre class="fragment">// An example with labels +prom_gauge_sub(foo_gauge 22, (const char**) { "bar", "bang" }); + +// An example without labels +prom_gauge_sub(foo_gauge, 22, NULL);</pre> +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__gauge_8h__dep__incl.dot b/docs/prom__gauge_8h__dep__incl.dot new file mode 100644 index 0000000..921a387 --- /dev/null +++ b/docs/prom__gauge_8h__dep__incl.dot @@ -0,0 +1,10 @@ +digraph "prom/include/prom_gauge.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node6 [label="prom/include/prom_gauge.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node6 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node7 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; +} diff --git a/docs/prom__gauge_8h__dep__incl.map b/docs/prom__gauge_8h__dep__incl.map new file mode 100644 index 0000000..39a4520 --- /dev/null +++ b/docs/prom__gauge_8h__dep__incl.map @@ -0,0 +1,3 @@ +<map id="prom/include/prom_gauge.h" name="prom/include/prom_gauge.h"> +<area shape="rect" id="node2" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="29,80,186,107"/> +</map> diff --git a/docs/prom__gauge_8h__dep__incl.md5 b/docs/prom__gauge_8h__dep__incl.md5 new file mode 100644 index 0000000..f378593 --- /dev/null +++ b/docs/prom__gauge_8h__dep__incl.md5 @@ -0,0 +1 @@ +9c764603425f807c3f45ae990afbb05b
\ No newline at end of file diff --git a/docs/prom__gauge_8h__dep__incl.png b/docs/prom__gauge_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..67347f7 --- /dev/null +++ b/docs/prom__gauge_8h__dep__incl.png diff --git a/docs/prom__gauge_8h__incl.dot b/docs/prom__gauge_8h__incl.dot new file mode 100644 index 0000000..936200a --- /dev/null +++ b/docs/prom__gauge_8h__incl.dot @@ -0,0 +1,18 @@ +digraph "prom/include/prom_gauge.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom_gauge.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node0 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; + Node0 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom_metric_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node4 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom_metric_sample\l_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node5 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__gauge_8h__incl.map b/docs/prom__gauge_8h__incl.map new file mode 100644 index 0000000..c58f6c9 --- /dev/null +++ b/docs/prom__gauge_8h__incl.map @@ -0,0 +1,5 @@ +<map id="prom/include/prom_gauge.h" name="prom/include/prom_gauge.h"> +<area shape="rect" id="node3" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="129,80,246,107"/> +<area shape="rect" id="node4" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="5,162,177,189"/> +<area shape="rect" id="node5" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="202,155,362,196"/> +</map> diff --git a/docs/prom__gauge_8h__incl.md5 b/docs/prom__gauge_8h__incl.md5 new file mode 100644 index 0000000..d1576d3 --- /dev/null +++ b/docs/prom__gauge_8h__incl.md5 @@ -0,0 +1 @@ +47f818bf60543a61a23ce02c8326abf9
\ No newline at end of file diff --git a/docs/prom__gauge_8h__incl.png b/docs/prom__gauge_8h__incl.png Binary files differnew file mode 100644 index 0000000..5db9e55 --- /dev/null +++ b/docs/prom__gauge_8h__incl.png diff --git a/docs/prom__gauge_8h_source.html b/docs/prom__gauge_8h_source.html new file mode 100644 index 0000000..dd0585a --- /dev/null +++ b/docs/prom__gauge_8h_source.html @@ -0,0 +1,89 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_gauge.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_gauge.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__gauge_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef PROM_GAUGE_H</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define PROM_GAUGE_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include "<a class="code" href="prom__metric_8h.html">prom_metric.h</a>"</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> </div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5"> 35</a></span> <span class="keyword">typedef</span> <a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> <a class="code" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a>;</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <a class="code" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a>* <a class="code" href="prom__gauge_8h.html#a5ecd07c83cf0981944a9256914571d70">prom_gauge_new</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *help,</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordtype">size_t</span> label_key_count,</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> **label_keys);</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="keywordtype">int</span> <a class="code" href="prom__gauge_8h.html#a2fc5dc11239cefdf59ae978be4bfd789">prom_gauge_destroy</a>(<a class="code" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="keywordtype">int</span> <a class="code" href="prom__gauge_8h.html#ad953b12ea1f8a3c3b7a39e6c260d07a2">prom_gauge_inc</a>(<a class="code" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *<span class="keyword">self</span>, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="keywordtype">int</span> <a class="code" href="prom__gauge_8h.html#aa351ef4f2d917d7dae914df6d81c547b">prom_gauge_dec</a>(<a class="code" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *<span class="keyword">self</span>, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> </div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="keywordtype">int</span> <a class="code" href="prom__gauge_8h.html#a96bc5b32abee5f99fbd4ae11bebd44c8">prom_gauge_add</a>(<a class="code" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> r_value, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> </div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> <span class="keywordtype">int</span> <a class="code" href="prom__gauge_8h.html#a7ae193d586176bff82a39cd65e2bc999">prom_gauge_sub</a>(<a class="code" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> r_value, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> </div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> </div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span> <span class="keywordtype">int</span> <a class="code" href="prom__gauge_8h.html#a04210b18bfb89aa6f3ddc72d7851a528">prom_gauge_set</a>(<a class="code" href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> r_value, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> </div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span> <span class="preprocessor">#endif // PROM_GAUGE_H</span></div><div class="ttc" id="prom__gauge_8h_html_a5ecd07c83cf0981944a9256914571d70"><div class="ttname"><a href="prom__gauge_8h.html#a5ecd07c83cf0981944a9256914571d70">prom_gauge_new</a></div><div class="ttdeci">prom_gauge_t * prom_gauge_new(const char *name, const char *help, size_t label_key_count, const char **label_keys)</div><div class="ttdoc">Constructs a prom_gauge_t*. </div></div> +<div class="ttc" id="prom__metric_8h_html_afd1bd014c48955d6c2c36aa8a8cbb889"><div class="ttname"><a href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a></div><div class="ttdeci">struct prom_metric prom_metric_t</div><div class="ttdoc">A prometheus metric. </div><div class="ttdef"><b>Definition:</b> prom_metric.h:34</div></div> +<div class="ttc" id="prom__gauge_8h_html_a7ae193d586176bff82a39cd65e2bc999"><div class="ttname"><a href="prom__gauge_8h.html#a7ae193d586176bff82a39cd65e2bc999">prom_gauge_sub</a></div><div class="ttdeci">int prom_gauge_sub(prom_gauge_t *self, double r_value, const char **label_values)</div><div class="ttdoc">Subtract the value to the prom_gauge. </div></div> +<div class="ttc" id="prom__gauge_8h_html_aa351ef4f2d917d7dae914df6d81c547b"><div class="ttname"><a href="prom__gauge_8h.html#aa351ef4f2d917d7dae914df6d81c547b">prom_gauge_dec</a></div><div class="ttdeci">int prom_gauge_dec(prom_gauge_t *self, const char **label_values)</div><div class="ttdoc">Decrement the prom_gauge_t* by 1. </div></div> +<div class="ttc" id="prom__gauge_8h_html_a09417d7e7bab055a48f8e13181d136a5"><div class="ttname"><a href="prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5">prom_gauge_t</a></div><div class="ttdeci">prom_metric_t prom_gauge_t</div><div class="ttdoc">A prometheus gauge. </div><div class="ttdef"><b>Definition:</b> prom_gauge.h:35</div></div> +<div class="ttc" id="prom__gauge_8h_html_a96bc5b32abee5f99fbd4ae11bebd44c8"><div class="ttname"><a href="prom__gauge_8h.html#a96bc5b32abee5f99fbd4ae11bebd44c8">prom_gauge_add</a></div><div class="ttdeci">int prom_gauge_add(prom_gauge_t *self, double r_value, const char **label_values)</div><div class="ttdoc">Add the value to the prom_gauge_t*. </div></div> +<div class="ttc" id="prom__gauge_8h_html_ad953b12ea1f8a3c3b7a39e6c260d07a2"><div class="ttname"><a href="prom__gauge_8h.html#ad953b12ea1f8a3c3b7a39e6c260d07a2">prom_gauge_inc</a></div><div class="ttdeci">int prom_gauge_inc(prom_gauge_t *self, const char **label_values)</div><div class="ttdoc">Increment the prom_gauge_t* by 1. </div></div> +<div class="ttc" id="prom__gauge_8h_html_a04210b18bfb89aa6f3ddc72d7851a528"><div class="ttname"><a href="prom__gauge_8h.html#a04210b18bfb89aa6f3ddc72d7851a528">prom_gauge_set</a></div><div class="ttdeci">int prom_gauge_set(prom_gauge_t *self, double r_value, const char **label_values)</div><div class="ttdoc">Set the value for the prom_gauge_t*. </div></div> +<div class="ttc" id="prom__gauge_8h_html_a2fc5dc11239cefdf59ae978be4bfd789"><div class="ttname"><a href="prom__gauge_8h.html#a2fc5dc11239cefdf59ae978be4bfd789">prom_gauge_destroy</a></div><div class="ttdeci">int prom_gauge_destroy(prom_gauge_t *self)</div><div class="ttdoc">Destroys a prom_gauge_t*. </div></div> +<div class="ttc" id="prom__metric_8h_html"><div class="ttname"><a href="prom__metric_8h.html">prom_metric.h</a></div><div class="ttdoc">Functions for retrieving metric samples from metrics given an ordered set of labels. </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__histogram_8h.html b/docs/prom__histogram_8h.html new file mode 100644 index 0000000..712b2f0 --- /dev/null +++ b/docs/prom__histogram_8h.html @@ -0,0 +1,282 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_histogram.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> </div> + <div class="headertitle"> +<div class="title">prom_histogram.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p><a href="https://prometheus.io/docs/concepts/metric_types/#histogram">https://prometheus.io/docs/concepts/metric_types/#histogram</a> +<a href="#details">More...</a></p> +<div class="textblock"><code>#include <stdlib.h></code><br /> +<code>#include "<a class="el" href="prom__metric_8h_source.html">prom_metric.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__histogram__buckets_8h_source.html">prom_histogram_buckets.h</a>"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom_histogram.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__histogram_8h__incl.png" border="0" usemap="#prom_2include_2prom__histogram_8h" alt=""/></div> +<map name="prom_2include_2prom__histogram_8h" id="prom_2include_2prom__histogram_8h"> +<area shape="rect" id="node3" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="244,80,361,107"/> +<area shape="rect" id="node6" href="prom__histogram__buckets_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="22,80,220,107"/> +<area shape="rect" id="node4" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="164,162,336,189"/> +<area shape="rect" id="node5" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="361,155,521,196"/> +</map> +</div> +</div><div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__histogram_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__histogram_8hdep" alt=""/></div> +<map name="prom_2include_2prom__histogram_8hdep" id="prom_2include_2prom__histogram_8hdep"> +<area shape="rect" id="node2" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="42,80,199,107"/> +</map> +</div> +</div> +<p><a href="prom__histogram_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:a8c061924368d41c161025bf3d3cde9ae"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a></td></tr> +<tr class="memdesc:a8c061924368d41c161025bf3d3cde9ae"><td class="mdescLeft"> </td><td class="mdescRight">A prometheus histogram. <a href="#a8c061924368d41c161025bf3d3cde9ae">More...</a><br /></td></tr> +<tr class="separator:a8c061924368d41c161025bf3d3cde9ae"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:ad42681e59e727f9e3d43bf0cdbba9a1b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram_8h.html#ad42681e59e727f9e3d43bf0cdbba9a1b">prom_histogram_new</a> (const char *name, const char *help, <a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> *buckets, size_t label_key_count, const char **label_keys)</td></tr> +<tr class="memdesc:ad42681e59e727f9e3d43bf0cdbba9a1b"><td class="mdescLeft"> </td><td class="mdescRight">Construct a prom_histogram_t*. <a href="#ad42681e59e727f9e3d43bf0cdbba9a1b">More...</a><br /></td></tr> +<tr class="separator:ad42681e59e727f9e3d43bf0cdbba9a1b"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:af9067b27e7ab2abd815af0614bb35357"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram_8h.html#af9067b27e7ab2abd815af0614bb35357">prom_histogram_destroy</a> (<a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a> *self)</td></tr> +<tr class="memdesc:af9067b27e7ab2abd815af0614bb35357"><td class="mdescLeft"> </td><td class="mdescRight">Destroy a prom_histogram_t*. <a href="#af9067b27e7ab2abd815af0614bb35357">More...</a><br /></td></tr> +<tr class="separator:af9067b27e7ab2abd815af0614bb35357"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a274e4b869c7d9239e9f47b3898210fbe"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram_8h.html#a274e4b869c7d9239e9f47b3898210fbe">prom_histogram_observe</a> (<a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a> *self, double value, const char **label_values)</td></tr> +<tr class="memdesc:a274e4b869c7d9239e9f47b3898210fbe"><td class="mdescLeft"> </td><td class="mdescRight">Observe the prom_histogram_t given the value and labells. <a href="#a274e4b869c7d9239e9f47b3898210fbe">More...</a><br /></td></tr> +<tr class="separator:a274e4b869c7d9239e9f47b3898210fbe"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p><a href="https://prometheus.io/docs/concepts/metric_types/#histogram">https://prometheus.io/docs/concepts/metric_types/#histogram</a> </p> +</div><h2 class="groupheader">Typedef Documentation</h2> +<a id="a8c061924368d41c161025bf3d3cde9ae"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a8c061924368d41c161025bf3d3cde9ae">◆ </a></span>prom_histogram_t</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">typedef <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> <a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>A prometheus histogram. </p> +<p>References</p><ul> +<li>See <a href="https://prometheus.io/docs/concepts/metric_types/#histogram">https://prometheus.io/docs/concepts/metric_types/#histogram</a> </li> +</ul> + +</div> +</div> +<h2 class="groupheader">Function Documentation</h2> +<a id="af9067b27e7ab2abd815af0614bb35357"></a> +<h2 class="memtitle"><span class="permalink"><a href="#af9067b27e7ab2abd815af0614bb35357">◆ </a></span>prom_histogram_destroy()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_histogram_destroy </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Destroy a prom_histogram_t*. </p> +<p>self MUSTS be set to NULL after destruction. Returns a non-zero integer value upon failure. </p><dl class="section return"><dt>Returns</dt><dd>Non-zero value upon failure. </dd></dl> + +</div> +</div> +<a id="ad42681e59e727f9e3d43bf0cdbba9a1b"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ad42681e59e727f9e3d43bf0cdbba9a1b">◆ </a></span>prom_histogram_new()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a>* prom_histogram_new </td> + <td>(</td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>name</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char * </td> + <td class="paramname"><em>help</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> * </td> + <td class="paramname"><em>buckets</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t </td> + <td class="paramname"><em>label_key_count</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_keys</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Construct a prom_histogram_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">name</td><td>The name of the metric </td></tr> + <tr><td class="paramname">help</td><td>The metric description </td></tr> + <tr><td class="paramname">buckets</td><td>The prom_histogram_buckets_t*. See <a class="el" href="prom__histogram__buckets_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram ">prom_histogram_buckets.h</a>. </td></tr> + <tr><td class="paramname">label_key_count</td><td>is the number of labels associated with the given metric. Pass 0 if the metric does not require labels. </td></tr> + <tr><td class="paramname">label_keys</td><td>A collection of label keys. The number of keys MUST match the value passed as label_key_count. If no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_histogram_t*</dd></dl> +<p><em>Example</em> </p><pre class="fragment">// An example with labels +prom_histogram_buckets_t* buckets = prom_histogram_buckets_linear(5.0, 5.0, 10); +prom_histogram_new("foo", "foo is a counter with labels", buckets, 2, (const char**) { "one", "two" }); + +// An example without labels +prom_histogram_buckets_t* buckets = prom_histogram_buckets_linear(5.0, 5.0, 10); +prom_histogram_new("foo", "foo is a counter without labels", buckets, 0, NULL);</pre> +</div> +</div> +<a id="a274e4b869c7d9239e9f47b3898210fbe"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a274e4b869c7d9239e9f47b3898210fbe">◆ </a></span>prom_histogram_observe()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_histogram_observe </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>value</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Observe the prom_histogram_t given the value and labells. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_histogram_t* </td></tr> + <tr><td class="paramname">value</td><td>The value to observe </td></tr> + <tr><td class="paramname">label_keys</td><td>A collection of label keys. The number of keys MUST match the value passed as label_key_count. If no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Non-zero value upon failure </dd></dl> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__histogram_8h__dep__incl.dot b/docs/prom__histogram_8h__dep__incl.dot new file mode 100644 index 0000000..1cc0139 --- /dev/null +++ b/docs/prom__histogram_8h__dep__incl.dot @@ -0,0 +1,10 @@ +digraph "prom/include/prom_histogram.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node7 [label="prom/include/prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node7 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node8 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; +} diff --git a/docs/prom__histogram_8h__dep__incl.map b/docs/prom__histogram_8h__dep__incl.map new file mode 100644 index 0000000..7796f29 --- /dev/null +++ b/docs/prom__histogram_8h__dep__incl.map @@ -0,0 +1,3 @@ +<map id="prom/include/prom_histogram.h" name="prom/include/prom_histogram.h"> +<area shape="rect" id="node2" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="42,80,199,107"/> +</map> diff --git a/docs/prom__histogram_8h__dep__incl.md5 b/docs/prom__histogram_8h__dep__incl.md5 new file mode 100644 index 0000000..26313c5 --- /dev/null +++ b/docs/prom__histogram_8h__dep__incl.md5 @@ -0,0 +1 @@ +a62830da148452519c6a3f03ba5fddb6
\ No newline at end of file diff --git a/docs/prom__histogram_8h__dep__incl.png b/docs/prom__histogram_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..7415f6c --- /dev/null +++ b/docs/prom__histogram_8h__dep__incl.png diff --git a/docs/prom__histogram_8h__incl.dot b/docs/prom__histogram_8h__incl.dot new file mode 100644 index 0000000..2b0c2c0 --- /dev/null +++ b/docs/prom__histogram_8h__incl.dot @@ -0,0 +1,20 @@ +digraph "prom/include/prom_histogram.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node0 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; + Node0 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom_metric_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node4 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom_metric_sample\l_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node5 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node0 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 [label="prom_histogram_buckets.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram__buckets_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; +} diff --git a/docs/prom__histogram_8h__incl.map b/docs/prom__histogram_8h__incl.map new file mode 100644 index 0000000..1f8df46 --- /dev/null +++ b/docs/prom__histogram_8h__incl.map @@ -0,0 +1,6 @@ +<map id="prom/include/prom_histogram.h" name="prom/include/prom_histogram.h"> +<area shape="rect" id="node3" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="244,80,361,107"/> +<area shape="rect" id="node6" href="$prom__histogram__buckets_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="22,80,220,107"/> +<area shape="rect" id="node4" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="164,162,336,189"/> +<area shape="rect" id="node5" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="361,155,521,196"/> +</map> diff --git a/docs/prom__histogram_8h__incl.md5 b/docs/prom__histogram_8h__incl.md5 new file mode 100644 index 0000000..b4476c4 --- /dev/null +++ b/docs/prom__histogram_8h__incl.md5 @@ -0,0 +1 @@ +8e71a9dfac588d13bbc0b4c82756ff76
\ No newline at end of file diff --git a/docs/prom__histogram_8h__incl.png b/docs/prom__histogram_8h__incl.png Binary files differnew file mode 100644 index 0000000..9399b3e --- /dev/null +++ b/docs/prom__histogram_8h__incl.png diff --git a/docs/prom__histogram_8h_source.html b/docs/prom__histogram_8h_source.html new file mode 100644 index 0000000..ad5025a --- /dev/null +++ b/docs/prom__histogram_8h_source.html @@ -0,0 +1,87 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_histogram.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_histogram.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__histogram_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef PROM_HISTOGRAM_INCLUDED</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define PROM_HISTOGRAM_INCLUDED</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include "<a class="code" href="prom__metric_8h.html">prom_metric.h</a>"</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "<a class="code" href="prom__histogram__buckets_8h.html">prom_histogram_buckets.h</a>"</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae"> 36</a></span> <span class="keyword">typedef</span> <a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> <a class="code" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a>;</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <a class="code" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a>* <a class="code" href="prom__histogram_8h.html#ad42681e59e727f9e3d43bf0cdbba9a1b">prom_histogram_new</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *help,</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> *buckets,</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordtype">size_t</span> label_key_count,</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> **label_keys);</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> <span class="keywordtype">int</span> <a class="code" href="prom__histogram_8h.html#af9067b27e7ab2abd815af0614bb35357">prom_histogram_destroy</a>(<a class="code" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span> </div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="keywordtype">int</span> <a class="code" href="prom__histogram_8h.html#a274e4b869c7d9239e9f47b3898210fbe">prom_histogram_observe</a>(<a class="code" href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> value, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="preprocessor">#endif // PROM_HISTOGRAM_INCLUDED</span></div><div class="ttc" id="prom__histogram_8h_html_af9067b27e7ab2abd815af0614bb35357"><div class="ttname"><a href="prom__histogram_8h.html#af9067b27e7ab2abd815af0614bb35357">prom_histogram_destroy</a></div><div class="ttdeci">int prom_histogram_destroy(prom_histogram_t *self)</div><div class="ttdoc">Destroy a prom_histogram_t*. </div></div> +<div class="ttc" id="prom__metric_8h_html_afd1bd014c48955d6c2c36aa8a8cbb889"><div class="ttname"><a href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a></div><div class="ttdeci">struct prom_metric prom_metric_t</div><div class="ttdoc">A prometheus metric. </div><div class="ttdef"><b>Definition:</b> prom_metric.h:34</div></div> +<div class="ttc" id="structprom__histogram__buckets_html"><div class="ttname"><a href="structprom__histogram__buckets.html">prom_histogram_buckets</a></div><div class="ttdef"><b>Definition:</b> prom_histogram_buckets.h:27</div></div> +<div class="ttc" id="prom__histogram_8h_html_a8c061924368d41c161025bf3d3cde9ae"><div class="ttname"><a href="prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae">prom_histogram_t</a></div><div class="ttdeci">prom_metric_t prom_histogram_t</div><div class="ttdoc">A prometheus histogram. </div><div class="ttdef"><b>Definition:</b> prom_histogram.h:36</div></div> +<div class="ttc" id="prom__histogram_8h_html_ad42681e59e727f9e3d43bf0cdbba9a1b"><div class="ttname"><a href="prom__histogram_8h.html#ad42681e59e727f9e3d43bf0cdbba9a1b">prom_histogram_new</a></div><div class="ttdeci">prom_histogram_t * prom_histogram_new(const char *name, const char *help, prom_histogram_buckets_t *buckets, size_t label_key_count, const char **label_keys)</div><div class="ttdoc">Construct a prom_histogram_t*. </div></div> +<div class="ttc" id="prom__metric_8h_html"><div class="ttname"><a href="prom__metric_8h.html">prom_metric.h</a></div><div class="ttdoc">Functions for retrieving metric samples from metrics given an ordered set of labels. </div></div> +<div class="ttc" id="prom__histogram_8h_html_a274e4b869c7d9239e9f47b3898210fbe"><div class="ttname"><a href="prom__histogram_8h.html#a274e4b869c7d9239e9f47b3898210fbe">prom_histogram_observe</a></div><div class="ttdeci">int prom_histogram_observe(prom_histogram_t *self, double value, const char **label_values)</div><div class="ttdoc">Observe the prom_histogram_t given the value and labells. </div></div> +<div class="ttc" id="prom__histogram__buckets_8h_html"><div class="ttname"><a href="prom__histogram__buckets_8h.html">prom_histogram_buckets.h</a></div><div class="ttdoc">https://prometheus.io/docs/concepts/metric_types/#histogram </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__histogram__buckets_8h.html b/docs/prom__histogram__buckets_8h.html new file mode 100644 index 0000000..4efacf8 --- /dev/null +++ b/docs/prom__histogram__buckets_8h.html @@ -0,0 +1,334 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_histogram_buckets.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#nested-classes">Classes</a> | +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> | +<a href="#var-members">Variables</a> </div> + <div class="headertitle"> +<div class="title">prom_histogram_buckets.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p><a href="https://prometheus.io/docs/concepts/metric_types/#histogram">https://prometheus.io/docs/concepts/metric_types/#histogram</a> +<a href="#details">More...</a></p> +<div class="textblock"><code>#include "stdlib.h"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom_histogram_buckets.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__histogram__buckets_8h__incl.png" border="0" usemap="#prom_2include_2prom__histogram__buckets_8h" alt=""/></div> +<map name="prom_2include_2prom__histogram__buckets_8h" id="prom_2include_2prom__histogram__buckets_8h"> +</map> +</div> +</div><div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__histogram__buckets_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__histogram__buckets_8hdep" alt=""/></div> +<map name="prom_2include_2prom__histogram__buckets_8hdep" id="prom_2include_2prom__histogram__buckets_8hdep"> +<area shape="rect" id="node2" href="prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="5,95,236,121"/> +<area shape="rect" id="node3" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="118,169,275,196"/> +</map> +</div> +</div> +<p><a href="prom__histogram__buckets_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> +Classes</h2></td></tr> +<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets</a></td></tr> +<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:ac611328b4d7375ed913373025274090f"><td class="memItemLeft" align="right" valign="top"><a id="ac611328b4d7375ed913373025274090f"></a> +typedef struct <a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets</a> </td><td class="memItemRight" valign="bottom"><b>prom_histogram_buckets_t</b></td></tr> +<tr class="separator:ac611328b4d7375ed913373025274090f"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a03736e2fac21748bbfd80100bf9546c4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram__buckets_8h.html#a03736e2fac21748bbfd80100bf9546c4">prom_histogram_buckets_new</a> (size_t count, double bucket,...)</td></tr> +<tr class="memdesc:a03736e2fac21748bbfd80100bf9546c4"><td class="mdescLeft"> </td><td class="mdescRight">Construct a prom_histogram_buckets_t*. <a href="#a03736e2fac21748bbfd80100bf9546c4">More...</a><br /></td></tr> +<tr class="separator:a03736e2fac21748bbfd80100bf9546c4"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:aa1adc550bf8999a27f6a26769d6bfc72"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram__buckets_8h.html#aa1adc550bf8999a27f6a26769d6bfc72">prom_histogram_buckets_linear</a> (double start, double width, size_t count)</td></tr> +<tr class="memdesc:aa1adc550bf8999a27f6a26769d6bfc72"><td class="mdescLeft"> </td><td class="mdescRight">Construct a linearly sized prom_histogram_buckets_t*. <a href="#aa1adc550bf8999a27f6a26769d6bfc72">More...</a><br /></td></tr> +<tr class="separator:aa1adc550bf8999a27f6a26769d6bfc72"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a164da4101785b6fa2a292a964c232f12"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram__buckets_8h.html#a164da4101785b6fa2a292a964c232f12">prom_histogram_buckets_exponential</a> (double start, double factor, size_t count)</td></tr> +<tr class="memdesc:a164da4101785b6fa2a292a964c232f12"><td class="mdescLeft"> </td><td class="mdescRight">Construct an exponentially sized prom_histogram_buckets_t*. <a href="#a164da4101785b6fa2a292a964c232f12">More...</a><br /></td></tr> +<tr class="separator:a164da4101785b6fa2a292a964c232f12"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a36bc3312f8f479bbd6eb92fa3b1a5033"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram__buckets_8h.html#a36bc3312f8f479bbd6eb92fa3b1a5033">prom_histogram_buckets_destroy</a> (<a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> *self)</td></tr> +<tr class="memdesc:a36bc3312f8f479bbd6eb92fa3b1a5033"><td class="mdescLeft"> </td><td class="mdescRight">Destroy a prom_histogram_buckets_t*. <a href="#a36bc3312f8f479bbd6eb92fa3b1a5033">More...</a><br /></td></tr> +<tr class="separator:a36bc3312f8f479bbd6eb92fa3b1a5033"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a92158192cfe9a71a98dbb1d9adc8508a"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram__buckets_8h.html#a92158192cfe9a71a98dbb1d9adc8508a">prom_histogram_buckets_count</a> (<a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> *self)</td></tr> +<tr class="memdesc:a92158192cfe9a71a98dbb1d9adc8508a"><td class="mdescLeft"> </td><td class="mdescRight">Get the count of buckets. <a href="#a92158192cfe9a71a98dbb1d9adc8508a">More...</a><br /></td></tr> +<tr class="separator:a92158192cfe9a71a98dbb1d9adc8508a"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a> +Variables</h2></td></tr> +<tr class="memitem:aa8d61c1abc355eb54173b27cb1b50a5d"><td class="memItemLeft" align="right" valign="top"><a id="aa8d61c1abc355eb54173b27cb1b50a5d"></a> +<a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__histogram__buckets_8h.html#aa8d61c1abc355eb54173b27cb1b50a5d">prom_histogram_default_buckets</a></td></tr> +<tr class="memdesc:aa8d61c1abc355eb54173b27cb1b50a5d"><td class="mdescLeft"> </td><td class="mdescRight">the default histogram buckets: .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10 <br /></td></tr> +<tr class="separator:aa8d61c1abc355eb54173b27cb1b50a5d"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p><a href="https://prometheus.io/docs/concepts/metric_types/#histogram">https://prometheus.io/docs/concepts/metric_types/#histogram</a> </p> +</div><h2 class="groupheader">Function Documentation</h2> +<a id="a92158192cfe9a71a98dbb1d9adc8508a"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a92158192cfe9a71a98dbb1d9adc8508a">◆ </a></span>prom_histogram_buckets_count()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">size_t prom_histogram_buckets_count </td> + <td>(</td> + <td class="paramtype"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Get the count of buckets. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_histogram_buckets_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The count of buckets </dd></dl> + +</div> +</div> +<a id="a36bc3312f8f479bbd6eb92fa3b1a5033"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a36bc3312f8f479bbd6eb92fa3b1a5033">◆ </a></span>prom_histogram_buckets_destroy()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_histogram_buckets_destroy </td> + <td>(</td> + <td class="paramtype"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> * </td> + <td class="paramname"><em>self</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Destroy a prom_histogram_buckets_t*. </p> +<p>Self MUST be set to NULL after destruction. Returns a non-zero integer value upon failure. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_histogram_buckets_t* </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="a164da4101785b6fa2a292a964c232f12"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a164da4101785b6fa2a292a964c232f12">◆ </a></span>prom_histogram_buckets_exponential()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a>* prom_histogram_buckets_exponential </td> + <td>(</td> + <td class="paramtype">double </td> + <td class="paramname"><em>start</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>factor</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t </td> + <td class="paramname"><em>count</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Construct an exponentially sized prom_histogram_buckets_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">start</td><td>The first inclusive upper bound. The value MUST be greater than 0. </td></tr> + <tr><td class="paramname">factor</td><td>The factor to apply to the previous upper bound to produce the next upper bound. The value MUST be greater than 1. </td></tr> + <tr><td class="paramname">count</td><td>The total number of buckets. The final +Inf bucket is not counted and not included. The value MUST be greater than or equal to 1 </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_histogram_buckets_t* </dd></dl> + +</div> +</div> +<a id="aa1adc550bf8999a27f6a26769d6bfc72"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aa1adc550bf8999a27f6a26769d6bfc72">◆ </a></span>prom_histogram_buckets_linear()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a>* prom_histogram_buckets_linear </td> + <td>(</td> + <td class="paramtype">double </td> + <td class="paramname"><em>start</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>width</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">size_t </td> + <td class="paramname"><em>count</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Construct a linearly sized prom_histogram_buckets_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">start</td><td>The first inclusive upper bound </td></tr> + <tr><td class="paramname">width</td><td>The distance between each upper bound </td></tr> + <tr><td class="paramname">count</td><td>The total number of buckets. The final +Inf bucket is not counted and not included. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_histogram_buckets_t* </dd></dl> + +</div> +</div> +<a id="a03736e2fac21748bbfd80100bf9546c4"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a03736e2fac21748bbfd80100bf9546c4">◆ </a></span>prom_histogram_buckets_new()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a>* prom_histogram_buckets_new </td> + <td>(</td> + <td class="paramtype">size_t </td> + <td class="paramname"><em>count</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>bucket</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype"> </td> + <td class="paramname"><em>...</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Construct a prom_histogram_buckets_t*. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">count</td><td>The number of buckets </td></tr> + <tr><td class="paramname">bucket</td><td>The first bucket. A variable number of bucket values may be passed. This quantity MUST equal the value passed as count. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>The constructed prom_histogram_buckets_t* </dd></dl> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__histogram__buckets_8h__dep__incl.dot b/docs/prom__histogram__buckets_8h__dep__incl.dot new file mode 100644 index 0000000..f312d71 --- /dev/null +++ b/docs/prom__histogram__buckets_8h__dep__incl.dot @@ -0,0 +1,13 @@ +digraph "prom/include/prom_histogram_buckets.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node1 [label="prom/include/prom_histogram\l_buckets.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom/include/prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node3 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; + Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__histogram__buckets_8h__dep__incl.map b/docs/prom__histogram__buckets_8h__dep__incl.map new file mode 100644 index 0000000..2a03229 --- /dev/null +++ b/docs/prom__histogram__buckets_8h__dep__incl.map @@ -0,0 +1,4 @@ +<map id="prom/include/prom_histogram_buckets.h" name="prom/include/prom_histogram_buckets.h"> +<area shape="rect" id="node2" href="$prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="5,95,236,121"/> +<area shape="rect" id="node3" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="118,169,275,196"/> +</map> diff --git a/docs/prom__histogram__buckets_8h__dep__incl.md5 b/docs/prom__histogram__buckets_8h__dep__incl.md5 new file mode 100644 index 0000000..665c1aa --- /dev/null +++ b/docs/prom__histogram__buckets_8h__dep__incl.md5 @@ -0,0 +1 @@ +f5608aeb0c9a1fbb7fbf92120d7fc33b
\ No newline at end of file diff --git a/docs/prom__histogram__buckets_8h__dep__incl.png b/docs/prom__histogram__buckets_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..97c4683 --- /dev/null +++ b/docs/prom__histogram__buckets_8h__dep__incl.png diff --git a/docs/prom__histogram__buckets_8h__incl.map b/docs/prom__histogram__buckets_8h__incl.map new file mode 100644 index 0000000..d47adf5 --- /dev/null +++ b/docs/prom__histogram__buckets_8h__incl.map @@ -0,0 +1,2 @@ +<map id="prom/include/prom_histogram_buckets.h" name="prom/include/prom_histogram_buckets.h"> +</map> diff --git a/docs/prom__histogram__buckets_8h__incl.md5 b/docs/prom__histogram__buckets_8h__incl.md5 new file mode 100644 index 0000000..8b3dec0 --- /dev/null +++ b/docs/prom__histogram__buckets_8h__incl.md5 @@ -0,0 +1 @@ +0ecfca103c369c6b616b8deceeec2b88
\ No newline at end of file diff --git a/docs/prom__histogram__buckets_8h__incl.png b/docs/prom__histogram__buckets_8h__incl.png Binary files differnew file mode 100644 index 0000000..c54bf23 --- /dev/null +++ b/docs/prom__histogram__buckets_8h__incl.png diff --git a/docs/prom__histogram__buckets_8h_source.html b/docs/prom__histogram__buckets_8h_source.html new file mode 100644 index 0000000..c2647d0 --- /dev/null +++ b/docs/prom__histogram__buckets_8h_source.html @@ -0,0 +1,88 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_histogram_buckets.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_histogram_buckets.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__histogram__buckets_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include "stdlib.h"</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#ifndef PROM_HISTOGRAM_BUCKETS_H</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#define PROM_HISTOGRAM_BUCKETS_H</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="structprom__histogram__buckets.html"> 27</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets</a> {</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621"> 28</a></span>  <span class="keywordtype">int</span> <a class="code" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">count</a>; </div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344"> 29</a></span>  <span class="keyword">const</span> <span class="keywordtype">double</span> *<a class="code" href="structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344">upper_bounds</a>; </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> } <a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a>;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a>* <a class="code" href="prom__histogram__buckets_8h.html#a03736e2fac21748bbfd80100bf9546c4">prom_histogram_buckets_new</a>(<span class="keywordtype">size_t</span> <a class="code" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">count</a>, <span class="keywordtype">double</span> bucket, ...);</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="keyword">extern</span> <a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> *<a class="code" href="prom__histogram__buckets_8h.html#aa8d61c1abc355eb54173b27cb1b50a5d">prom_histogram_default_buckets</a>;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a>* <a class="code" href="prom__histogram__buckets_8h.html#aa1adc550bf8999a27f6a26769d6bfc72">prom_histogram_buckets_linear</a>(<span class="keywordtype">double</span> start, <span class="keywordtype">double</span> width, <span class="keywordtype">size_t</span> <a class="code" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">count</a>);</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a>* <a class="code" href="prom__histogram__buckets_8h.html#a164da4101785b6fa2a292a964c232f12">prom_histogram_buckets_exponential</a>(<span class="keywordtype">double</span> start, <span class="keywordtype">double</span> factor, <span class="keywordtype">size_t</span> <a class="code" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">count</a>);</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="keywordtype">int</span> <a class="code" href="prom__histogram__buckets_8h.html#a36bc3312f8f479bbd6eb92fa3b1a5033">prom_histogram_buckets_destroy</a>(<a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="keywordtype">size_t</span> <a class="code" href="prom__histogram__buckets_8h.html#a92158192cfe9a71a98dbb1d9adc8508a">prom_histogram_buckets_count</a>(<a class="code" href="structprom__histogram__buckets.html">prom_histogram_buckets_t</a> *<span class="keyword">self</span>);</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> </div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="preprocessor">#endif // PROM_HISTOGRAM_BUCKETS_H</span></div><div class="ttc" id="prom__histogram__buckets_8h_html_aa8d61c1abc355eb54173b27cb1b50a5d"><div class="ttname"><a href="prom__histogram__buckets_8h.html#aa8d61c1abc355eb54173b27cb1b50a5d">prom_histogram_default_buckets</a></div><div class="ttdeci">prom_histogram_buckets_t * prom_histogram_default_buckets</div><div class="ttdoc">the default histogram buckets: .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10 </div></div> +<div class="ttc" id="structprom__histogram__buckets_html_a9da20001e02d992cee82a09372061621"><div class="ttname"><a href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">prom_histogram_buckets::count</a></div><div class="ttdeci">int count</div><div class="ttdoc">Number of buckets. </div><div class="ttdef"><b>Definition:</b> prom_histogram_buckets.h:28</div></div> +<div class="ttc" id="prom__histogram__buckets_8h_html_a03736e2fac21748bbfd80100bf9546c4"><div class="ttname"><a href="prom__histogram__buckets_8h.html#a03736e2fac21748bbfd80100bf9546c4">prom_histogram_buckets_new</a></div><div class="ttdeci">prom_histogram_buckets_t * prom_histogram_buckets_new(size_t count, double bucket,...)</div><div class="ttdoc">Construct a prom_histogram_buckets_t*. </div></div> +<div class="ttc" id="structprom__histogram__buckets_html_a8abda07c4930e15a3dff8a86e3164344"><div class="ttname"><a href="structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344">prom_histogram_buckets::upper_bounds</a></div><div class="ttdeci">const double * upper_bounds</div><div class="ttdoc">The bucket values. </div><div class="ttdef"><b>Definition:</b> prom_histogram_buckets.h:29</div></div> +<div class="ttc" id="prom__histogram__buckets_8h_html_a92158192cfe9a71a98dbb1d9adc8508a"><div class="ttname"><a href="prom__histogram__buckets_8h.html#a92158192cfe9a71a98dbb1d9adc8508a">prom_histogram_buckets_count</a></div><div class="ttdeci">size_t prom_histogram_buckets_count(prom_histogram_buckets_t *self)</div><div class="ttdoc">Get the count of buckets. </div></div> +<div class="ttc" id="structprom__histogram__buckets_html"><div class="ttname"><a href="structprom__histogram__buckets.html">prom_histogram_buckets</a></div><div class="ttdef"><b>Definition:</b> prom_histogram_buckets.h:27</div></div> +<div class="ttc" id="prom__histogram__buckets_8h_html_a36bc3312f8f479bbd6eb92fa3b1a5033"><div class="ttname"><a href="prom__histogram__buckets_8h.html#a36bc3312f8f479bbd6eb92fa3b1a5033">prom_histogram_buckets_destroy</a></div><div class="ttdeci">int prom_histogram_buckets_destroy(prom_histogram_buckets_t *self)</div><div class="ttdoc">Destroy a prom_histogram_buckets_t*. </div></div> +<div class="ttc" id="prom__histogram__buckets_8h_html_aa1adc550bf8999a27f6a26769d6bfc72"><div class="ttname"><a href="prom__histogram__buckets_8h.html#aa1adc550bf8999a27f6a26769d6bfc72">prom_histogram_buckets_linear</a></div><div class="ttdeci">prom_histogram_buckets_t * prom_histogram_buckets_linear(double start, double width, size_t count)</div><div class="ttdoc">Construct a linearly sized prom_histogram_buckets_t*. </div></div> +<div class="ttc" id="prom__histogram__buckets_8h_html_a164da4101785b6fa2a292a964c232f12"><div class="ttname"><a href="prom__histogram__buckets_8h.html#a164da4101785b6fa2a292a964c232f12">prom_histogram_buckets_exponential</a></div><div class="ttdeci">prom_histogram_buckets_t * prom_histogram_buckets_exponential(double start, double factor, size_t count)</div><div class="ttdoc">Construct an exponentially sized prom_histogram_buckets_t*. </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__linked__list_8h_source.html b/docs/prom__linked__list_8h_source.html new file mode 100644 index 0000000..b286da9 --- /dev/null +++ b/docs/prom__linked__list_8h_source.html @@ -0,0 +1,79 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_linked_list.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_linked_list.h</div> </div> +</div><!--header--> +<div class="contents"> +<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> </div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#ifndef PROM_LIST_H</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#define PROM_LIST_H</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="keyword">struct </span>prom_linked_list;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="keyword">typedef</span> <span class="keyword">struct </span>prom_linked_list prom_linked_list_t;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> </div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#endif // PROM_LIST_H</span></div></div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__map_8h_source.html b/docs/prom__map_8h_source.html new file mode 100644 index 0000000..a2490f0 --- /dev/null +++ b/docs/prom__map_8h_source.html @@ -0,0 +1,79 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_map.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_map.h</div> </div> +</div><!--header--> +<div class="contents"> +<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#ifndef PROM_MAP_H</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#define PROM_MAP_H</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> </div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="keyword">struct </span>prom_map;</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">typedef</span> <span class="keyword">struct </span>prom_map prom_map_t;</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="keyword">struct </span>prom_map_node;</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="keyword">typedef</span> <span class="keyword">struct </span>prom_map_node prom_map_node_t;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#endif // PROM_MAP_H</span></div></div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__metric_8h.html b/docs/prom__metric_8h.html new file mode 100644 index 0000000..2f6767e --- /dev/null +++ b/docs/prom__metric_8h.html @@ -0,0 +1,229 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_metric.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> </div> + <div class="headertitle"> +<div class="title">prom_metric.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>Functions for retrieving metric samples from metrics given an ordered set of labels. +<a href="#details">More...</a></p> +<div class="textblock"><code>#include "<a class="el" href="prom__metric__sample_8h_source.html">prom_metric_sample.h</a>"</code><br /> +<code>#include "<a class="el" href="prom__metric__sample__histogram_8h_source.html">prom_metric_sample_histogram.h</a>"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for prom_metric.h:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__metric_8h__incl.png" border="0" usemap="#prom_2include_2prom__metric_8h" alt=""/></div> +<map name="prom_2include_2prom__metric_8h" id="prom_2include_2prom__metric_8h"> +<area shape="rect" id="node2" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="5,87,177,114"/> +<area shape="rect" id="node3" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="202,80,362,121"/> +</map> +</div> +</div><div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__metric_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__metric_8hdep" alt=""/></div> +<map name="prom_2include_2prom__metric_8hdep" id="prom_2include_2prom__metric_8hdep"> +<area shape="rect" id="node2" href="prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="70,80,289,107"/> +<area shape="rect" id="node3" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="302,244,459,271"/> +<area shape="rect" id="node4" href="prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="6,155,214,196"/> +<area shape="rect" id="node6" href="prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="339,162,551,189"/> +<area shape="rect" id="node7" href="prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="575,162,779,189"/> +<area shape="rect" id="node8" href="prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="636,80,867,107"/> +<area shape="rect" id="node5" href="promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="5,244,215,271"/> +</map> +</div> +</div> +<p><a href="prom__metric_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:afd1bd014c48955d6c2c36aa8a8cbb889"><td class="memItemLeft" align="right" valign="top">typedef struct prom_metric </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a></td></tr> +<tr class="memdesc:afd1bd014c48955d6c2c36aa8a8cbb889"><td class="mdescLeft"> </td><td class="mdescRight">A prometheus metric. <a href="#afd1bd014c48955d6c2c36aa8a8cbb889">More...</a><br /></td></tr> +<tr class="separator:afd1bd014c48955d6c2c36aa8a8cbb889"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a2c33d7e03b430a2903bf122fbeeb89de"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric_8h.html#a2c33d7e03b430a2903bf122fbeeb89de">prom_metric_sample_from_labels</a> (<a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *self, const char **label_values)</td></tr> +<tr class="memdesc:a2c33d7e03b430a2903bf122fbeeb89de"><td class="mdescLeft"> </td><td class="mdescRight">Returns a prom_metric_sample_t*. <a href="#a2c33d7e03b430a2903bf122fbeeb89de">More...</a><br /></td></tr> +<tr class="separator:a2c33d7e03b430a2903bf122fbeeb89de"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a3b76680b4a7177eebc864f3b3be1e935"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric_8h.html#a3b76680b4a7177eebc864f3b3be1e935">prom_metric_sample_histogram_from_labels</a> (<a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *self, const char **label_values)</td></tr> +<tr class="memdesc:a3b76680b4a7177eebc864f3b3be1e935"><td class="mdescLeft"> </td><td class="mdescRight">Returns a prom_metric_sample_histogram_t*. <a href="#a3b76680b4a7177eebc864f3b3be1e935">More...</a><br /></td></tr> +<tr class="separator:a3b76680b4a7177eebc864f3b3be1e935"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Functions for retrieving metric samples from metrics given an ordered set of labels. </p> +</div><h2 class="groupheader">Typedef Documentation</h2> +<a id="afd1bd014c48955d6c2c36aa8a8cbb889"></a> +<h2 class="memtitle"><span class="permalink"><a href="#afd1bd014c48955d6c2c36aa8a8cbb889">◆ </a></span>prom_metric_t</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">typedef struct prom_metric <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>A prometheus metric. </p> +<p>Reference: <a href="https://prometheus.io/docs/concepts/data_model">https://prometheus.io/docs/concepts/data_model</a> </p> + +</div> +</div> +<h2 class="groupheader">Function Documentation</h2> +<a id="a2c33d7e03b430a2903bf122fbeeb89de"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a2c33d7e03b430a2903bf122fbeeb89de">◆ </a></span>prom_metric_sample_from_labels()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a>* prom_metric_sample_from_labels </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Returns a prom_metric_sample_t*. </p> +<p>The order of label_values is significant.</p> +<p>You may use this function to cache metric samples to avoid sample lookup. Metric samples are stored in a hash map with O(1) lookups in average case; nonethless, caching metric samples and updating them directly might be preferrable in performance-sensitive situations.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_metric_t* </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the counter's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A prom_metric_sample_t* </dd></dl> + +</div> +</div> +<a id="a3b76680b4a7177eebc864f3b3be1e935"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a3b76680b4a7177eebc864f3b3be1e935">◆ </a></span>prom_metric_sample_histogram_from_labels()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a>* prom_metric_sample_histogram_from_labels </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const char ** </td> + <td class="paramname"><em>label_values</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Returns a prom_metric_sample_histogram_t*. </p> +<p>The order of label_values is significant.</p> +<p>You may use this function to cache metric samples to avoid sample lookup. Metric samples are stored in a hash map with O(1) lookups in average case; nonethless, caching metric samples and updating them directly might be preferrable in performance-sensitive situations.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_histogram_metric_t* </td></tr> + <tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the counter's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>prom_metric_sample_histogram_t* </dd></dl> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__metric_8h__dep__incl.dot b/docs/prom__metric_8h__dep__incl.dot new file mode 100644 index 0000000..494a0c6 --- /dev/null +++ b/docs/prom__metric_8h__dep__incl.dot @@ -0,0 +1,26 @@ +digraph "prom/include/prom_metric.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node4 [label="prom/include/prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node4 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom/include/prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector_8h.html",tooltip="A Prometheus collector returns a collection of metrics. "]; + Node5 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node6 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; + Node5 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="prom/include/prom_collector\l_registry.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector__registry_8h.html",tooltip="The collector registry registers collectors for metric exposition. "]; + Node8 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="prom/include/prom_counter.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__counter_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#counter "]; + Node9 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 [label="prom/include/prom_gauge.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__gauge_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#gauge "]; + Node10 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 -> Node11 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 [label="prom/include/prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node11 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__metric_8h__dep__incl.map b/docs/prom__metric_8h__dep__incl.map new file mode 100644 index 0000000..2e69242 --- /dev/null +++ b/docs/prom__metric_8h__dep__incl.map @@ -0,0 +1,9 @@ +<map id="prom/include/prom_metric.h" name="prom/include/prom_metric.h"> +<area shape="rect" id="node2" href="$prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="70,80,289,107"/> +<area shape="rect" id="node3" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="302,244,459,271"/> +<area shape="rect" id="node4" href="$prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="6,155,214,196"/> +<area shape="rect" id="node6" href="$prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="339,162,551,189"/> +<area shape="rect" id="node7" href="$prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="575,162,779,189"/> +<area shape="rect" id="node8" href="$prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="636,80,867,107"/> +<area shape="rect" id="node5" href="$promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="5,244,215,271"/> +</map> diff --git a/docs/prom__metric_8h__dep__incl.md5 b/docs/prom__metric_8h__dep__incl.md5 new file mode 100644 index 0000000..0397f55 --- /dev/null +++ b/docs/prom__metric_8h__dep__incl.md5 @@ -0,0 +1 @@ +554bf5edce3fa4f27e05188b41f3f1b8
\ No newline at end of file diff --git a/docs/prom__metric_8h__dep__incl.png b/docs/prom__metric_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..b5f321d --- /dev/null +++ b/docs/prom__metric_8h__dep__incl.png diff --git a/docs/prom__metric_8h__incl.dot b/docs/prom__metric_8h__incl.dot new file mode 100644 index 0000000..0367445 --- /dev/null +++ b/docs/prom__metric_8h__incl.dot @@ -0,0 +1,13 @@ +digraph "prom/include/prom_metric.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="prom_metric_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; + Node0 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom_metric_sample\l_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node3 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__metric_8h__incl.map b/docs/prom__metric_8h__incl.map new file mode 100644 index 0000000..d023f5a --- /dev/null +++ b/docs/prom__metric_8h__incl.map @@ -0,0 +1,4 @@ +<map id="prom/include/prom_metric.h" name="prom/include/prom_metric.h"> +<area shape="rect" id="node2" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="5,87,177,114"/> +<area shape="rect" id="node3" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="202,80,362,121"/> +</map> diff --git a/docs/prom__metric_8h__incl.md5 b/docs/prom__metric_8h__incl.md5 new file mode 100644 index 0000000..755c7f5 --- /dev/null +++ b/docs/prom__metric_8h__incl.md5 @@ -0,0 +1 @@ +d98b1c11d3c4b7656cc448699687339d
\ No newline at end of file diff --git a/docs/prom__metric_8h__incl.png b/docs/prom__metric_8h__incl.png Binary files differnew file mode 100644 index 0000000..73003e7 --- /dev/null +++ b/docs/prom__metric_8h__incl.png diff --git a/docs/prom__metric_8h_source.html b/docs/prom__metric_8h_source.html new file mode 100644 index 0000000..e3c75fb --- /dev/null +++ b/docs/prom__metric_8h_source.html @@ -0,0 +1,86 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_metric.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_metric.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__metric_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef PROM_METRIC_H</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define PROM_METRIC_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include "<a class="code" href="prom__metric__sample_8h.html">prom_metric_sample.h</a>"</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include "<a class="code" href="prom__metric__sample__histogram_8h.html">prom_metric_sample_histogram.h</a>"</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="keyword">struct </span>prom_metric;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889"> 34</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span>prom_metric <a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a>;</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> <a class="code" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a>* <a class="code" href="prom__metric_8h.html#a2c33d7e03b430a2903bf122fbeeb89de">prom_metric_sample_from_labels</a>(<a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *<span class="keyword">self</span>, <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <a class="code" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a>* <a class="code" href="prom__metric_8h.html#a3b76680b4a7177eebc864f3b3be1e935">prom_metric_sample_histogram_from_labels</a>(<a class="code" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> *<span class="keyword">self</span>,</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> **label_values);</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="preprocessor">#endif // PROM_METRIC_H</span></div><div class="ttc" id="prom__metric_8h_html_afd1bd014c48955d6c2c36aa8a8cbb889"><div class="ttname"><a href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a></div><div class="ttdeci">struct prom_metric prom_metric_t</div><div class="ttdoc">A prometheus metric. </div><div class="ttdef"><b>Definition:</b> prom_metric.h:34</div></div> +<div class="ttc" id="prom__metric__sample_8h_html"><div class="ttname"><a href="prom__metric__sample_8h.html">prom_metric_sample.h</a></div><div class="ttdoc">Functions for interfacting with metric samples directly. </div></div> +<div class="ttc" id="prom__metric__sample__histogram_8h_html_aed3455bc4eec61a3d8f01e6c1af84f9f"><div class="ttname"><a href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a></div><div class="ttdeci">struct prom_metric_sample_histogram prom_metric_sample_histogram_t</div><div class="ttdoc">A histogram metric sample. </div><div class="ttdef"><b>Definition:</b> prom_metric_sample_histogram.h:29</div></div> +<div class="ttc" id="prom__metric_8h_html_a3b76680b4a7177eebc864f3b3be1e935"><div class="ttname"><a href="prom__metric_8h.html#a3b76680b4a7177eebc864f3b3be1e935">prom_metric_sample_histogram_from_labels</a></div><div class="ttdeci">prom_metric_sample_histogram_t * prom_metric_sample_histogram_from_labels(prom_metric_t *self, const char **label_values)</div><div class="ttdoc">Returns a prom_metric_sample_histogram_t*. </div></div> +<div class="ttc" id="prom__metric__sample_8h_html_a0fb9ff851bf9ee126756ae826a2ce72a"><div class="ttname"><a href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a></div><div class="ttdeci">struct prom_metric_sample prom_metric_sample_t</div><div class="ttdoc">Contains the specific metric and value given the name and label set Reference: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels. </div><div class="ttdef"><b>Definition:</b> prom_metric_sample.h:30</div></div> +<div class="ttc" id="prom__metric__sample__histogram_8h_html"><div class="ttname"><a href="prom__metric__sample__histogram_8h.html">prom_metric_sample_histogram.h</a></div><div class="ttdoc">Functions for interacting with histogram metric samples directly. </div></div> +<div class="ttc" id="prom__metric_8h_html_a2c33d7e03b430a2903bf122fbeeb89de"><div class="ttname"><a href="prom__metric_8h.html#a2c33d7e03b430a2903bf122fbeeb89de">prom_metric_sample_from_labels</a></div><div class="ttdeci">prom_metric_sample_t * prom_metric_sample_from_labels(prom_metric_t *self, const char **label_values)</div><div class="ttdoc">Returns a prom_metric_sample_t*. </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__metric__sample_8h.html b/docs/prom__metric__sample_8h.html new file mode 100644 index 0000000..14b3f69 --- /dev/null +++ b/docs/prom__metric__sample_8h.html @@ -0,0 +1,239 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_metric_sample.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> </div> + <div class="headertitle"> +<div class="title">prom_metric_sample.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>Functions for interfacting with metric samples directly. +<a href="#details">More...</a></p> +<div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__metric__sample_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__metric__sample_8hdep" alt=""/></div> +<map name="prom_2include_2prom__metric__sample_8hdep" id="prom_2include_2prom__metric__sample_8hdep"> +<area shape="rect" id="node2" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="407,95,613,121"/> +<area shape="rect" id="node4" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="547,333,705,360"/> +<area shape="rect" id="node3" href="prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="147,169,366,196"/> +<area shape="rect" id="node5" href="prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="6,244,214,285"/> +<area shape="rect" id="node7" href="prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="288,251,500,278"/> +<area shape="rect" id="node8" href="prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="524,251,728,278"/> +<area shape="rect" id="node9" href="prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="548,169,779,196"/> +<area shape="rect" id="node6" href="promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="5,333,215,360"/> +</map> +</div> +</div> +<p><a href="prom__metric__sample_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:a0fb9ff851bf9ee126756ae826a2ce72a"><td class="memItemLeft" align="right" valign="top"><a id="a0fb9ff851bf9ee126756ae826a2ce72a"></a> +typedef struct prom_metric_sample </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a></td></tr> +<tr class="memdesc:a0fb9ff851bf9ee126756ae826a2ce72a"><td class="mdescLeft"> </td><td class="mdescRight">Contains the specific metric and value given the name and label set Reference: <a href="https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels">https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels</a>. <br /></td></tr> +<tr class="separator:a0fb9ff851bf9ee126756ae826a2ce72a"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a3f8674d6c8ee2c27eb7504d602110daa"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric__sample_8h.html#a3f8674d6c8ee2c27eb7504d602110daa">prom_metric_sample_add</a> (<a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> *self, double r_value)</td></tr> +<tr class="memdesc:a3f8674d6c8ee2c27eb7504d602110daa"><td class="mdescLeft"> </td><td class="mdescRight">Add the r_value to the sample. <a href="#a3f8674d6c8ee2c27eb7504d602110daa">More...</a><br /></td></tr> +<tr class="separator:a3f8674d6c8ee2c27eb7504d602110daa"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a1965caa1626c308bc1cb23995e90a0a7"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric__sample_8h.html#a1965caa1626c308bc1cb23995e90a0a7">prom_metric_sample_sub</a> (<a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> *self, double r_value)</td></tr> +<tr class="memdesc:a1965caa1626c308bc1cb23995e90a0a7"><td class="mdescLeft"> </td><td class="mdescRight">Subtract the r_value from the sample. <a href="#a1965caa1626c308bc1cb23995e90a0a7">More...</a><br /></td></tr> +<tr class="separator:a1965caa1626c308bc1cb23995e90a0a7"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a0c5f0c66599282c2ee2c042ae4574db3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric__sample_8h.html#a0c5f0c66599282c2ee2c042ae4574db3">prom_metric_sample_set</a> (<a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> *self, double r_value)</td></tr> +<tr class="memdesc:a0c5f0c66599282c2ee2c042ae4574db3"><td class="mdescLeft"> </td><td class="mdescRight">Set the r_value of the sample. <a href="#a0c5f0c66599282c2ee2c042ae4574db3">More...</a><br /></td></tr> +<tr class="separator:a0c5f0c66599282c2ee2c042ae4574db3"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Functions for interfacting with metric samples directly. </p> +</div><h2 class="groupheader">Function Documentation</h2> +<a id="a3f8674d6c8ee2c27eb7504d602110daa"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a3f8674d6c8ee2c27eb7504d602110daa">◆ </a></span>prom_metric_sample_add()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_metric_sample_add </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>r_value</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Add the r_value to the sample. </p> +<p>The value must be greater than or equal to zero. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_metric_sample_t* </td></tr> + <tr><td class="paramname">r_value</td><td>The double to add to prom_metric_sample_t* provided by self </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="a0c5f0c66599282c2ee2c042ae4574db3"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a0c5f0c66599282c2ee2c042ae4574db3">◆ </a></span>prom_metric_sample_set()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_metric_sample_set </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>r_value</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Set the r_value of the sample. </p> +<p>This operation MUST be called on a sample derived from a gauge metric. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_metric_sample_t* </td></tr> + <tr><td class="paramname">r_value</td><td>The double which will be set to the prom_metric_sample_t* provided by self </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Non-zero integer value upon failure </dd></dl> + +</div> +</div> +<a id="a1965caa1626c308bc1cb23995e90a0a7"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a1965caa1626c308bc1cb23995e90a0a7">◆ </a></span>prom_metric_sample_sub()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_metric_sample_sub </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>r_value</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Subtract the r_value from the sample. </p> +<p>This operation MUST be called a sample derived from a gauge metric. </p><dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_metric_sample_t* </td></tr> + <tr><td class="paramname">r_value</td><td>The double to subtract from the prom_metric_sample_t* provided by self </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Non-zero integer value upon failure </dd></dl> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__metric__sample_8h__dep__incl.dot b/docs/prom__metric__sample_8h__dep__incl.dot new file mode 100644 index 0000000..5a3288e --- /dev/null +++ b/docs/prom__metric__sample_8h__dep__incl.dot @@ -0,0 +1,29 @@ +digraph "prom/include/prom_metric_sample.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node2 [label="prom/include/prom_metric\l_sample.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom/include/prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node3 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom/include/prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector_8h.html",tooltip="A Prometheus collector returns a collection of metrics. "]; + Node4 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node5 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; + Node4 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="prom/include/prom_collector\l_registry.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector__registry_8h.html",tooltip="The collector registry registers collectors for metric exposition. "]; + Node7 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="prom/include/prom_counter.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__counter_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#counter "]; + Node8 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="prom/include/prom_gauge.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__gauge_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#gauge "]; + Node9 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 [label="prom/include/prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node10 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__metric__sample_8h__dep__incl.map b/docs/prom__metric__sample_8h__dep__incl.map new file mode 100644 index 0000000..6fa7770 --- /dev/null +++ b/docs/prom__metric__sample_8h__dep__incl.map @@ -0,0 +1,10 @@ +<map id="prom/include/prom_metric_sample.h" name="prom/include/prom_metric_sample.h"> +<area shape="rect" id="node2" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="407,95,613,121"/> +<area shape="rect" id="node4" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="547,333,705,360"/> +<area shape="rect" id="node3" href="$prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="147,169,366,196"/> +<area shape="rect" id="node5" href="$prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="6,244,214,285"/> +<area shape="rect" id="node7" href="$prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="288,251,500,278"/> +<area shape="rect" id="node8" href="$prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="524,251,728,278"/> +<area shape="rect" id="node9" href="$prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="548,169,779,196"/> +<area shape="rect" id="node6" href="$promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="5,333,215,360"/> +</map> diff --git a/docs/prom__metric__sample_8h__dep__incl.md5 b/docs/prom__metric__sample_8h__dep__incl.md5 new file mode 100644 index 0000000..a1b96d9 --- /dev/null +++ b/docs/prom__metric__sample_8h__dep__incl.md5 @@ -0,0 +1 @@ +654edc4d34421aacaf3050ba9af6bf75
\ No newline at end of file diff --git a/docs/prom__metric__sample_8h__dep__incl.png b/docs/prom__metric__sample_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..ce6a3c8 --- /dev/null +++ b/docs/prom__metric__sample_8h__dep__incl.png diff --git a/docs/prom__metric__sample_8h__incl.dot b/docs/prom__metric__sample_8h__incl.dot new file mode 100644 index 0000000..f66323f --- /dev/null +++ b/docs/prom__metric__sample_8h__incl.dot @@ -0,0 +1,8 @@ +digraph "prom/include/prom_metric_sample.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom_metric\l_sample.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; +} diff --git a/docs/prom__metric__sample_8h__incl.map b/docs/prom__metric__sample_8h__incl.map new file mode 100644 index 0000000..82210ff --- /dev/null +++ b/docs/prom__metric__sample_8h__incl.map @@ -0,0 +1,3 @@ +<map id="prom/include/prom_metric_sample.h" name="prom/include/prom_metric_sample.h"> +<area shape="rect" id="node2" href="$prom__errors_8h.html" title="Prometheus client errors. " alt="" coords="46,95,159,121"/> +</map> diff --git a/docs/prom__metric__sample_8h__incl.md5 b/docs/prom__metric__sample_8h__incl.md5 new file mode 100644 index 0000000..24487c0 --- /dev/null +++ b/docs/prom__metric__sample_8h__incl.md5 @@ -0,0 +1 @@ +6bae0b9a939e04235cee6cc7512e4eb3
\ No newline at end of file diff --git a/docs/prom__metric__sample_8h__incl.png b/docs/prom__metric__sample_8h__incl.png Binary files differnew file mode 100644 index 0000000..709c923 --- /dev/null +++ b/docs/prom__metric__sample_8h__incl.png diff --git a/docs/prom__metric__sample_8h_source.html b/docs/prom__metric__sample_8h_source.html new file mode 100644 index 0000000..aea6487 --- /dev/null +++ b/docs/prom__metric__sample_8h_source.html @@ -0,0 +1,83 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_metric_sample.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_metric_sample.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__metric__sample_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef PROM_METRIC_SAMPLE_H</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define PROM_METRIC_SAMPLE_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="keyword">struct </span>prom_metric_sample;</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a"> 30</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span>prom_metric_sample <a class="code" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a>;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="keywordtype">int</span> <a class="code" href="prom__metric__sample_8h.html#a3f8674d6c8ee2c27eb7504d602110daa">prom_metric_sample_add</a>(<a class="code" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> r_value);</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="keywordtype">int</span> <a class="code" href="prom__metric__sample_8h.html#a1965caa1626c308bc1cb23995e90a0a7">prom_metric_sample_sub</a>(<a class="code" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> r_value);</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> </div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="keywordtype">int</span> <a class="code" href="prom__metric__sample_8h.html#a0c5f0c66599282c2ee2c042ae4574db3">prom_metric_sample_set</a>(<a class="code" href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> r_value);</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> </div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="preprocessor">#endif // PROM_METRIC_SAMPLE_H</span></div><div class="ttc" id="prom__metric__sample_8h_html_a0fb9ff851bf9ee126756ae826a2ce72a"><div class="ttname"><a href="prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a">prom_metric_sample_t</a></div><div class="ttdeci">struct prom_metric_sample prom_metric_sample_t</div><div class="ttdoc">Contains the specific metric and value given the name and label set Reference: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels. </div><div class="ttdef"><b>Definition:</b> prom_metric_sample.h:30</div></div> +<div class="ttc" id="prom__metric__sample_8h_html_a3f8674d6c8ee2c27eb7504d602110daa"><div class="ttname"><a href="prom__metric__sample_8h.html#a3f8674d6c8ee2c27eb7504d602110daa">prom_metric_sample_add</a></div><div class="ttdeci">int prom_metric_sample_add(prom_metric_sample_t *self, double r_value)</div><div class="ttdoc">Add the r_value to the sample. </div></div> +<div class="ttc" id="prom__metric__sample_8h_html_a1965caa1626c308bc1cb23995e90a0a7"><div class="ttname"><a href="prom__metric__sample_8h.html#a1965caa1626c308bc1cb23995e90a0a7">prom_metric_sample_sub</a></div><div class="ttdeci">int prom_metric_sample_sub(prom_metric_sample_t *self, double r_value)</div><div class="ttdoc">Subtract the r_value from the sample. </div></div> +<div class="ttc" id="prom__metric__sample_8h_html_a0c5f0c66599282c2ee2c042ae4574db3"><div class="ttname"><a href="prom__metric__sample_8h.html#a0c5f0c66599282c2ee2c042ae4574db3">prom_metric_sample_set</a></div><div class="ttdeci">int prom_metric_sample_set(prom_metric_sample_t *self, double r_value)</div><div class="ttdoc">Set the r_value of the sample. </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__metric__sample__histogram_8h.html b/docs/prom__metric__sample__histogram_8h.html new file mode 100644 index 0000000..afdc92e --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h.html @@ -0,0 +1,157 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_metric_sample_histogram.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#typedef-members">Typedefs</a> | +<a href="#func-members">Functions</a> </div> + <div class="headertitle"> +<div class="title">prom_metric_sample_histogram.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>Functions for interacting with histogram metric samples directly. +<a href="#details">More...</a></p> +<div class="textblock"><div class="dynheader"> +This graph shows which files directly or indirectly include this file:</div> +<div class="dyncontent"> +<div class="center"><img src="prom__metric__sample__histogram_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__metric__sample__histogram_8hdep" alt=""/></div> +<map name="prom_2include_2prom__metric__sample__histogram_8hdep" id="prom_2include_2prom__metric__sample__histogram_8hdep"> +<area shape="rect" id="node2" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="407,95,613,121"/> +<area shape="rect" id="node4" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="547,333,705,360"/> +<area shape="rect" id="node3" href="prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="147,169,366,196"/> +<area shape="rect" id="node5" href="prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="6,244,214,285"/> +<area shape="rect" id="node7" href="prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="288,251,500,278"/> +<area shape="rect" id="node8" href="prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="524,251,728,278"/> +<area shape="rect" id="node9" href="prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="548,169,779,196"/> +<area shape="rect" id="node6" href="promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="5,333,215,360"/> +</map> +</div> +</div> +<p><a href="prom__metric__sample__histogram_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> +Typedefs</h2></td></tr> +<tr class="memitem:aed3455bc4eec61a3d8f01e6c1af84f9f"><td class="memItemLeft" align="right" valign="top"><a id="aed3455bc4eec61a3d8f01e6c1af84f9f"></a> +typedef struct prom_metric_sample_histogram </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a></td></tr> +<tr class="memdesc:aed3455bc4eec61a3d8f01e6c1af84f9f"><td class="mdescLeft"> </td><td class="mdescRight">A histogram metric sample. <br /></td></tr> +<tr class="separator:aed3455bc4eec61a3d8f01e6c1af84f9f"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a20a030bf6be56211c87c9feb520a3761"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__metric__sample__histogram_8h.html#a20a030bf6be56211c87c9feb520a3761">prom_metric_sample_histogram_observe</a> (<a class="el" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a> *self, double value)</td></tr> +<tr class="memdesc:a20a030bf6be56211c87c9feb520a3761"><td class="mdescLeft"> </td><td class="mdescRight">Observe the double for the given prom_metric_sample_histogram_observe_t. <a href="#a20a030bf6be56211c87c9feb520a3761">More...</a><br /></td></tr> +<tr class="separator:a20a030bf6be56211c87c9feb520a3761"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Functions for interacting with histogram metric samples directly. </p> +</div><h2 class="groupheader">Function Documentation</h2> +<a id="a20a030bf6be56211c87c9feb520a3761"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a20a030bf6be56211c87c9feb520a3761">◆ </a></span>prom_metric_sample_histogram_observe()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">int prom_metric_sample_histogram_observe </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a> * </td> + <td class="paramname"><em>self</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">double </td> + <td class="paramname"><em>value</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Observe the double for the given prom_metric_sample_histogram_observe_t. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">self</td><td>The target prom_metric_sample_histogram_t* </td></tr> + <tr><td class="paramname">value</td><td>The value to observe. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>Non-zero integer value upon failure </dd></dl> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/prom__metric__sample__histogram_8h__dep__incl.dot b/docs/prom__metric__sample__histogram_8h__dep__incl.dot new file mode 100644 index 0000000..217f3ad --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h__dep__incl.dot @@ -0,0 +1,28 @@ +digraph "prom/include/prom_metric_sample_histogram.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node2 [label="prom/include/prom_metric\l_sample_histogram.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom/include/prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node3 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom/include/prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector_8h.html",tooltip="A Prometheus collector returns a collection of metrics. "]; + Node4 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom/include/prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node5 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$promhttp_8h.html",tooltip="Provides a HTTP endpoint for metric exposition References: "]; + Node4 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="prom/include/prom_collector\l_registry.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector__registry_8h.html",tooltip="The collector registry registers collectors for metric exposition. "]; + Node7 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="prom/include/prom_counter.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__counter_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#counter "]; + Node8 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="prom/include/prom_gauge.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__gauge_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#gauge "]; + Node9 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 [label="prom/include/prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node10 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/prom__metric__sample__histogram_8h__dep__incl.map b/docs/prom__metric__sample__histogram_8h__dep__incl.map new file mode 100644 index 0000000..a1cf498 --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h__dep__incl.map @@ -0,0 +1,10 @@ +<map id="prom/include/prom_metric_sample_histogram.h" name="prom/include/prom_metric_sample_histogram.h"> +<area shape="rect" id="node2" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="407,95,613,121"/> +<area shape="rect" id="node4" href="$prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="547,333,705,360"/> +<area shape="rect" id="node3" href="$prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="147,169,366,196"/> +<area shape="rect" id="node5" href="$prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="6,244,214,285"/> +<area shape="rect" id="node7" href="$prom__counter_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#counter " alt="" coords="288,251,500,278"/> +<area shape="rect" id="node8" href="$prom__gauge_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#gauge " alt="" coords="524,251,728,278"/> +<area shape="rect" id="node9" href="$prom__histogram_8h.html" title="https://prometheus.io/docs/concepts/metric_types/#histogram " alt="" coords="548,169,779,196"/> +<area shape="rect" id="node6" href="$promhttp_8h.html" title="Provides a HTTP endpoint for metric exposition References: " alt="" coords="5,333,215,360"/> +</map> diff --git a/docs/prom__metric__sample__histogram_8h__dep__incl.md5 b/docs/prom__metric__sample__histogram_8h__dep__incl.md5 new file mode 100644 index 0000000..aa5b038 --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h__dep__incl.md5 @@ -0,0 +1 @@ +f8d476210371a4f4553c084b6f1bd334
\ No newline at end of file diff --git a/docs/prom__metric__sample__histogram_8h__dep__incl.png b/docs/prom__metric__sample__histogram_8h__dep__incl.png Binary files differnew file mode 100644 index 0000000..9a82f20 --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h__dep__incl.png diff --git a/docs/prom__metric__sample__histogram_8h__incl.dot b/docs/prom__metric__sample__histogram_8h__incl.dot new file mode 100644 index 0000000..8db67c1 --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h__incl.dot @@ -0,0 +1,8 @@ +digraph "prom/include/prom_metric_sample_histogram.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="prom/include/prom_metric\l_sample_histogram.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; +} diff --git a/docs/prom__metric__sample__histogram_8h__incl.map b/docs/prom__metric__sample__histogram_8h__incl.map new file mode 100644 index 0000000..28673a0 --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h__incl.map @@ -0,0 +1,3 @@ +<map id="prom/include/prom_metric_sample_histogram.h" name="prom/include/prom_metric_sample_histogram.h"> +<area shape="rect" id="node2" href="$prom__errors_8h.html" title="Prometheus client errors. " alt="" coords="46,95,159,121"/> +</map> diff --git a/docs/prom__metric__sample__histogram_8h__incl.md5 b/docs/prom__metric__sample__histogram_8h__incl.md5 new file mode 100644 index 0000000..2665445 --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h__incl.md5 @@ -0,0 +1 @@ +4a0783f96405ffb6caf6e1c466414e7b
\ No newline at end of file diff --git a/docs/prom__metric__sample__histogram_8h__incl.png b/docs/prom__metric__sample__histogram_8h__incl.png Binary files differnew file mode 100644 index 0000000..8d5dd2f --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h__incl.png diff --git a/docs/prom__metric__sample__histogram_8h_source.html b/docs/prom__metric__sample__histogram_8h_source.html new file mode 100644 index 0000000..b93d5ea --- /dev/null +++ b/docs/prom__metric__sample__histogram_8h_source.html @@ -0,0 +1,81 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom/include/prom_metric_sample_histogram.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_metric_sample_histogram.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="prom__metric__sample__histogram_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">*/</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef PROM_METRIC_SAMPLE_HISOTGRAM_H</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define PROM_METRIC_SAMPLE_HISOTGRAM_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="keyword">struct </span>prom_metric_sample_histogram;</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f"> 29</a></span> <span class="keyword">typedef</span> <span class="keyword">struct </span>prom_metric_sample_histogram <a class="code" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a>;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="keywordtype">int</span> <a class="code" href="prom__metric__sample__histogram_8h.html#a20a030bf6be56211c87c9feb520a3761">prom_metric_sample_histogram_observe</a>(<a class="code" href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a> *<span class="keyword">self</span>, <span class="keywordtype">double</span> value);</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#endif // PROM_METRIC_SAMPLE_HISOTGRAM_H</span></div><div class="ttc" id="prom__metric__sample__histogram_8h_html_a20a030bf6be56211c87c9feb520a3761"><div class="ttname"><a href="prom__metric__sample__histogram_8h.html#a20a030bf6be56211c87c9feb520a3761">prom_metric_sample_histogram_observe</a></div><div class="ttdeci">int prom_metric_sample_histogram_observe(prom_metric_sample_histogram_t *self, double value)</div><div class="ttdoc">Observe the double for the given prom_metric_sample_histogram_observe_t. </div></div> +<div class="ttc" id="prom__metric__sample__histogram_8h_html_aed3455bc4eec61a3d8f01e6c1af84f9f"><div class="ttname"><a href="prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f">prom_metric_sample_histogram_t</a></div><div class="ttdeci">struct prom_metric_sample_histogram prom_metric_sample_histogram_t</div><div class="ttdoc">A histogram metric sample. </div><div class="ttdef"><b>Definition:</b> prom_metric_sample_histogram.h:29</div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/promhttp_8h.html b/docs/promhttp_8h.html new file mode 100644 index 0000000..a4118f2 --- /dev/null +++ b/docs/promhttp_8h.html @@ -0,0 +1,191 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: promhttp/include/promhttp.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_21619567660c3332e6a61228c76007f9.html">promhttp</a></li><li class="navelem"><a class="el" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#func-members">Functions</a> </div> + <div class="headertitle"> +<div class="title">promhttp.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> + +<p>Provides a HTTP endpoint for metric exposition References: +<a href="#details">More...</a></p> +<div class="textblock"><code>#include <string.h></code><br /> +<code>#include "microhttpd.h"</code><br /> +<code>#include "<a class="el" href="prom__collector__registry_8h_source.html">prom_collector_registry.h</a>"</code><br /> +</div><div class="textblock"><div class="dynheader"> +Include dependency graph for promhttp.h:</div> +<div class="dyncontent"> +<div class="center"><img src="promhttp_8h__incl.png" border="0" usemap="#promhttp_2include_2promhttp_8h" alt=""/></div> +<map name="promhttp_2include_2promhttp_8h" id="promhttp_2include_2promhttp_8h"> +<area shape="rect" id="node4" href="prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="230,80,417,107"/> +<area shape="rect" id="node5" href="prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="207,155,338,181"/> +<area shape="rect" id="node7" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="317,229,434,256"/> +<area shape="rect" id="node6" href="prom__map_8h_source.html" title="prom_map.h" alt="" coords="189,229,293,256"/> +<area shape="rect" id="node8" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="195,311,367,338"/> +<area shape="rect" id="node9" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="391,304,551,345"/> +</map> +</div> +</div> +<p><a href="promhttp_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a712a45634bc22724fef9bedcb2841e00"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="promhttp_8h.html#a712a45634bc22724fef9bedcb2841e00">promhttp_set_active_collector_registry</a> (<a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *active_registry)</td></tr> +<tr class="memdesc:a712a45634bc22724fef9bedcb2841e00"><td class="mdescLeft"> </td><td class="mdescRight">Sets the active registry for metric scraping. <a href="#a712a45634bc22724fef9bedcb2841e00">More...</a><br /></td></tr> +<tr class="separator:a712a45634bc22724fef9bedcb2841e00"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a699ecc3aa11ed601269722f43da2823e"><td class="memItemLeft" align="right" valign="top">struct MHD_Daemon * </td><td class="memItemRight" valign="bottom"><a class="el" href="promhttp_8h.html#a699ecc3aa11ed601269722f43da2823e">promhttp_start_daemon</a> (unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls)</td></tr> +<tr class="memdesc:a699ecc3aa11ed601269722f43da2823e"><td class="mdescLeft"> </td><td class="mdescRight">Starts a daemon in the background and returns a pointer to an HMD_Daemon. <a href="#a699ecc3aa11ed601269722f43da2823e">More...</a><br /></td></tr> +<tr class="separator:a699ecc3aa11ed601269722f43da2823e"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Provides a HTTP endpoint for metric exposition References: </p> +<ul> +<li>MHD_FLAG: <a href="https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dconst">https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dconst</a></li> +<li>MHD_AcceptPolicyCallback: <a href="https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#index-_002aMHD_005fAcceptPolicyCallback">https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#index-_002aMHD_005fAcceptPolicyCallback</a> </li> +</ul> +</div><h2 class="groupheader">Function Documentation</h2> +<a id="a712a45634bc22724fef9bedcb2841e00"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a712a45634bc22724fef9bedcb2841e00">◆ </a></span>promhttp_set_active_collector_registry()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">void promhttp_set_active_collector_registry </td> + <td>(</td> + <td class="paramtype"><a class="el" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> * </td> + <td class="paramname"><em>active_registry</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Sets the active registry for metric scraping. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">active_registery</td><td>The target prom_collector_registry_t*. If null is passed, the default registry is used. The registry MUST be initialized. </td></tr> + </table> + </dd> +</dl> + +</div> +</div> +<a id="a699ecc3aa11ed601269722f43da2823e"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a699ecc3aa11ed601269722f43da2823e">◆ </a></span>promhttp_start_daemon()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">struct MHD_Daemon* promhttp_start_daemon </td> + <td>(</td> + <td class="paramtype">unsigned int </td> + <td class="paramname"><em>flags</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">unsigned short </td> + <td class="paramname"><em>port</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">MHD_AcceptPolicyCallback </td> + <td class="paramname"><em>apc</em>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">void * </td> + <td class="paramname"><em>apc_cls</em> </td> + </tr> + <tr> + <td></td> + <td>)</td> + <td></td><td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Starts a daemon in the background and returns a pointer to an HMD_Daemon. </p> +<p>References:</p><ul> +<li><a href="https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dinit">https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dinit</a></li> +</ul> +<dl class="section return"><dt>Returns</dt><dd>struct MHD_Daemon* </dd></dl> + +</div> +</div> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/promhttp_8h__incl.dot b/docs/promhttp_8h__incl.dot new file mode 100644 index 0000000..d5d937d --- /dev/null +++ b/docs/promhttp_8h__incl.dot @@ -0,0 +1,57 @@ +digraph "promhttp/include/promhttp.h" +{ + edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; + node [fontname="Helvetica",fontsize="10",shape=record]; + Node0 [label="promhttp/include/promhttp.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black"]; + Node0 -> Node1 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node1 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node0 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node2 [label="microhttpd.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node0 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 [label="prom.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom_8h.html",tooltip="Include prom.h to include the entire public API. "]; + Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node4 [label="prom_collector.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector_8h.html",tooltip="A Prometheus collector returns a collection of metrics. "]; + Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node5 [label="prom_errors.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__errors_8h.html",tooltip="Prometheus client errors. "]; + Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node6 [label="prom_map.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__map_8h_source.html"]; + Node4 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 [label="prom_metric.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric_8h.html"]; + Node7 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node8 [label="prom_metric_sample.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample_8h.html"]; + Node8 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node7 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node9 [label="prom_metric_sample\l_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__metric__sample__histogram_8h.html"]; + Node9 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 [label="prom_collector_registry.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__collector__registry_8h.html",tooltip="The collector registry registers collectors for metric exposition. "]; + Node10 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node10 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 [label="prom_counter.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__counter_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#counter "]; + Node11 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node12 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node11 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node11 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node13 [label="prom_gauge.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__gauge_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#gauge "]; + Node13 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node13 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node13 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node14 [label="prom_histogram.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node14 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node14 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node14 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node14 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node15 [label="prom_histogram_buckets.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__histogram__buckets_8h.html",tooltip="https://prometheus.io/docs/concepts/metric_types/#histogram "]; + Node3 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node16 [label="prom_linked_list.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$prom__linked__list_8h_source.html"]; + Node16 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; + Node3 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; +} diff --git a/docs/promhttp_8h__incl.map b/docs/promhttp_8h__incl.map new file mode 100644 index 0000000..3f9ccf5 --- /dev/null +++ b/docs/promhttp_8h__incl.map @@ -0,0 +1,8 @@ +<map id="promhttp/include/promhttp.h" name="promhttp/include/promhttp.h"> +<area shape="rect" id="node4" href="$prom__collector__registry_8h.html" title="The collector registry registers collectors for metric exposition. " alt="" coords="230,80,417,107"/> +<area shape="rect" id="node5" href="$prom__collector_8h.html" title="A Prometheus collector returns a collection of metrics. " alt="" coords="207,155,338,181"/> +<area shape="rect" id="node7" href="$prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="317,229,434,256"/> +<area shape="rect" id="node6" href="$prom__map_8h_source.html" title="prom_map.h" alt="" coords="189,229,293,256"/> +<area shape="rect" id="node8" href="$prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="195,311,367,338"/> +<area shape="rect" id="node9" href="$prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="391,304,551,345"/> +</map> diff --git a/docs/promhttp_8h__incl.md5 b/docs/promhttp_8h__incl.md5 new file mode 100644 index 0000000..b65965d --- /dev/null +++ b/docs/promhttp_8h__incl.md5 @@ -0,0 +1 @@ +f65d4556f9e2275a8aa84805ddc5422e
\ No newline at end of file diff --git a/docs/promhttp_8h__incl.png b/docs/promhttp_8h__incl.png Binary files differnew file mode 100644 index 0000000..ceaca65 --- /dev/null +++ b/docs/promhttp_8h__incl.png diff --git a/docs/promhttp_8h_source.html b/docs/promhttp_8h_source.html new file mode 100644 index 0000000..1626651 --- /dev/null +++ b/docs/promhttp_8h_source.html @@ -0,0 +1,83 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: promhttp/include/promhttp.h Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_21619567660c3332e6a61228c76007f9.html">promhttp</a></li><li class="navelem"><a class="el" href="dir_8d140c3a8bac3cd45205c9ea74fd211f.html">include</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">promhttp.h</div> </div> +</div><!--header--> +<div class="contents"> +<a href="promhttp_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> Copyright 2019 DigitalOcean Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> You may obtain a copy of the License at</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> limitations under the License.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> */</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include "microhttpd.h"</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> </div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include "<a class="code" href="prom__collector__registry_8h.html">prom_collector_registry.h</a>"</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="keywordtype">void</span> <a class="code" href="promhttp_8h.html#a712a45634bc22724fef9bedcb2841e00">promhttp_set_active_collector_registry</a>(<a class="code" href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a> *active_registry);</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> <span class="keyword">struct </span>MHD_Daemon* <a class="code" href="promhttp_8h.html#a699ecc3aa11ed601269722f43da2823e">promhttp_start_daemon</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags,</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> port,</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  MHD_AcceptPolicyCallback apc,</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordtype">void</span> *apc_cls);</div><div class="ttc" id="prom__collector__registry_8h_html_a20f07748401fbbde9efc8a718f9bc202"><div class="ttname"><a href="prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202">prom_collector_registry_t</a></div><div class="ttdeci">struct prom_collector_registry prom_collector_registry_t</div><div class="ttdoc">A prom_registry_t is responsible for registering metrics and briding them to the string exposition fo...</div><div class="ttdef"><b>Definition:</b> prom_collector_registry.h:31</div></div> +<div class="ttc" id="promhttp_8h_html_a712a45634bc22724fef9bedcb2841e00"><div class="ttname"><a href="promhttp_8h.html#a712a45634bc22724fef9bedcb2841e00">promhttp_set_active_collector_registry</a></div><div class="ttdeci">void promhttp_set_active_collector_registry(prom_collector_registry_t *active_registry)</div><div class="ttdoc">Sets the active registry for metric scraping. </div></div> +<div class="ttc" id="promhttp_8h_html_a699ecc3aa11ed601269722f43da2823e"><div class="ttname"><a href="promhttp_8h.html#a699ecc3aa11ed601269722f43da2823e">promhttp_start_daemon</a></div><div class="ttdeci">struct MHD_Daemon * promhttp_start_daemon(unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls)</div><div class="ttdoc">Starts a daemon in the background and returns a pointer to an HMD_Daemon. </div></div> +<div class="ttc" id="prom__collector__registry_8h_html"><div class="ttname"><a href="prom__collector__registry_8h.html">prom_collector_registry.h</a></div><div class="ttdoc">The collector registry registers collectors for metric exposition. </div></div> +</div><!-- fragment --></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/search/all_0.html b/docs/search/all_0.html new file mode 100644 index 0000000..f25360b --- /dev/null +++ b/docs/search/all_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="all_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/all_0.js b/docs/search/all_0.js new file mode 100644 index 0000000..bbd3bf0 --- /dev/null +++ b/docs/search/all_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['count',['count',['../structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621',1,'prom_histogram_buckets']]] +]; diff --git a/docs/search/all_1.html b/docs/search/all_1.html new file mode 100644 index 0000000..b13f0f7 --- /dev/null +++ b/docs/search/all_1.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="all_1.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/all_1.js b/docs/search/all_1.js new file mode 100644 index 0000000..9d5d65b --- /dev/null +++ b/docs/search/all_1.js @@ -0,0 +1,74 @@ +var searchData= +[ + ['prom_2eh',['prom.h',['../prom_8h.html',1,'']]], + ['prom_5falloc_2eh',['prom_alloc.h',['../prom__alloc_8h.html',1,'']]], + ['prom_5fcollect_5ffn',['prom_collect_fn',['../prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40',1,'prom_collector.h']]], + ['prom_5fcollector_2eh',['prom_collector.h',['../prom__collector_8h.html',1,'']]], + ['prom_5fcollector_5fadd_5fmetric',['prom_collector_add_metric',['../prom__collector_8h.html#abd87021bd63f759d55642685a74874ee',1,'prom_collector.h']]], + ['prom_5fcollector_5fdestroy',['prom_collector_destroy',['../prom__collector_8h.html#a037b72b2edb81a477999a7dfc08758c7',1,'prom_collector.h']]], + ['prom_5fcollector_5fdestroy_5fgeneric',['prom_collector_destroy_generic',['../prom__collector_8h.html#a12c297cce0a30ee4149f2b486d9f0337',1,'prom_collector.h']]], + ['prom_5fcollector_5ffree_5fgeneric',['prom_collector_free_generic',['../prom__collector_8h.html#a875b72940cd578ee76c71f1f4853f139',1,'prom_collector.h']]], + ['prom_5fcollector_5fnew',['prom_collector_new',['../prom__collector_8h.html#a4300cf33b6f8e4457df385c3d2a51a4b',1,'prom_collector.h']]], + ['prom_5fcollector_5fprocess_5fnew',['prom_collector_process_new',['../prom__collector_8h.html#af50746bb4af87eda617fa08237e3834e',1,'prom_collector.h']]], + ['prom_5fcollector_5fregistry_2eh',['prom_collector_registry.h',['../prom__collector__registry_8h.html',1,'']]], + ['prom_5fcollector_5fregistry_5fbridge',['prom_collector_registry_bridge',['../prom__collector__registry_8h.html#a0149a2702ae0b3ff39d57904d613c14f',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fdefault',['PROM_COLLECTOR_REGISTRY_DEFAULT',['../prom__collector__registry_8h.html#a6092b48e150390c1927da5fe8914981b',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fdefault_5finit',['prom_collector_registry_default_init',['../prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fdestroy',['prom_collector_registry_destroy',['../prom__collector__registry_8h.html#ad3854e6e40b6f741fde53dc65f0ecd87',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fenable_5fprocess_5fmetrics',['prom_collector_registry_enable_process_metrics',['../prom__collector__registry_8h.html#a0d59bf988de4ee29e076910fa7135071',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fmust_5fregister_5fmetric',['prom_collector_registry_must_register_metric',['../prom__collector__registry_8h.html#a113683f4e15ad9240a37ed2139ddaea6',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fnew',['prom_collector_registry_new',['../prom__collector__registry_8h.html#ab5d622258998978c528253f07e2903b8',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fregister_5fcollector',['prom_collector_registry_register_collector',['../prom__collector__registry_8h.html#a42203da085c6c6f2bc3ba31501683882',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fregister_5fmetric',['prom_collector_registry_register_metric',['../prom__collector__registry_8h.html#aa735fa0fbe03d6d9a0d11eb4792ec761',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5ft',['prom_collector_registry_t',['../prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fvalidate_5fmetric_5fname',['prom_collector_registry_validate_metric_name',['../prom__collector__registry_8h.html#acf002221c3239584723f9fb15c53e15e',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fset_5fcollect_5ffn',['prom_collector_set_collect_fn',['../prom__collector_8h.html#a9929cb81f4fb49ffca8aa880a4699650',1,'prom_collector.h']]], + ['prom_5fcollector_5ft',['prom_collector_t',['../prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c',1,'prom_collector.h']]], + ['prom_5fcounter_2eh',['prom_counter.h',['../prom__counter_8h.html',1,'']]], + ['prom_5fcounter_5fadd',['prom_counter_add',['../prom__counter_8h.html#addd8a7efc39e17d30b2267e5a0a626db',1,'prom_counter.h']]], + ['prom_5fcounter_5fdestroy',['prom_counter_destroy',['../prom__counter_8h.html#ac36abc71c11df1e774c8c102b1fdb78d',1,'prom_counter.h']]], + ['prom_5fcounter_5finc',['prom_counter_inc',['../prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35',1,'prom_counter.h']]], + ['prom_5fcounter_5fnew',['prom_counter_new',['../prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651',1,'prom_counter.h']]], + ['prom_5fcounter_5ft',['prom_counter_t',['../prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606',1,'prom_counter.h']]], + ['prom_5ffree',['prom_free',['../prom__alloc_8h.html#a19b2231f9b45a520bbbcf046ed5d81ef',1,'prom_alloc.h']]], + ['prom_5fgauge_2eh',['prom_gauge.h',['../prom__gauge_8h.html',1,'']]], + ['prom_5fgauge_5fadd',['prom_gauge_add',['../prom__gauge_8h.html#a96bc5b32abee5f99fbd4ae11bebd44c8',1,'prom_gauge.h']]], + ['prom_5fgauge_5fdec',['prom_gauge_dec',['../prom__gauge_8h.html#aa351ef4f2d917d7dae914df6d81c547b',1,'prom_gauge.h']]], + ['prom_5fgauge_5fdestroy',['prom_gauge_destroy',['../prom__gauge_8h.html#a2fc5dc11239cefdf59ae978be4bfd789',1,'prom_gauge.h']]], + ['prom_5fgauge_5finc',['prom_gauge_inc',['../prom__gauge_8h.html#ad953b12ea1f8a3c3b7a39e6c260d07a2',1,'prom_gauge.h']]], + ['prom_5fgauge_5fnew',['prom_gauge_new',['../prom__gauge_8h.html#a5ecd07c83cf0981944a9256914571d70',1,'prom_gauge.h']]], + ['prom_5fgauge_5fset',['prom_gauge_set',['../prom__gauge_8h.html#a04210b18bfb89aa6f3ddc72d7851a528',1,'prom_gauge.h']]], + ['prom_5fgauge_5fsub',['prom_gauge_sub',['../prom__gauge_8h.html#a7ae193d586176bff82a39cd65e2bc999',1,'prom_gauge.h']]], + ['prom_5fgauge_5ft',['prom_gauge_t',['../prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5',1,'prom_gauge.h']]], + ['prom_5fhistogram_2eh',['prom_histogram.h',['../prom__histogram_8h.html',1,'']]], + ['prom_5fhistogram_5fbuckets',['prom_histogram_buckets',['../structprom__histogram__buckets.html',1,'']]], + ['prom_5fhistogram_5fbuckets_2eh',['prom_histogram_buckets.h',['../prom__histogram__buckets_8h.html',1,'']]], + ['prom_5fhistogram_5fbuckets_5fcount',['prom_histogram_buckets_count',['../prom__histogram__buckets_8h.html#a92158192cfe9a71a98dbb1d9adc8508a',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fbuckets_5fdestroy',['prom_histogram_buckets_destroy',['../prom__histogram__buckets_8h.html#a36bc3312f8f479bbd6eb92fa3b1a5033',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fbuckets_5fexponential',['prom_histogram_buckets_exponential',['../prom__histogram__buckets_8h.html#a164da4101785b6fa2a292a964c232f12',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fbuckets_5flinear',['prom_histogram_buckets_linear',['../prom__histogram__buckets_8h.html#aa1adc550bf8999a27f6a26769d6bfc72',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fbuckets_5fnew',['prom_histogram_buckets_new',['../prom__histogram__buckets_8h.html#a03736e2fac21748bbfd80100bf9546c4',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fdefault_5fbuckets',['prom_histogram_default_buckets',['../prom__histogram__buckets_8h.html#aa8d61c1abc355eb54173b27cb1b50a5d',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fdestroy',['prom_histogram_destroy',['../prom__histogram_8h.html#af9067b27e7ab2abd815af0614bb35357',1,'prom_histogram.h']]], + ['prom_5fhistogram_5fnew',['prom_histogram_new',['../prom__histogram_8h.html#ad42681e59e727f9e3d43bf0cdbba9a1b',1,'prom_histogram.h']]], + ['prom_5fhistogram_5fobserve',['prom_histogram_observe',['../prom__histogram_8h.html#a274e4b869c7d9239e9f47b3898210fbe',1,'prom_histogram.h']]], + ['prom_5fhistogram_5ft',['prom_histogram_t',['../prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae',1,'prom_histogram.h']]], + ['prom_5fmalloc',['prom_malloc',['../prom__alloc_8h.html#ae1613c091e07daa2bfa4303ef5628827',1,'prom_alloc.h']]], + ['prom_5fmetric_2eh',['prom_metric.h',['../prom__metric_8h.html',1,'']]], + ['prom_5fmetric_5fsample_2eh',['prom_metric_sample.h',['../prom__metric__sample_8h.html',1,'']]], + ['prom_5fmetric_5fsample_5fadd',['prom_metric_sample_add',['../prom__metric__sample_8h.html#a3f8674d6c8ee2c27eb7504d602110daa',1,'prom_metric_sample.h']]], + ['prom_5fmetric_5fsample_5ffrom_5flabels',['prom_metric_sample_from_labels',['../prom__metric_8h.html#a2c33d7e03b430a2903bf122fbeeb89de',1,'prom_metric.h']]], + ['prom_5fmetric_5fsample_5fhistogram_2eh',['prom_metric_sample_histogram.h',['../prom__metric__sample__histogram_8h.html',1,'']]], + ['prom_5fmetric_5fsample_5fhistogram_5ffrom_5flabels',['prom_metric_sample_histogram_from_labels',['../prom__metric_8h.html#a3b76680b4a7177eebc864f3b3be1e935',1,'prom_metric.h']]], + ['prom_5fmetric_5fsample_5fhistogram_5fobserve',['prom_metric_sample_histogram_observe',['../prom__metric__sample__histogram_8h.html#a20a030bf6be56211c87c9feb520a3761',1,'prom_metric_sample_histogram.h']]], + ['prom_5fmetric_5fsample_5fhistogram_5ft',['prom_metric_sample_histogram_t',['../prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f',1,'prom_metric_sample_histogram.h']]], + ['prom_5fmetric_5fsample_5fset',['prom_metric_sample_set',['../prom__metric__sample_8h.html#a0c5f0c66599282c2ee2c042ae4574db3',1,'prom_metric_sample.h']]], + ['prom_5fmetric_5fsample_5fsub',['prom_metric_sample_sub',['../prom__metric__sample_8h.html#a1965caa1626c308bc1cb23995e90a0a7',1,'prom_metric_sample.h']]], + ['prom_5fmetric_5fsample_5ft',['prom_metric_sample_t',['../prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a',1,'prom_metric_sample.h']]], + ['prom_5fmetric_5ft',['prom_metric_t',['../prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889',1,'prom_metric.h']]], + ['prom_5frealloc',['prom_realloc',['../prom__alloc_8h.html#aab8dc4629c851a8c59cc721bd2f7c6f3',1,'prom_alloc.h']]], + ['prom_5fstrdup',['prom_strdup',['../prom__alloc_8h.html#a21faa2fafc84c8ca25467fe9cb0a55f3',1,'prom_alloc.h']]], + ['promhttp_2eh',['promhttp.h',['../promhttp_8h.html',1,'']]], + ['promhttp_5fset_5factive_5fcollector_5fregistry',['promhttp_set_active_collector_registry',['../promhttp_8h.html#a712a45634bc22724fef9bedcb2841e00',1,'promhttp.h']]], + ['promhttp_5fstart_5fdaemon',['promhttp_start_daemon',['../promhttp_8h.html#a699ecc3aa11ed601269722f43da2823e',1,'promhttp.h']]] +]; diff --git a/docs/search/all_2.html b/docs/search/all_2.html new file mode 100644 index 0000000..9543c57 --- /dev/null +++ b/docs/search/all_2.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="all_2.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/all_2.js b/docs/search/all_2.js new file mode 100644 index 0000000..441b2de --- /dev/null +++ b/docs/search/all_2.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['todo_20list',['Todo List',['../todo.html',1,'']]] +]; diff --git a/docs/search/all_3.html b/docs/search/all_3.html new file mode 100644 index 0000000..03405c0 --- /dev/null +++ b/docs/search/all_3.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="all_3.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/all_3.js b/docs/search/all_3.js new file mode 100644 index 0000000..f8121ac --- /dev/null +++ b/docs/search/all_3.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['upper_5fbounds',['upper_bounds',['../structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344',1,'prom_histogram_buckets']]] +]; diff --git a/docs/search/all_4.html b/docs/search/all_4.html new file mode 100644 index 0000000..8e1f4b9 --- /dev/null +++ b/docs/search/all_4.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="all_4.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/all_4.js b/docs/search/all_4.js new file mode 100644 index 0000000..5459b5b --- /dev/null +++ b/docs/search/all_4.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['welcome_20to_20the_20documentation_20site_20for_20prometheus_2dclient_2dc_21',['Welcome to the documentation site for prometheus-client-c!',['../index.html',1,'']]] +]; diff --git a/docs/search/classes_0.html b/docs/search/classes_0.html new file mode 100644 index 0000000..1c3e406 --- /dev/null +++ b/docs/search/classes_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="classes_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/classes_0.js b/docs/search/classes_0.js new file mode 100644 index 0000000..6a612bc --- /dev/null +++ b/docs/search/classes_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['prom_5fhistogram_5fbuckets',['prom_histogram_buckets',['../structprom__histogram__buckets.html',1,'']]] +]; diff --git a/docs/search/close.png b/docs/search/close.png Binary files differnew file mode 100644 index 0000000..9342d3d --- /dev/null +++ b/docs/search/close.png diff --git a/docs/search/defines_0.html b/docs/search/defines_0.html new file mode 100644 index 0000000..5b25204 --- /dev/null +++ b/docs/search/defines_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="defines_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/defines_0.js b/docs/search/defines_0.js new file mode 100644 index 0000000..e7ffca3 --- /dev/null +++ b/docs/search/defines_0.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['prom_5ffree',['prom_free',['../prom__alloc_8h.html#a19b2231f9b45a520bbbcf046ed5d81ef',1,'prom_alloc.h']]], + ['prom_5fmalloc',['prom_malloc',['../prom__alloc_8h.html#ae1613c091e07daa2bfa4303ef5628827',1,'prom_alloc.h']]], + ['prom_5frealloc',['prom_realloc',['../prom__alloc_8h.html#aab8dc4629c851a8c59cc721bd2f7c6f3',1,'prom_alloc.h']]], + ['prom_5fstrdup',['prom_strdup',['../prom__alloc_8h.html#a21faa2fafc84c8ca25467fe9cb0a55f3',1,'prom_alloc.h']]] +]; diff --git a/docs/search/enums_0.html b/docs/search/enums_0.html new file mode 100644 index 0000000..ee343ac --- /dev/null +++ b/docs/search/enums_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="enums_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/enums_0.js b/docs/search/enums_0.js new file mode 100644 index 0000000..558c2bd --- /dev/null +++ b/docs/search/enums_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['prom_5freturn_5fcode',['prom_return_code',['../prom__errors_8h.html#ae9dcc70f3217ae6f5cd331dbdef06602',1,'prom_errors.h']]] +]; diff --git a/docs/search/enumvalues_0.html b/docs/search/enumvalues_0.html new file mode 100644 index 0000000..9387b6a --- /dev/null +++ b/docs/search/enumvalues_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="enumvalues_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/enumvalues_0.js b/docs/search/enumvalues_0.js new file mode 100644 index 0000000..7796db7 --- /dev/null +++ b/docs/search/enumvalues_0.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['prom_5fcollector_5fregistration_5ffailure',['PROM_COLLECTOR_REGISTRATION_FAILURE',['../prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830a23269fa188cfe85113887765ae300781',1,'prom_errors.h']]], + ['prom_5ffailure',['PROM_FAILURE',['../prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830a20d1dda215f590d375c018ecabb065cc',1,'prom_errors.h']]], + ['prom_5finvalid_5fmetric_5ftype',['PROM_INVALID_METRIC_TYPE',['../prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830a11a15b66987a9d455f369a94101205fc',1,'prom_errors.h']]], + ['prom_5fmetric_5fregistration_5ffailure',['PROM_METRIC_REGISTRATION_FAILURE',['../prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830ae3ad35c6d86de06362db4735e0805416',1,'prom_errors.h']]], + ['prom_5fsuccess',['PROM_SUCCESS',['../prom__errors_8h.html#a3b3873fa7ceb3c9e4a8d714771fb4830a4860821c9dc1ba212354b29a48b8c59c',1,'prom_errors.h']]] +]; diff --git a/docs/search/files_0.html b/docs/search/files_0.html new file mode 100644 index 0000000..4f272b8 --- /dev/null +++ b/docs/search/files_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="files_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/files_0.js b/docs/search/files_0.js new file mode 100644 index 0000000..6afd224 --- /dev/null +++ b/docs/search/files_0.js @@ -0,0 +1,15 @@ +var searchData= +[ + ['prom_2eh',['prom.h',['../prom_8h.html',1,'']]], + ['prom_5falloc_2eh',['prom_alloc.h',['../prom__alloc_8h.html',1,'']]], + ['prom_5fcollector_2eh',['prom_collector.h',['../prom__collector_8h.html',1,'']]], + ['prom_5fcollector_5fregistry_2eh',['prom_collector_registry.h',['../prom__collector__registry_8h.html',1,'']]], + ['prom_5fcounter_2eh',['prom_counter.h',['../prom__counter_8h.html',1,'']]], + ['prom_5fgauge_2eh',['prom_gauge.h',['../prom__gauge_8h.html',1,'']]], + ['prom_5fhistogram_2eh',['prom_histogram.h',['../prom__histogram_8h.html',1,'']]], + ['prom_5fhistogram_5fbuckets_2eh',['prom_histogram_buckets.h',['../prom__histogram__buckets_8h.html',1,'']]], + ['prom_5fmetric_2eh',['prom_metric.h',['../prom__metric_8h.html',1,'']]], + ['prom_5fmetric_5fsample_2eh',['prom_metric_sample.h',['../prom__metric__sample_8h.html',1,'']]], + ['prom_5fmetric_5fsample_5fhistogram_2eh',['prom_metric_sample_histogram.h',['../prom__metric__sample__histogram_8h.html',1,'']]], + ['promhttp_2eh',['promhttp.h',['../promhttp_8h.html',1,'']]] +]; diff --git a/docs/search/functions_0.html b/docs/search/functions_0.html new file mode 100644 index 0000000..4e6d87d --- /dev/null +++ b/docs/search/functions_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="functions_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/functions_0.js b/docs/search/functions_0.js new file mode 100644 index 0000000..2a8fcb6 --- /dev/null +++ b/docs/search/functions_0.js @@ -0,0 +1,46 @@ +var searchData= +[ + ['prom_5fcollector_5fadd_5fmetric',['prom_collector_add_metric',['../prom__collector_8h.html#abd87021bd63f759d55642685a74874ee',1,'prom_collector.h']]], + ['prom_5fcollector_5fdestroy',['prom_collector_destroy',['../prom__collector_8h.html#a037b72b2edb81a477999a7dfc08758c7',1,'prom_collector.h']]], + ['prom_5fcollector_5fdestroy_5fgeneric',['prom_collector_destroy_generic',['../prom__collector_8h.html#a12c297cce0a30ee4149f2b486d9f0337',1,'prom_collector.h']]], + ['prom_5fcollector_5ffree_5fgeneric',['prom_collector_free_generic',['../prom__collector_8h.html#a875b72940cd578ee76c71f1f4853f139',1,'prom_collector.h']]], + ['prom_5fcollector_5fnew',['prom_collector_new',['../prom__collector_8h.html#a4300cf33b6f8e4457df385c3d2a51a4b',1,'prom_collector.h']]], + ['prom_5fcollector_5fprocess_5fnew',['prom_collector_process_new',['../prom__collector_8h.html#af50746bb4af87eda617fa08237e3834e',1,'prom_collector.h']]], + ['prom_5fcollector_5fregistry_5fbridge',['prom_collector_registry_bridge',['../prom__collector__registry_8h.html#a0149a2702ae0b3ff39d57904d613c14f',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fdefault_5finit',['prom_collector_registry_default_init',['../prom__collector__registry_8h.html#aaf1421bd744f0dbbdaba7e64cec11f54',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fdestroy',['prom_collector_registry_destroy',['../prom__collector__registry_8h.html#ad3854e6e40b6f741fde53dc65f0ecd87',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fenable_5fprocess_5fmetrics',['prom_collector_registry_enable_process_metrics',['../prom__collector__registry_8h.html#a0d59bf988de4ee29e076910fa7135071',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fmust_5fregister_5fmetric',['prom_collector_registry_must_register_metric',['../prom__collector__registry_8h.html#a113683f4e15ad9240a37ed2139ddaea6',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fnew',['prom_collector_registry_new',['../prom__collector__registry_8h.html#ab5d622258998978c528253f07e2903b8',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fregister_5fcollector',['prom_collector_registry_register_collector',['../prom__collector__registry_8h.html#a42203da085c6c6f2bc3ba31501683882',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fregister_5fmetric',['prom_collector_registry_register_metric',['../prom__collector__registry_8h.html#aa735fa0fbe03d6d9a0d11eb4792ec761',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fregistry_5fvalidate_5fmetric_5fname',['prom_collector_registry_validate_metric_name',['../prom__collector__registry_8h.html#acf002221c3239584723f9fb15c53e15e',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5fset_5fcollect_5ffn',['prom_collector_set_collect_fn',['../prom__collector_8h.html#a9929cb81f4fb49ffca8aa880a4699650',1,'prom_collector.h']]], + ['prom_5fcounter_5fadd',['prom_counter_add',['../prom__counter_8h.html#addd8a7efc39e17d30b2267e5a0a626db',1,'prom_counter.h']]], + ['prom_5fcounter_5fdestroy',['prom_counter_destroy',['../prom__counter_8h.html#ac36abc71c11df1e774c8c102b1fdb78d',1,'prom_counter.h']]], + ['prom_5fcounter_5finc',['prom_counter_inc',['../prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35',1,'prom_counter.h']]], + ['prom_5fcounter_5fnew',['prom_counter_new',['../prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651',1,'prom_counter.h']]], + ['prom_5fgauge_5fadd',['prom_gauge_add',['../prom__gauge_8h.html#a96bc5b32abee5f99fbd4ae11bebd44c8',1,'prom_gauge.h']]], + ['prom_5fgauge_5fdec',['prom_gauge_dec',['../prom__gauge_8h.html#aa351ef4f2d917d7dae914df6d81c547b',1,'prom_gauge.h']]], + ['prom_5fgauge_5fdestroy',['prom_gauge_destroy',['../prom__gauge_8h.html#a2fc5dc11239cefdf59ae978be4bfd789',1,'prom_gauge.h']]], + ['prom_5fgauge_5finc',['prom_gauge_inc',['../prom__gauge_8h.html#ad953b12ea1f8a3c3b7a39e6c260d07a2',1,'prom_gauge.h']]], + ['prom_5fgauge_5fnew',['prom_gauge_new',['../prom__gauge_8h.html#a5ecd07c83cf0981944a9256914571d70',1,'prom_gauge.h']]], + ['prom_5fgauge_5fset',['prom_gauge_set',['../prom__gauge_8h.html#a04210b18bfb89aa6f3ddc72d7851a528',1,'prom_gauge.h']]], + ['prom_5fgauge_5fsub',['prom_gauge_sub',['../prom__gauge_8h.html#a7ae193d586176bff82a39cd65e2bc999',1,'prom_gauge.h']]], + ['prom_5fhistogram_5fbuckets_5fcount',['prom_histogram_buckets_count',['../prom__histogram__buckets_8h.html#a92158192cfe9a71a98dbb1d9adc8508a',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fbuckets_5fdestroy',['prom_histogram_buckets_destroy',['../prom__histogram__buckets_8h.html#a36bc3312f8f479bbd6eb92fa3b1a5033',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fbuckets_5fexponential',['prom_histogram_buckets_exponential',['../prom__histogram__buckets_8h.html#a164da4101785b6fa2a292a964c232f12',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fbuckets_5flinear',['prom_histogram_buckets_linear',['../prom__histogram__buckets_8h.html#aa1adc550bf8999a27f6a26769d6bfc72',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fbuckets_5fnew',['prom_histogram_buckets_new',['../prom__histogram__buckets_8h.html#a03736e2fac21748bbfd80100bf9546c4',1,'prom_histogram_buckets.h']]], + ['prom_5fhistogram_5fdestroy',['prom_histogram_destroy',['../prom__histogram_8h.html#af9067b27e7ab2abd815af0614bb35357',1,'prom_histogram.h']]], + ['prom_5fhistogram_5fnew',['prom_histogram_new',['../prom__histogram_8h.html#ad42681e59e727f9e3d43bf0cdbba9a1b',1,'prom_histogram.h']]], + ['prom_5fhistogram_5fobserve',['prom_histogram_observe',['../prom__histogram_8h.html#a274e4b869c7d9239e9f47b3898210fbe',1,'prom_histogram.h']]], + ['prom_5fmetric_5fsample_5fadd',['prom_metric_sample_add',['../prom__metric__sample_8h.html#a3f8674d6c8ee2c27eb7504d602110daa',1,'prom_metric_sample.h']]], + ['prom_5fmetric_5fsample_5ffrom_5flabels',['prom_metric_sample_from_labels',['../prom__metric_8h.html#a2c33d7e03b430a2903bf122fbeeb89de',1,'prom_metric.h']]], + ['prom_5fmetric_5fsample_5fhistogram_5ffrom_5flabels',['prom_metric_sample_histogram_from_labels',['../prom__metric_8h.html#a3b76680b4a7177eebc864f3b3be1e935',1,'prom_metric.h']]], + ['prom_5fmetric_5fsample_5fhistogram_5fobserve',['prom_metric_sample_histogram_observe',['../prom__metric__sample__histogram_8h.html#a20a030bf6be56211c87c9feb520a3761',1,'prom_metric_sample_histogram.h']]], + ['prom_5fmetric_5fsample_5fset',['prom_metric_sample_set',['../prom__metric__sample_8h.html#a0c5f0c66599282c2ee2c042ae4574db3',1,'prom_metric_sample.h']]], + ['prom_5fmetric_5fsample_5fsub',['prom_metric_sample_sub',['../prom__metric__sample_8h.html#a1965caa1626c308bc1cb23995e90a0a7',1,'prom_metric_sample.h']]], + ['promhttp_5fset_5factive_5fcollector_5fregistry',['promhttp_set_active_collector_registry',['../promhttp_8h.html#a712a45634bc22724fef9bedcb2841e00',1,'promhttp.h']]], + ['promhttp_5fstart_5fdaemon',['promhttp_start_daemon',['../promhttp_8h.html#a699ecc3aa11ed601269722f43da2823e',1,'promhttp.h']]] +]; diff --git a/docs/search/mag_sel.png b/docs/search/mag_sel.png Binary files differnew file mode 100644 index 0000000..81f6040 --- /dev/null +++ b/docs/search/mag_sel.png diff --git a/docs/search/nomatches.html b/docs/search/nomatches.html new file mode 100644 index 0000000..b1ded27 --- /dev/null +++ b/docs/search/nomatches.html @@ -0,0 +1,12 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="NoMatches">No Matches</div> +</div> +</body> +</html> diff --git a/docs/search/pages_0.html b/docs/search/pages_0.html new file mode 100644 index 0000000..4955b9e --- /dev/null +++ b/docs/search/pages_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="pages_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/pages_0.js b/docs/search/pages_0.js new file mode 100644 index 0000000..441b2de --- /dev/null +++ b/docs/search/pages_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['todo_20list',['Todo List',['../todo.html',1,'']]] +]; diff --git a/docs/search/pages_1.html b/docs/search/pages_1.html new file mode 100644 index 0000000..aedb14e --- /dev/null +++ b/docs/search/pages_1.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="pages_1.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/pages_1.js b/docs/search/pages_1.js new file mode 100644 index 0000000..5459b5b --- /dev/null +++ b/docs/search/pages_1.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['welcome_20to_20the_20documentation_20site_20for_20prometheus_2dclient_2dc_21',['Welcome to the documentation site for prometheus-client-c!',['../index.html',1,'']]] +]; diff --git a/docs/search/search.css b/docs/search/search.css new file mode 100644 index 0000000..3cf9df9 --- /dev/null +++ b/docs/search/search.css @@ -0,0 +1,271 @@ +/*---------------- Search Box */ + +#FSearchBox { + float: left; +} + +#MSearchBox { + white-space : nowrap; + float: none; + margin-top: 8px; + right: 0px; + width: 170px; + height: 24px; + z-index: 102; +} + +#MSearchBox .left +{ + display:block; + position:absolute; + left:10px; + width:20px; + height:19px; + background:url('search_l.png') no-repeat; + background-position:right; +} + +#MSearchSelect { + display:block; + position:absolute; + width:20px; + height:19px; +} + +.left #MSearchSelect { + left:4px; +} + +.right #MSearchSelect { + right:5px; +} + +#MSearchField { + display:block; + position:absolute; + height:19px; + background:url('search_m.png') repeat-x; + border:none; + width:115px; + margin-left:20px; + padding-left:4px; + color: #909090; + outline: none; + font: 9pt Arial, Verdana, sans-serif; + -webkit-border-radius: 0px; +} + +#FSearchBox #MSearchField { + margin-left:15px; +} + +#MSearchBox .right { + display:block; + position:absolute; + right:10px; + top:8px; + width:20px; + height:19px; + background:url('search_r.png') no-repeat; + background-position:left; +} + +#MSearchClose { + display: none; + position: absolute; + top: 4px; + background : none; + border: none; + margin: 0px 4px 0px 0px; + padding: 0px 0px; + outline: none; +} + +.left #MSearchClose { + left: 6px; +} + +.right #MSearchClose { + right: 2px; +} + +.MSearchBoxActive #MSearchField { + color: #000000; +} + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #90A5CE; + background-color: #F9FAFC; + z-index: 10001; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial, Verdana, sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: monospace; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: #000000; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: #000000; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: #FFFFFF; + background-color: #3D578C; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + width: 60ex; + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000; + background-color: #EEF1F7; + z-index:10000; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; + padding-bottom: 15px; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +body.SRPage { + margin: 5px 2px; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +span.SRScope { + padding-left: 4px; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; +} + +.SRResult { + display: none; +} + +DIV.searchresults { + margin-left: 10px; + margin-right: 10px; +} + +/*---------------- External search page results */ + +.searchresult { + background-color: #F0F3F8; +} + +.pages b { + color: white; + padding: 5px 5px 3px 5px; + background-image: url("../tab_a.png"); + background-repeat: repeat-x; + text-shadow: 0 1px 1px #000000; +} + +.pages { + line-height: 17px; + margin-left: 4px; + text-decoration: none; +} + +.hl { + font-weight: bold; +} + +#searchresults { + margin-bottom: 20px; +} + +.searchpages { + margin-top: 10px; +} + diff --git a/docs/search/search.js b/docs/search/search.js new file mode 100644 index 0000000..dedce3b --- /dev/null +++ b/docs/search/search.js @@ -0,0 +1,791 @@ +function convertToId(search) +{ + var result = ''; + for (i=0;i<search.length;i++) + { + var c = search.charAt(i); + var cn = c.charCodeAt(0); + if (c.match(/[a-z0-9\u0080-\uFFFF]/)) + { + result+=c; + } + else if (cn<16) + { + result+="_0"+cn.toString(16); + } + else + { + result+="_"+cn.toString(16); + } + } + return result; +} + +function getXPos(item) +{ + var x = 0; + if (item.offsetWidth) + { + while (item && item!=document.body) + { + x += item.offsetLeft; + item = item.offsetParent; + } + } + return x; +} + +function getYPos(item) +{ + var y = 0; + if (item.offsetWidth) + { + while (item && item!=document.body) + { + y += item.offsetTop; + item = item.offsetParent; + } + } + return y; +} + +/* A class handling everything associated with the search panel. + + Parameters: + name - The name of the global variable that will be + storing this instance. Is needed to be able to set timeouts. + resultPath - path to use for external files +*/ +function SearchBox(name, resultsPath, inFrame, label) +{ + if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); } + + // ---------- Instance variables + this.name = name; + this.resultsPath = resultsPath; + this.keyTimeout = 0; + this.keyTimeoutLength = 500; + this.closeSelectionTimeout = 300; + this.lastSearchValue = ""; + this.lastResultsPage = ""; + this.hideTimeout = 0; + this.searchIndex = 0; + this.searchActive = false; + this.insideFrame = inFrame; + this.searchLabel = label; + + // ----------- DOM Elements + + this.DOMSearchField = function() + { return document.getElementById("MSearchField"); } + + this.DOMSearchSelect = function() + { return document.getElementById("MSearchSelect"); } + + this.DOMSearchSelectWindow = function() + { return document.getElementById("MSearchSelectWindow"); } + + this.DOMPopupSearchResults = function() + { return document.getElementById("MSearchResults"); } + + this.DOMPopupSearchResultsWindow = function() + { return document.getElementById("MSearchResultsWindow"); } + + this.DOMSearchClose = function() + { return document.getElementById("MSearchClose"); } + + this.DOMSearchBox = function() + { return document.getElementById("MSearchBox"); } + + // ------------ Event Handlers + + // Called when focus is added or removed from the search field. + this.OnSearchFieldFocus = function(isActive) + { + this.Activate(isActive); + } + + this.OnSearchSelectShow = function() + { + var searchSelectWindow = this.DOMSearchSelectWindow(); + var searchField = this.DOMSearchSelect(); + + if (this.insideFrame) + { + var left = getXPos(searchField); + var top = getYPos(searchField); + left += searchField.offsetWidth + 6; + top += searchField.offsetHeight; + + // show search selection popup + searchSelectWindow.style.display='block'; + left -= searchSelectWindow.offsetWidth; + searchSelectWindow.style.left = left + 'px'; + searchSelectWindow.style.top = top + 'px'; + } + else + { + var left = getXPos(searchField); + var top = getYPos(searchField); + top += searchField.offsetHeight; + + // show search selection popup + searchSelectWindow.style.display='block'; + searchSelectWindow.style.left = left + 'px'; + searchSelectWindow.style.top = top + 'px'; + } + + // stop selection hide timer + if (this.hideTimeout) + { + clearTimeout(this.hideTimeout); + this.hideTimeout=0; + } + return false; // to avoid "image drag" default event + } + + this.OnSearchSelectHide = function() + { + this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()", + this.closeSelectionTimeout); + } + + // Called when the content of the search field is changed. + this.OnSearchFieldChange = function(evt) + { + if (this.keyTimeout) // kill running timer + { + clearTimeout(this.keyTimeout); + this.keyTimeout = 0; + } + + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 || e.keyCode==13) + { + if (e.shiftKey==1) + { + this.OnSearchSelectShow(); + var win=this.DOMSearchSelectWindow(); + for (i=0;i<win.childNodes.length;i++) + { + var child = win.childNodes[i]; // get span within a + if (child.className=='SelectItem') + { + child.focus(); + return; + } + } + return; + } + else if (window.frames.MSearchResults.searchResults) + { + var elem = window.frames.MSearchResults.searchResults.NavNext(0); + if (elem) elem.focus(); + } + } + else if (e.keyCode==27) // Escape out of the search field + { + this.DOMSearchField().blur(); + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.lastSearchValue = ''; + this.Activate(false); + return; + } + + // strip whitespaces + var searchValue = this.DOMSearchField().value.replace(/ +/g, ""); + + if (searchValue != this.lastSearchValue) // search value has changed + { + if (searchValue != "") // non-empty search + { + // set timer for search update + this.keyTimeout = setTimeout(this.name + '.Search()', + this.keyTimeoutLength); + } + else // empty search field + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.lastSearchValue = ''; + } + } + } + + this.SelectItemCount = function(id) + { + var count=0; + var win=this.DOMSearchSelectWindow(); + for (i=0;i<win.childNodes.length;i++) + { + var child = win.childNodes[i]; // get span within a + if (child.className=='SelectItem') + { + count++; + } + } + return count; + } + + this.SelectItemSet = function(id) + { + var i,j=0; + var win=this.DOMSearchSelectWindow(); + for (i=0;i<win.childNodes.length;i++) + { + var child = win.childNodes[i]; // get span within a + if (child.className=='SelectItem') + { + var node = child.firstChild; + if (j==id) + { + node.innerHTML='•'; + } + else + { + node.innerHTML=' '; + } + j++; + } + } + } + + // Called when an search filter selection is made. + // set item with index id as the active item + this.OnSelectItem = function(id) + { + this.searchIndex = id; + this.SelectItemSet(id); + var searchValue = this.DOMSearchField().value.replace(/ +/g, ""); + if (searchValue!="" && this.searchActive) // something was found -> do a search + { + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down + { + this.searchIndex++; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==38 && this.searchIndex>0) // Up + { + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==13 || e.keyCode==27) + { + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() + { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + var code = searchValue.toLowerCase().charCodeAt(0); + var idxChar = searchValue.substr(0, 1).toLowerCase(); + if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair + { + idxChar = searchValue.substr(0, 2); + } + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); + if (idx!=-1) + { + var hexCode=idx.toString(16); + resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else // nothing available for this search term + { + resultsPage = this.resultsPath + '/nomatches.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + } + + window.frames.MSearchResults.location = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) + { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) + { + this.DOMSearchBox().className = 'MSearchBoxActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == this.searchLabel) // clear "Search" term upon entry + { + searchField.value = ''; + this.searchActive = true; + } + } + else if (!isActive) // directly remove the panel + { + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.DOMSearchField().value = this.searchLabel; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults(name) +{ + // The number of matches from the last run of <Search()>. + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) + { + var parentElement = document.getElementById(id); + var element = parentElement.firstChild; + + while (element && element!=parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'SRChildren') + { + return element; + } + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { + element = element.firstChild; + } + else if (element.nextSibling) + { + element = element.nextSibling; + } + else + { + do + { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) + { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) + { + var element = this.FindChildElement(id); + if (element) + { + if (element.style.display == 'block') + { + element.style.display = 'none'; + } + else + { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) + { + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) + { + if (e.type == "keydown") + { + this.repeatOn = false; + this.lastKey = e.keyCode; + } + else if (e.type == "keypress") + { + if (!this.repeatOn) + { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } + else if (e.type == "keyup") + { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + var newIndex = itemIndex-1; + var focusItem = this.NavPrev(newIndex); + if (focusItem) + { + var child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') // children visible + { + var n=0; + var tmpElem; + while (1) // search for last child + { + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) + { + focusItem = tmpElem; + } + else // found it! + { + break; + } + n++; + } + } + } + if (focusItem) + { + focusItem.focus(); + } + else // return focus to search field + { + parent.document.getElementById("MSearchField").focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = itemIndex+1; + var focusItem; + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') // children visible + { + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } + else if (this.lastKey==39) // Right + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } + else if (this.lastKey==37) // Left + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + if (childIndex>0) + { + var newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } + else // already at first child, jump to parent + { + document.getElementById('Item'+itemIndex).focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = childIndex+1; + var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) // last child, jump to parent next parent + { + elem = this.NavNext(itemIndex+1); + } + if (elem) + { + elem.focus(); + } + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } +} + +function setKeyActions(elem,action) +{ + elem.setAttribute('onkeydown',action); + elem.setAttribute('onkeypress',action); + elem.setAttribute('onkeyup',action); +} + +function setClassAttr(elem,attr) +{ + elem.setAttribute('class',attr); + elem.setAttribute('className',attr); +} + +function createResults() +{ + var results = document.getElementById("SRResults"); + for (var e=0; e<searchData.length; e++) + { + var id = searchData[e][0]; + var srResult = document.createElement('div'); + srResult.setAttribute('id','SR_'+id); + setClassAttr(srResult,'SRResult'); + var srEntry = document.createElement('div'); + setClassAttr(srEntry,'SREntry'); + var srLink = document.createElement('a'); + srLink.setAttribute('id','Item'+e); + setKeyActions(srLink,'return searchResults.Nav(event,'+e+')'); + setClassAttr(srLink,'SRSymbol'); + srLink.innerHTML = searchData[e][1][0]; + srEntry.appendChild(srLink); + if (searchData[e][1].length==2) // single result + { + srLink.setAttribute('href',searchData[e][1][1][0]); + if (searchData[e][1][1][1]) + { + srLink.setAttribute('target','_parent'); + } + var srScope = document.createElement('span'); + setClassAttr(srScope,'SRScope'); + srScope.innerHTML = searchData[e][1][1][2]; + srEntry.appendChild(srScope); + } + else // multiple results + { + srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")'); + var srChildren = document.createElement('div'); + setClassAttr(srChildren,'SRChildren'); + for (var c=0; c<searchData[e][1].length-1; c++) + { + var srChild = document.createElement('a'); + srChild.setAttribute('id','Item'+e+'_c'+c); + setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')'); + setClassAttr(srChild,'SRScope'); + srChild.setAttribute('href',searchData[e][1][c+1][0]); + if (searchData[e][1][c+1][1]) + { + srChild.setAttribute('target','_parent'); + } + srChild.innerHTML = searchData[e][1][c+1][2]; + srChildren.appendChild(srChild); + } + srEntry.appendChild(srChildren); + } + srResult.appendChild(srEntry); + results.appendChild(srResult); + } +} + +function init_search() +{ + var results = document.getElementById("MSearchSelectWindow"); + for (var key in indexSectionLabels) + { + var link = document.createElement('a'); + link.setAttribute('class','SelectItem'); + link.setAttribute('onclick','searchBox.OnSelectItem('+key+')'); + link.href='javascript:void(0)'; + link.innerHTML='<span class="SelectionMark"> </span>'+indexSectionLabels[key]; + results.appendChild(link); + } + searchBox.OnSelectItem(0); +} + diff --git a/docs/search/search_l.png b/docs/search/search_l.png Binary files differnew file mode 100644 index 0000000..c872f4d --- /dev/null +++ b/docs/search/search_l.png diff --git a/docs/search/search_m.png b/docs/search/search_m.png Binary files differnew file mode 100644 index 0000000..b429a16 --- /dev/null +++ b/docs/search/search_m.png diff --git a/docs/search/search_r.png b/docs/search/search_r.png Binary files differnew file mode 100644 index 0000000..97ee8b4 --- /dev/null +++ b/docs/search/search_r.png diff --git a/docs/search/searchdata.js b/docs/search/searchdata.js new file mode 100644 index 0000000..f138f14 --- /dev/null +++ b/docs/search/searchdata.js @@ -0,0 +1,36 @@ +var indexSectionsWithContent = +{ + 0: "cptuw", + 1: "p", + 2: "p", + 3: "p", + 4: "cpu", + 5: "p", + 6: "p", + 7: "tw" +}; + +var indexSectionNames = +{ + 0: "all", + 1: "classes", + 2: "files", + 3: "functions", + 4: "variables", + 5: "typedefs", + 6: "defines", + 7: "pages" +}; + +var indexSectionLabels = +{ + 0: "All", + 1: "Classes", + 2: "Files", + 3: "Functions", + 4: "Variables", + 5: "Typedefs", + 6: "Macros", + 7: "Pages" +}; + diff --git a/docs/search/typedefs_0.html b/docs/search/typedefs_0.html new file mode 100644 index 0000000..05722e1 --- /dev/null +++ b/docs/search/typedefs_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="typedefs_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/typedefs_0.js b/docs/search/typedefs_0.js new file mode 100644 index 0000000..2ec58a4 --- /dev/null +++ b/docs/search/typedefs_0.js @@ -0,0 +1,12 @@ +var searchData= +[ + ['prom_5fcollect_5ffn',['prom_collect_fn',['../prom__collector_8h.html#af87330edd48cdb8e1074517e734b1e40',1,'prom_collector.h']]], + ['prom_5fcollector_5fregistry_5ft',['prom_collector_registry_t',['../prom__collector__registry_8h.html#a20f07748401fbbde9efc8a718f9bc202',1,'prom_collector_registry.h']]], + ['prom_5fcollector_5ft',['prom_collector_t',['../prom__collector_8h.html#a28cf36f114f69a96508c044c44716f9c',1,'prom_collector.h']]], + ['prom_5fcounter_5ft',['prom_counter_t',['../prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606',1,'prom_counter.h']]], + ['prom_5fgauge_5ft',['prom_gauge_t',['../prom__gauge_8h.html#a09417d7e7bab055a48f8e13181d136a5',1,'prom_gauge.h']]], + ['prom_5fhistogram_5ft',['prom_histogram_t',['../prom__histogram_8h.html#a8c061924368d41c161025bf3d3cde9ae',1,'prom_histogram.h']]], + ['prom_5fmetric_5fsample_5fhistogram_5ft',['prom_metric_sample_histogram_t',['../prom__metric__sample__histogram_8h.html#aed3455bc4eec61a3d8f01e6c1af84f9f',1,'prom_metric_sample_histogram.h']]], + ['prom_5fmetric_5fsample_5ft',['prom_metric_sample_t',['../prom__metric__sample_8h.html#a0fb9ff851bf9ee126756ae826a2ce72a',1,'prom_metric_sample.h']]], + ['prom_5fmetric_5ft',['prom_metric_t',['../prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889',1,'prom_metric.h']]] +]; diff --git a/docs/search/variables_0.html b/docs/search/variables_0.html new file mode 100644 index 0000000..74ce807 --- /dev/null +++ b/docs/search/variables_0.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="variables_0.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/variables_0.js b/docs/search/variables_0.js new file mode 100644 index 0000000..bbd3bf0 --- /dev/null +++ b/docs/search/variables_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['count',['count',['../structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621',1,'prom_histogram_buckets']]] +]; diff --git a/docs/search/variables_1.html b/docs/search/variables_1.html new file mode 100644 index 0000000..84237b6 --- /dev/null +++ b/docs/search/variables_1.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="variables_1.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/variables_1.js b/docs/search/variables_1.js new file mode 100644 index 0000000..ffdcbf3 --- /dev/null +++ b/docs/search/variables_1.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['prom_5fcollector_5fregistry_5fdefault',['PROM_COLLECTOR_REGISTRY_DEFAULT',['../prom__collector__registry_8h.html#a6092b48e150390c1927da5fe8914981b',1,'prom_collector_registry.h']]], + ['prom_5fhistogram_5fdefault_5fbuckets',['prom_histogram_default_buckets',['../prom__histogram__buckets_8h.html#aa8d61c1abc355eb54173b27cb1b50a5d',1,'prom_histogram_buckets.h']]] +]; diff --git a/docs/search/variables_2.html b/docs/search/variables_2.html new file mode 100644 index 0000000..5c9de1a --- /dev/null +++ b/docs/search/variables_2.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="variables_2.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"><!-- +createResults(); +--></script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"><!-- +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +--></script> +</div> +</body> +</html> diff --git a/docs/search/variables_2.js b/docs/search/variables_2.js new file mode 100644 index 0000000..f8121ac --- /dev/null +++ b/docs/search/variables_2.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['upper_5fbounds',['upper_bounds',['../structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344',1,'prom_histogram_buckets']]] +]; diff --git a/docs/splitbar.png b/docs/splitbar.png Binary files differnew file mode 100644 index 0000000..fe895f2 --- /dev/null +++ b/docs/splitbar.png diff --git a/docs/structprom__histogram__buckets-members.html b/docs/structprom__histogram__buckets-members.html new file mode 100644 index 0000000..f8319b7 --- /dev/null +++ b/docs/structprom__histogram__buckets-members.html @@ -0,0 +1,80 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Member List</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">prom_histogram_buckets Member List</div> </div> +</div><!--header--> +<div class="contents"> + +<p>This is the complete list of members for <a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets</a>, including all inherited members.</p> +<table class="directory"> + <tr class="even"><td class="entry"><a class="el" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">count</a></td><td class="entry"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets</a></td><td class="entry"></td></tr> + <tr><td class="entry"><a class="el" href="structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344">upper_bounds</a></td><td class="entry"><a class="el" href="structprom__histogram__buckets.html">prom_histogram_buckets</a></td><td class="entry"></td></tr> +</table></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/structprom__histogram__buckets.html b/docs/structprom__histogram__buckets.html new file mode 100644 index 0000000..68457d9 --- /dev/null +++ b/docs/structprom__histogram__buckets.html @@ -0,0 +1,93 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: prom_histogram_buckets Struct Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +</div><!-- top --> +<div class="header"> + <div class="summary"> +<a href="#pub-attribs">Public Attributes</a> | +<a href="structprom__histogram__buckets-members.html">List of all members</a> </div> + <div class="headertitle"> +<div class="title">prom_histogram_buckets Struct Reference</div> </div> +</div><!--header--> +<div class="contents"> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a> +Public Attributes</h2></td></tr> +<tr class="memitem:a9da20001e02d992cee82a09372061621"><td class="memItemLeft" align="right" valign="top"><a id="a9da20001e02d992cee82a09372061621"></a> +int </td><td class="memItemRight" valign="bottom"><a class="el" href="structprom__histogram__buckets.html#a9da20001e02d992cee82a09372061621">count</a></td></tr> +<tr class="memdesc:a9da20001e02d992cee82a09372061621"><td class="mdescLeft"> </td><td class="mdescRight">Number of buckets. <br /></td></tr> +<tr class="separator:a9da20001e02d992cee82a09372061621"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a8abda07c4930e15a3dff8a86e3164344"><td class="memItemLeft" align="right" valign="top"><a id="a8abda07c4930e15a3dff8a86e3164344"></a> +const double * </td><td class="memItemRight" valign="bottom"><a class="el" href="structprom__histogram__buckets.html#a8abda07c4930e15a3dff8a86e3164344">upper_bounds</a></td></tr> +<tr class="memdesc:a8abda07c4930e15a3dff8a86e3164344"><td class="mdescLeft"> </td><td class="mdescRight">The bucket values. <br /></td></tr> +<tr class="separator:a8abda07c4930e15a3dff8a86e3164344"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<hr/>The documentation for this struct was generated from the following file:<ul> +<li>prom/include/<a class="el" href="prom__histogram__buckets_8h_source.html">prom_histogram_buckets.h</a></li> +</ul> +</div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/docs/sync_off.png b/docs/sync_off.png Binary files differnew file mode 100644 index 0000000..3b443fc --- /dev/null +++ b/docs/sync_off.png diff --git a/docs/sync_on.png b/docs/sync_on.png Binary files differnew file mode 100644 index 0000000..e08320f --- /dev/null +++ b/docs/sync_on.png diff --git a/docs/tab_a.png b/docs/tab_a.png Binary files differnew file mode 100644 index 0000000..3b725c4 --- /dev/null +++ b/docs/tab_a.png diff --git a/docs/tab_b.png b/docs/tab_b.png Binary files differnew file mode 100644 index 0000000..e2b4a86 --- /dev/null +++ b/docs/tab_b.png diff --git a/docs/tab_h.png b/docs/tab_h.png Binary files differnew file mode 100644 index 0000000..fd5cb70 --- /dev/null +++ b/docs/tab_h.png diff --git a/docs/tab_s.png b/docs/tab_s.png Binary files differnew file mode 100644 index 0000000..ab478c9 --- /dev/null +++ b/docs/tab_s.png diff --git a/docs/tabs.css b/docs/tabs.css new file mode 100644 index 0000000..bbde11e --- /dev/null +++ b/docs/tabs.css @@ -0,0 +1 @@ +.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:transparent}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0px/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0px 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0px 1px 1px rgba(255,255,255,0.9);color:#283A5D;outline:none}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox a.current{color:#D23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media (min-width: 768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283A5D transparent transparent transparent;background:transparent;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0px 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;border-radius:0 !important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox a:hover span.sub-arrow{border-color:#fff transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;border-radius:5px !important;box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0 !important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #fff}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #D23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#D23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} diff --git a/docs/todo.html b/docs/todo.html new file mode 100644 index 0000000..917a54e --- /dev/null +++ b/docs/todo.html @@ -0,0 +1,79 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>prometheus-client-c: Todo List</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">prometheus-client-c +  <span id="projectnumber">0.1.1</span> + </div> + <div id="projectbrief">Prometheus client for the C programming language</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">Todo List </div> </div> +</div><!--header--> +<div class="contents"> +<div class="textblock"><dl class="reflist"> +<dt><a class="anchor" id="_todo000001"></a>page <a class="el" href="index.html">Welcome to the documentation site for prometheus-client-c!</a> </dt> +<dd>Describe how to use libpromhttp to expose metrics over HTTP</dd> +</dl> +</div></div><!-- contents --> +<!-- start footer part --> +<hr class="footer"/><address class="footer"><small> +Generated by  <a href="http://www.doxygen.org/index.html"> +<img class="footer" src="doxygen.png" alt="doxygen"/> +</a> 1.8.13 +</small></address> +</body> +</html> diff --git a/etc/gha-helper.sh b/etc/gha-helper.sh deleted file mode 100755 index b824364..0000000 --- a/etc/gha-helper.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/ksh93 - -typeset -r VERSION='1.0' - -LIC='[-?'"${VERSION}"' ] -[-copyright?Copyright (c) 2023 Jens Elkner. All rights reserved.] -[-license?CDDL 1.0]' -SDIR=${.sh.file%/*} -typeset -r FPROG=${.sh.file} -typeset -r PROG=${FPROG##*/} - -# source in boiler plate code -for H in log.kshlib man.kshlib ; do - X=${SDIR}/$H - [[ -r $X ]] && . $X && continue - X=${ whence $H; } - [[ -z $X ]] && print -u2 "$H not found - exiting." && exit 1 - . $X -done -unset H - -Man.addFunc showUsage '' '[+NAME?showUsage - show usage information. Without any arg the short usage info for MAIN gets shown, for the named function in arg1 otherwise (if available). \bMAIN\b is the placeholder for the script itself.]' -function showUsage { - typeset WHAT="$1" X='--man' - [[ -z ${WHAT} ]] && WHAT='MAIN' && X='-?' - getopts -a "${PROG}" "${ print ${Man.FUNC[${WHAT}]}; }" OPT $X -} - -Man.addFunc doMain '' '[+NAME?doMain - the main application loop alias script entry point.]' -function doMain { - typeset X ARGS=( "$@" ) - integer C=0 - - for X in ${CMD} ; do - [[ -z $X || $X == 'doMain' ]] && continue - $X "${ARGS[@]}" || return $? - (( C++ )) - done - (( C )) || showUsage -} - -Man.addFunc showEnv '' '[+NAME?showEnv - show the current environment.] -[+DESCRIPTION?Shows the main parameters of the working environment. If an argument gets passed, all environment variables currently set will be shown, otherwise all beginning with \bGITHUB_\b and some specials, only.] -\n\n[\aarg\a]' -function showEnv { - Log.printMarker - if [[ -n $1 ]]; then - set - else - # GITHUB_{PATH,ENV,SHA,RUN_ID} sind bei jedem run anders (leere files) - set | egrep '^(GITHUB|RUNNER)_' - print "GHAH=${GHAH}" - set | egrep -v '^((GITHUB|RUNNER)_|GHAH=)' - fi - Log.printMarker - typeset T=${ nproc; } M=${ grep '^model name' /proc/cpuinfo | head -1; } - print "${M// :/: ${T}x }" - egrep '^(Mem|Swap)' /proc/meminfo - Log.printMarker - uname -a - Log.printMarker - networkctl - networkctl status - Log.printMarker -} - -Man.addFunc MAIN '' '[+NAME?'"${PROG}"' - helper script for Hets Github Actions.] -[+DESCRIPTION?This is a little helper script to circumvent problems, code repetitions and other shortcomings of Github Action [design]]. Most functions are Hets repo related and should not be used on other repos unless properly adjusted.] -[+?All operands to this script get passed to the related functions as is. So take care if you call several functions at once.] -[h:help?Print this help and exit.] -[F:functions?Print out a list of all defined functions. Just invokes the \btypeset +f\b builtin.] -[H:usage]:[function?Show the usage information for the given function if available and exit. Functions with no such info or starting with an underline are internal and should not be invoked using the \b-c ...\b option. See also option \b-F\b.] -[T:trace]:[fname_list?A comma or whitspace separated list of function names, which should be traced during execution. Use \bALL\b for all available function.] -[+?] -[c:cmd]:[fname_list?Execute the functions in the given list of comma separated function names \afname_list\a. Functions get called one after another. The EXIT code is the one of the last executed function. If a function exits with != 0, all remaining functions in the list get skipped.] -' -X="${ print ${Man.FUNC[MAIN]} ; }" -unset CMD; typeset CMD -while getopts "${X}" option ; do - case "${option}" in - h) showUsage MAIN ; exit 0 ;; - F) typeset +f ; exit 0 ;; - H) if [[ ${OPTARG%_t} != ${OPTARG} ]]; then - ${OPTARG} --man # self-defined types - else - showUsage "${OPTARG}" # function - fi - exit 0 - ;; - T) if [[ ${OPTARG} == 'ALL' ]]; then - typeset -ft ${ typeset +f ; } - else - typeset -ft ${OPTARG//,/ } - fi - ;; - c) CMD+=( ${OPTARG//,/ } ) ;; - *) showUsage ;; - esac -done -X=$((OPTIND-1)) -shift $X - -doMain "$@" -# vim: ts=4 sw=4 filetype=sh diff --git a/etc/log.kshlib b/etc/log.kshlib deleted file mode 100755 index 8d15798..0000000 --- a/etc/log.kshlib +++ /dev/null @@ -1,28 +0,0 @@ -# to be able to distinguish this scripts messages from other output -typeset -T LogObj_t=( - typeset -Sh 'Color for info messages' GREEN='38;5;232;48;5;118' #'1;30;102'; - typeset -Sh 'Color for warning messages' BLUE='38;5;21;48;5;118' #'1;34;102'; - typeset -Sh 'Color for fatal messages' RED='38;5;9;48;5;118' #'1;31;102'; - function log { - print -u2 "\E[1;$2m${ date +%T; } $1:\E[0m $3" - } - typeset -Sfh ' log a message to stderr' log - function info { - _.log "INFO" ${_.GREEN} "$*" - } - typeset -Sfh ' log a info message to stderr' info - function warn { - _.log "WARN" ${_.BLUE} "$*" - } - typeset -Sfh ' log a warning message to stderr' warn - function fatal { - _.log "FATAL" ${_.RED} "$*" - } - typeset -Sfh ' log a fatal error message to stderr' fatal - function printMarker { - typeset COLOR="$1" - print -f '\E[1;%sm----------------------------------------------------------------------------\E[0m\n' "${COLOR:-${_.GREEN}}" - } - typeset -Sfh ' print a marker line to stdout' printMarker -) -LogObj_t Log diff --git a/etc/man.kshlib b/etc/man.kshlib deleted file mode 100755 index e0388a8..0000000 --- a/etc/man.kshlib +++ /dev/null @@ -1,113 +0,0 @@ -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License") -# (see http://www.opensource.org/licenses/CDDL-1.0). -# -# Copyright (c) 2012 Jens Elkner. All rights reserved. -# Use is subject to license terms. - -# default implementation info -[[ -z ${LIC} ]] && LIC='[-?$Id $] -[-copyright?Copyright (c) 2011, 2012 Jens Elkner. All rights reserved.] -[-license?CDDL 1.0]' - -typeset -T ManObj_t=( - typeset -Ah 'Variable descriptions. Key: variable name' VAR - typeset -Ah 'Function usages. Key: function name' FUNC - function addVar { - [[ -n ${_.VAR[$1]} ]] && Log.warn "Overwriting previous description for $1" - _.VAR[$1]="[+$1?$2]" - } - typeset -fh 'Add a description (arg2) for the given variable name (arg1)' addVar - function addFunc { - typeset fname=$1 - typeset X="${2}" - [[ -n ${_.FUNC[${fname}]} ]] && Log.warn "Overwriting previous usage info for $1()" - [[ -z ${X} ]] && X="${LIC}\n" - shift 2 - while [[ -n ${1} ]]; do - X+="${1}" - shift - done - _.FUNC[${fname}]+="${X}" - } - typeset -fh $'Add usage info (arg3 ...) for the given function name (arg1). If implementation details (arg2) is empty, the value of \a$LIC\a gets used instead' addFunc - function varUsage { - typeset X="" - [[ "$1" = '@' || "$1" == '*' ]] && set -- ${!_.VAR[@]} - while [[ -n $1 ]]; do - X+="${_.VAR[$1]}" - shift - done - print "${X}" - } - typeset -fh $'Get the variable usage info for the named variables (arg2 ...) if available as a concatenated string. See \baddVar()\b' varUsage - function funcUsage { - printf "${_.FUNC[$1]}" - } - typeset -fh 'Get the function usage info for the named function (arg1)' funcUsage - function printVarComment { - (( $1 == 0 )) && return 1 - typeset X="${_.VAR[$2]}" OPT - [[ -z $X ]] && return 1 - # we use getopts here because we are lazy and do not wanna deal with - # line/word breaking - typeset OPT - X="${ getopts -a NONE "${ print $X; }" OPT --man 2>&1 ; }" - X=${X#*$2} # remove first line - X=${X%SYNOPSIS*} # remove SYNOPSIS and stuff that follows - X=${X//\\[abvf]} # remove special formatting chars - X=${X//$'\n ' /$'\n# '} # replace EOL with a LF+# - X=${X%%*($'\n')} # remove trailing LFs - print "\n# Variable $2:\n${X##*($'\n')}" # + remove too many leading LF - return 0 - } - typeset -fh 'Print the description of the given variable (arg2) if available and arg1 != 0. Sets exit status 1 if nothing was printed, 0 otherwise' printVarComment - - function printTypeFieldComments { - # similar to printVarComment - (( $1 == 0 )) && return 1 - X="${ $2 --man 2>&1 ; }" - X=${X#*DETAILS} # remove bloat above - X=${X%+([ \t\n])$2 defines *} # remove bloat below - X=${X//\\[abvf]} # remove special formatting chars - X=${X//*( )_*( )string.$'\n'} # remove _ field - X=${X%%*($'\n'| )} # remove trailing LFs - X=${X//$'\n ' /$'\n# '} # replace EOL with a LF+# - print "#\n${X##*($'\n')}" # remove leading LFs and prefix #+LF - } - typeset -fh 'Extract field descriptions for the given object type (arg2) if available and arg1 != 0. Sets exit status 1 if nothing was printed, 0 otherwise' printTypeFieldComments - - function printFuncComment { - typeset OPT X - # similar to printVarComment - (( $1 == 0 )) && return 1 - X=${_.FUNC[$2]} - [[ -z $X ]] && return 1 - X="${ getopts -a $2 "${ print $X; }" OPT --man 2>&1 ; }" - X=${X/#*$'SYNOPSIS\n '/\# Function: } # remove bloat above - X=${X%%+([[:space:]])@(ENVIRONMENT|SEE)*} # remove bloat below - X=${X//\\[abvf]} # remove special formatting chars - X=${X/\[ options ]} - X=${X/+([[:space:]])DESCRIPTION+([[:space:]])/$'\n# '} - X=${X//$'\n ' /$'\n# '} # replace EOL with a LF+# - print "${X//$'\n\n'/$'\n#\n'}" - } - typeset -fh 'Extract function description for the given function (arg2) if available and arg1 != 0. Sets exit status 1 if nothing was printed, 0 otherwise' printFuncComment - - function listVars { - typeset ALL="${ print ${!_.VAR[*]} | tr ' ' '\n' | sort -u; }" VNAME - for VNAME in $ALL; do - [[ $VNAME == OLDENV || $VNAME == LASTENV ]] && continue - X=${ typeset -p $VNAME; } - (( VERBOSE )) && print "$X" || print "${VNAME}=${X#*=}" - done - unset -n X - } - typeset -fh 'List all registered environment variables and its current value, except for OLDENV and LASTENV. If VERBOSE!=0 all the full typeset command gets listed.' listVars -) -ManObj_t Man - -Man.addVar OSNAME 'The name of the OS in the global zone (uname -s).' -[[ -z ${OSNAME} ]] && OSNAME=${ uname -s ; } || true - -# vim:ts=4 filetype=sh diff --git a/example/Makefile b/example/Makefile index df6e7e4..55778df 100644 --- a/example/Makefile +++ b/example/Makefile @@ -1,19 +1,39 @@ .PHONY: clean -GCC ?= gcc -CFLAGS ?= -g -Wall -I../prom/include -I../promhttp/include -DPROM_LOG_ENABLE \ - -I /usr/include/microhttpd -I /opt/local/include -# You should "export LD_LIBRARY_PATH=../prom/build:../promhttp/build" -LDFLAGS ?= -L../prom/build -L../promhttp/build -L/opt/local/lib +VERSION = $(shell cat ../VERSION) + +GCC = /usr/bin/gcc +FLAGS = -g -Wall DEPS = foo.h bar.h OBJ = foo.o bar.o main.o +LIBS = /usr/lib/libprom.so /usr/lib/libpromhttp.so + +PROM_DEB_PACKAGE = ../prom/libprom-dev-${VERSION}-Linux.deb +PROM_TGZ_PACKAGE = ../prom/libprom-dev-${VERSION}-Linux.tar.gz + +PROMHTTP_DEB_PACKAGE = ../promhttp/libpromhttp-dev-${VERSION}-Linux.deb +PROMHTTP_TGZ_PACKAGE = ../promhttp/libpromhttp-dev-${VERSION}-Linux.tar.gz example: ${OBJ} ${LIBS} - gcc -g -o $@ ${CFLAGS} -O1 -pthread ${OBJ} $(LDFLAGS) -lprom -lpromhttp + gcc -g -o $@ ${FLAGS} -O1 -pthread ${OBJ} -lprom -lpromhttp -lmicrohttpd + +${PROM_DEB_PACKAGE}: + cd .. && ./auto build && ./auto package + +${PROMHTTP_DEB_PACKAGE}: + cd .. && ./auto build && ./auto package + +/usr/lib/libprom.so: ${PROM_DEB_PACKAGE} + dpkg -i ${PROM_DEB_PACKAGE} + +/usr/lib/libpromhttp.so: ${PROMHTTP_DEB_PACKAGE} + dpkg -i ${PROMHTTP_DEB_PACKAGE} -%.o: %.c ${DEPS} - ${GCC} ${CFLAGS} -c $< -o $@ +%.o: %.c ${PROM_DEB_PACKAGE} ${PROMHTTP_DEB_PACKAGE} ${LIBS} ${DEPS} + ${GCC} ${FLAGS} -c $< -o $@ clean: - -rm -f ${OBJ} example + -rm ${OBJ} example ${PROM_DEB_PACKAGE} ${PROM_TGZ_PACKAGE} ${PROMHTTP_DEB_PACKAGE} ${PROMHTTP_TGZ_PACKAGE} + -dpkg -r libprom-dev + -dpkg -r libpromhttp-dev diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..1936c99 --- /dev/null +++ b/example/README.md @@ -0,0 +1,10 @@ +# Example + +To run this example: + +* Execute `./auto dev` from the root of the project directory to enter the development environment +* Execute `cd example` +* Execute `make` +* This process will build a binary called example in the current working directory. Execute `./example` to execute the + example. +* In another shell, execute `curl http://0.0.0.0:8000/metrics`
\ No newline at end of file diff --git a/example/bar.c b/example/bar.c index ee63732..2dd2393 100644 --- a/example/bar.c +++ b/example/bar.c @@ -1,6 +1,5 @@ /** * Copyright 2019 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,17 +19,14 @@ prom_counter_t *bar_counter; prom_gauge_t *bar_gauge; -int -bar(int v, const char *label) { - if (prom_counter_inc(bar_counter, NULL)) - return 1; - return prom_gauge_add(bar_gauge, v, (const char *[]) { label }); +int bar(int v, const char *label) { + int r = 0; + r = prom_counter_inc(bar_counter, NULL); + if (r) return r; + return prom_gauge_add(bar_gauge, v, (const char *[]) { label }); } -void -bar_init(void) { - bar_counter = pcr_must_register_metric(prom_counter_new("bar_counter", - "counter for bar", 0, NULL)); - bar_gauge = pcr_must_register_metric(prom_gauge_new("bar_gauge", - "gauge for bar", 1, (const char *[]) { "label" })); -} +void bar_init(void) { + bar_counter = prom_collector_registry_must_register_metric(prom_counter_new("bar_counter", "counter for bar", 0, NULL)); + bar_gauge = prom_collector_registry_must_register_metric(prom_gauge_new("bar_gauge", "gauge for bar", 1, (const char *[]) { "label" })); +}
\ No newline at end of file diff --git a/example/example b/example/example Binary files differnew file mode 100755 index 0000000..37f8c8e --- /dev/null +++ b/example/example diff --git a/example/foo.c b/example/foo.c index de5fcdf..ca0c759 100644 --- a/example/foo.c +++ b/example/foo.c @@ -1,6 +1,5 @@ /** * Copyright 2019 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,17 +20,14 @@ prom_counter_t *foo_counter; prom_gauge_t *foo_gauge; -int -foo(int v, const char *label) { - if (prom_counter_inc(foo_counter, NULL)) - return 1; - return prom_gauge_add(foo_gauge, v, (const char *[]) { label }); +int foo(int v, const char *label) { + int r = 0; + r = prom_counter_inc(foo_counter, NULL); + if (r) return r; + return prom_gauge_add(foo_gauge, v, (const char *[]) { label }); } -void -foo_init(void) { - foo_counter = pcr_must_register_metric(prom_counter_new("foo_counter", - "counter for foo", 0, NULL)); - foo_gauge = pcr_must_register_metric(prom_gauge_new("foo_gauge", - "gauge for foo", 1, (const char *[]) { "label" })); -} +void foo_init(void) { + foo_counter = prom_collector_registry_must_register_metric(prom_counter_new("foo_counter", "counter for foo", 0, NULL)); + foo_gauge = prom_collector_registry_must_register_metric(prom_gauge_new("foo_gauge", "gauge for foo", 1, (const char *[]) { "label" })); +}
\ No newline at end of file diff --git a/example/foo.h b/example/foo.h index 5b2c152..66d4b54 100644 --- a/example/foo.h +++ b/example/foo.h @@ -16,4 +16,4 @@ int foo(int v, const char *label); -void foo_init(void); +void foo_init(void);
\ No newline at end of file diff --git a/example/main.c b/example/main.c index 8ce61e4..d695d12 100644 --- a/example/main.c +++ b/example/main.c @@ -1,6 +1,5 @@ /** * Copyright 2019 DigitalOcean Inc. - * Copyright 2020 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,130 +21,84 @@ #include "microhttpd.h" #include "prom.h" -#include "prom_histogram.h" #include "promhttp.h" -#include "prom_log.h" -#include "prom_string_builder.h" #include "foo.h" #include "bar.h" prom_histogram_t *test_histogram; -static void -init(void) { - prom_histogram_t *metric; - - // Initialize the Default registry - pcr_default_init(); - - // Register file-based metrics for each file - foo_init(); - bar_init(); - - metric = prom_histogram_new("test_histogram", - "histogram under test", phb_linear(5.0, 5.0, 2), 0, NULL); - test_histogram = pcr_must_register_metric(metric); - - // Set the active registry for the HTTP handler - promhttp_set_active_collector_registry(NULL); +static void init(void) { + // Initialize the Default registry + prom_collector_registry_default_init(); + + // Register file-based metrics for each file + foo_init(); + bar_init(); + + test_histogram = prom_collector_registry_must_register_metric( + prom_histogram_new( + "test_histogram", + "histogram under test", + prom_histogram_buckets_linear(5.0, 5.0, 2), + 0, + NULL + ) + ); + + // Set the active registry for the HTTP handler + promhttp_set_active_collector_registry(NULL); } -#define PORT 8000 - -void -stringbuilder_demo() { - psb_t *sb = psb_new(); // string builder demo - psb_add_str(sb, "Hello world! "); - psb_add_char(sb, '.'); - psb_add_char(sb, '.'); - psb_add_char(sb, '.'); - psb_add_str(sb, "done."); - psb_add_char(sb, '\n'); - char *s = psb_dump(sb); - printf("%s", s); - free(s); - s = NULL; - psb_destroy(sb); - sb = NULL; -} - -int -main(int argc, const char **argv) { - init(); - - const char *labels[] = { "one", "two", "three", "four", "five" }; - - for (int i = 1; i <= 100; i++) { - double hist_value = (i % 2 == 0) ? 3.0 : 7.0; - if (prom_histogram_observe(test_histogram, hist_value, NULL)) - exit(1); - - for (int x = 0; x < 5; x++) { - if (foo(i, labels[x])) - exit(2); - if (bar(i+x, labels[x])) - exit(3); - } - } - - stringbuilder_demo(); - - unsigned int flags; - // Handle each request one after a another using the best event loop style - // (SELECT, POLL, or EPOLL) for the current platform and log any errors - // to stderr. -#ifdef MHD_USE_AUTO - flags = MHD_USE_AUTO; - // EITHER - #ifdef MHD_USE_INTERNAL_POLLING_THREAD - flags |= MHD_USE_INTERNAL_POLLING_THREAD; // EPOLL if avail or POLL - #endif - /* OR - #ifdef MHD_USE_THREAD_PER_CONNECTION - flags |= MHD_USE_THREAD_PER_CONNECTION // implies POLL - #endif - */ -#else // older libmicrohttpd versions - flags = MHD_USE_POLL_INTERNALLY; // internal polling thread - /* OR - flags = MHD_USE_THREAD_PER_CONNECTION // implies POLL - */ -#endif -#ifdef MHD_USE_DEBUG - flags |= MHD_USE_DEBUG; // same as MHD_USE_ERROR_LOG -#endif - - struct MHD_Daemon *daemon = promhttp_start_daemon(flags, PORT, NULL, NULL); - if (daemon == NULL) - return 1; - - int done = 0; - - auto void intHandler(int signal); - void intHandler(int signal) { - PROM_LOG("\nshutting down..."); - pcr_destroy(PROM_COLLECTOR_REGISTRY); - promhttp_stop_daemon(daemon); - done = 1; - } - - if (argc == 2) { - unsigned int timeout = atoi(argv[1]); - sleep(timeout); - intHandler(0); - return 0; - } - - PROM_INFO("RUN 'curl localhost:%d/metrics'\n", PORT); - signal(SIGINT, intHandler); - - // main application goes here - for simplicity it just waits for ^C - while (! done) { - fputc('.', stdout); fflush(stdout); - sleep(1); - } - PROM_LOG("Done."); - - return 0; -} +int main(int argc, const char **argv) { + init(); + int r = 0; + const char *labels[] = { "one", "two", "three", "four", "five" }; + for (int i = 1; i <= 100; i++) { + double hist_value; + if (i % 2 == 0) { + hist_value = 3.0; + } else { + hist_value = 7.0; + } + + r = prom_histogram_observe(test_histogram, hist_value, NULL); + if (r) exit(1); + + for (int x = 0; x < 5; x++) { + r = foo(i, labels[x]); + if (r) exit(r); + r = bar(i+x, labels[x]); + if (r) exit(r); + } + } + + + struct MHD_Daemon *daemon = promhttp_start_daemon(MHD_USE_SELECT_INTERNALLY, 8000, NULL, NULL); + if (daemon == NULL) { + return 1; + } + + int done = 0; + + auto void intHandler(int signal); + void intHandler(int signal) { + printf("\nshutting down...\n"); + fflush(stdout); + prom_collector_registry_destroy(PROM_COLLECTOR_REGISTRY_DEFAULT); + MHD_stop_daemon(daemon); + done = 1; + } + + if (argc == 2) { + unsigned int timeout = atoi(argv[1]); + sleep(timeout); + intHandler(0); + return 0; + } + + signal(SIGINT, intHandler); + while(done == 0) {} + + return 0; +}
\ No newline at end of file diff --git a/prom/CMakeLists.txt b/prom/CMakeLists.txt index 4727fdf..6ed20b6 100644 --- a/prom/CMakeLists.txt +++ b/prom/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9.1) +cmake_minimum_required(VERSION 3.14.5) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) @@ -10,21 +10,21 @@ execute_process( execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f1 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\1/g" OUTPUT_VARIABLE MajorVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f2 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\2/" OUTPUT_VARIABLE MinorVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f3 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\3/" OUTPUT_VARIABLE PatchVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) @@ -46,12 +46,10 @@ set( ${public_dir}/prom_histogram.h ${public_dir}/prom_histogram_buckets.h ${public_dir}/prom_linked_list.h - ${public_dir}/prom_log.h ${public_dir}/prom_map.h ${public_dir}/prom_metric.h ${public_dir}/prom_metric_sample.h ${public_dir}/prom_metric_sample_histogram.h - ${public_dir}/prom_string_builder.h ${public_dir}/prom.h ) @@ -70,7 +68,7 @@ set( ${private_dir}/prom_linked_list.c ${private_dir}/prom_linked_list_i.h ${private_dir}/prom_linked_list_t.h - ${private_dir}/prom_log.c + ${private_dir}/prom_log.h ${private_dir}/prom_map.c ${private_dir}/prom_map_i.h ${private_dir}/prom_map_t.h @@ -86,29 +84,29 @@ set( ${private_dir}/prom_metric_sample_i.h ${private_dir}/prom_metric_sample_t.h ${private_dir}/prom_metric_t.h - ${private_dir}/prom_process_collector_t.h - ${private_dir}/prom_process_collector.c ${private_dir}/prom_process_fds.c ${private_dir}/prom_process_fds_i.h + ${private_dir}/prom_process_fds_t.h ${private_dir}/prom_process_limits.c ${private_dir}/prom_process_limits_i.h + ${private_dir}/prom_process_limits_t.h ${private_dir}/prom_process_stat.c ${private_dir}/prom_process_stat_i.h ${private_dir}/prom_process_stat_t.h + ${private_dir}/prom_procfs_i.h + ${private_dir}/prom_procfs_t.h + ${private_dir}/prom_procfs.c ${private_dir}/prom_string_builder.c + ${private_dir}/prom_string_builder_i.h + ${private_dir}/prom_string_builder_t.h ) include(FindThreads) add_library(prom SHARED) -set_target_properties( - prom PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} -) -target_compile_options(prom PRIVATE "-Werror" "-Wuninitialized" "-Wall" "-Wno-unused-label" "-Wno-pragmas" "-std=gnu11") -target_compile_options(prom PUBLIC "-Werror" "-Wuninitialized" "-Wall" "-Wno-unused-label" "-Wno-pragmas" "-std=gnu11") +target_compile_options(prom PRIVATE "-Werror" "-Wuninitialized" "-Wall" "-Wno-unused-label" "-std=gnu11") +target_compile_options(prom PUBLIC "-Werror" "-Wuninitialized" "-Wall" "-Wno-unused-label" "-std=gnu11") target_include_directories( prom @@ -135,10 +133,10 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${MajorVersion}) set(CPACK_PACKAGE_VERSION_MINOR ${MinorVersion}) set(CPACK_PACKAGE_VERSION_PATCH ${PatchVersion}) set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../README.md) -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C library to manage and expose metrics") -set(CPACK_PACKAGE_HOMEPAGE_URL https://github.com/jelmd/libprom) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A prometheus client library") +set(CPACK_PACKAGE_HOMEPAGE_URL https://github.internal.digitalocean.com/timeseries/prometheus-client-c) include(CPack) include(GNUInstallDirs) -install(TARGETS prom LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libprom) +install(TARGETS prom ARCHIVE) +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/prom/include/prom.h b/prom/include/prom.h index d3bcf0d..bb77736 100644 --- a/prom/include/prom.h +++ b/prom/include/prom.h @@ -1,6 +1,5 @@ /* Copyright 2019 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,62 +17,23 @@ limitations under the License. /** * @file prom.h * @brief Include prom.h to include the entire public API - * @mainpage libprom documentation + * @mainpage Welcome to the documentation site for prometheus-client-c! * @tableofcontents * @section Introduction * - * libprom is a small suite of C libraries which can be used to maintain - * metrics on-the-fly and to expose them automatically in the Prometheus - * exposition format when needed. + * prometheus-client-c is a small suite of Prometheus client libraries targeted for the C programming language. + * In this brief tutorial you will learn how to create and register metrics, update metric samples, and expose metrics + * over HTTP. * - * In this brief tutorial you will learn how to create and register metrics, - * update metric samples, and expose metrics over HTTP. - * - * In the old original version awefully long function and type names were used. - * They got renamed for better readability and more compact code. Now the - * following prefix abbreviation are used instead of: + * @section Creating-and-Registering-Metrics Creating and Registering Metrics * - * * pcr .. prom_collector_registry - * * phb .. prom_histogram_buckets - * * pll .. prom_linked_list - * * pmf .. prom_metric_formatter - * * pms .. prom_metric_sample - * * ppl .. prom_process_limits - * * pps .. prom_process_stat[s] - * * psb .. prom_string_builder - * * ppc .. prom_process_collector (formerly prom_collector_process) + * prometheus-client-c supports the following metric types: * - * @section Creating-and-Registering-Metrics Creating and Registering Metrics + * * [Counter](https://prometheus.io/docs/concepts/metric_types/#counter) + * * [Gauge](https://prometheus.io/docs/concepts/metric_types/#gauge) + * * [Histogram](https://prometheus.io/docs/concepts/metric_types/#histogram) * - * First thing to do is to create the prom collector registry. - * A prom collector registry is basically an associative array of prom - * collectors keyed by their names. It is recommended to use the default - * prom collector registry (it has the name "default"). Use - * \c pcr_init() to set it up. Under the hood it also - * initializes the \c default prom collector, where all your prom metrics alias - * counters, gauges, histograms will be added by default. If \c PROM_PROCESS - * gets - * passed as an argument, a prom collector named \c process gets initialized - * as well, which contains and collects several metrics about the running - * process/thread. A prom collector is basically an associative array of prom - * metrics keyed by their names. - * - * After that, write a metric initialization function, which creates the - * required metrics and registers them with the prom collector of choice. - * Usually one would use the \c pcr_register_metric() function: It will add - * the metrics to the \c default prom collector which is registered with the - * \c default prom collector registry. - * - * If one has created his own, non-default prom collector registry using - * \c pcr_registry_new(), one may use - * \c pcr_registry_get() with the name parameter set to \c default - * to get a reference to its default collector instance, or create a new - * collector using \c pcr_new() and register it with the registry - * via \c pcr_register_collector(). To add metrics to the - * related container, use \c prom_collector_add_metric(). - * - * However, here an easy example, which uses the default prom collector registry - * including the \c "process" collector: + * To get started using one of the metric types, declare the metric at file scope. For example: * * @code{.c} * @@ -81,30 +41,34 @@ limitations under the License. * * prom_counter_t *my_counter; * + * @endcode + * + * Next, create a metric initialization function. You can create the metric and register it with the default metric + * collector registry in one chain of functions. A metric collector is responsible for collecting metrics and returning + * them. A metric collector registry is declared in global scope and contains metric collectors. More on this later... + * + * To create a metric and register it with the default metric collector registry in one shot, you may chain the metric + * constructor into the prom_collector_registry_must_register_metric function. For example: + * + * @code{.c} + * * void foo_metric_init(void) { - * my_counter = prom_counter_new("my_counter", "counts things", 0, NULL); - * if (my_counter != NULL && pcr_register_metric(my_counter)) - * PROM_INFO("metric '%s' registered.", my_counter->name); + * my_counter = prom_collector_registry_must_register_metric(prom_counter_new("my_counter", "counts things", 0, NULL)); * } * - * // prefix all metric names with "myapp_" and report the overall scrape time - * if (pcr_init(PROM_PROCESS|PROM_SCRAPETIME, "myapp_")) { - * foo_metric_init(); - * } * @endcode * - * If you need more metrics, add them as needed. libprom supports metrics with - * the following metric types: - * - * * [Counter](https://prometheus.io/docs/concepts/metric_types/#counter) - * * [Gauge](https://prometheus.io/docs/concepts/metric_types/#gauge) - * * [Histogram](https://prometheus.io/docs/concepts/metric_types/#histogram) - * + * The first argument to prom_counter_new is the counter name. The second argument is the counter description. The third + * argument is the number of metric labels. In this case, we will only have one metric sample for this metric so we pass + * 0 to specify that no labels will be used. The 4th argument is an array of strings storing the metric labels. Since we + * have none, we pass NULL. A call to foo_metric_init within the program's main function will initialize the metrics + * for the file we just created to the default prometheus metric collector registery called + * PROM_COLLECTOR_REGISTRY_DEFAULT * * @section Updating-Metric-Sample-Values Updating Metric Sample Values * - * Now that we have a metric created and registered our metric(s), we can - * update its value as needed. For example: + * Now that we have a metric configured for creation and registration, we can update our metric within any of the + * functions of the file in which it was declared. For example: * * @code{.c} * @@ -114,93 +78,41 @@ limitations under the License. * } * @endcode * - * This function will increment the default metric sample for my_counter. Since - * we are not using metric labels, we pass \c NULL as the second argument. + * This function will increment the default metric sample for my_counter. Since we are not using metric labels, we pass + * NULL as the second argument. * + * @section Program-Initialization Program Initialization * - * @section Metric-Exposition-Over-HTTP Metric Exposition Over HTTP + * At the start of the program's main function you need to do two things: * - * To expose all the metrics of all enabled collectors in a given prom - * collector registry via HTTP, one needs to activate the registry using - * promhttp_set_active_collector_registry() - if the passed registry is \c NULL, - * the default prom collector registry will be used instead. Note: Only one - * registry at a time is active. - * - * After firing up the HTTP handler via \c promhttp_start_daemon(), the - * HTTP handler calls the \c pcr_bridge() on \c /metrics - * request. This in turn instructs the registry's prom metric formatter (pmf) - * to reset its internal stringbuilder, i.e. clear its buffer via - * \c pmf_clear() and populate the response by calling - * \c pmf_load_metrics(). This function calls the - * \c collect_fn() function of each registered collector to get the list of - * metrics to include in the HTTP response. Finally the formatter iterates - * through the returned list of metrics, and appends them in Prometheus - * exposition format to its internal stringbuilder. When all prom collectors of - * the registry have been processed, the contents of the formmatter's - * stringbuilder gets dumped as a single string via - * \c pmf_dump() and append to the HTTP response of the - * request - the http handler takes care of the rest. - * - * So basically do something like this: + * * Initialize the default metric collector registry: * * @code{.c} * - * promhttp_set_active_collector_registry(NULL); + * prom_collector_registry_default_init(); * - * struct MHD_Daemon *daemon = promhttp_start_daemon(MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL); - * if (daemon == NULL) - * return 1; * @endcode * - * @section collect_fn collect_fn() - * As explained above, to dump registered metrics in Prometheus exposition - * format, the formatter calls the \c collect_fn() function of all registered - * prom collectors and is per default the integral part when generating the - * response for a \c /metrics request. So what does it, is expected to do? - * - * For any \c default prom collector \c collect_fn() does nothing but just - * returns the list of registered metrics unless one had set another function - * to call using \c prom_collector_set_collect_fn(). However, the \c process - * prom collector automatically created and registered via - * \c pcr_init(PROM_PROCESS, ...) reads in all process - * related - * data now, updates the values of the relevant metrics and after that it - * returns the list of metrics to include iin the response as well. - * - * So the take-away here is, that collect_fn() may trigger other things like - * metric updates, too. But since it is per default part of the HTTP resonse - * generation, it should be very fast to prevent any timeouts. Depending on - * the [flags](https://www.gnu.org/software/libmicrohttpd/manual/html_node/microhttpd_002dconst.html#microhttpd_002dconst#index-MHD_005fFLAG) - * passed to the \c promhttp_start_daemon() call the http daemon may answers - * any request one after another. - * - * @section faq FAQ - * I do not want to maintain any metric on-the-fly? - * - * So you only want to convert some collected data to Prometheus exposition - * format and export it via HTTP? In this case you do not need libprom but - * just need to have a look at [promhttp.c](https://github.com/jelmd/libprom/blob/main/promhttp/src/promhttp.c). - * Copy-and-paste and change the line, where - * \c pcr_bridge(PROM_ACTIVE_REGISTRY) gets called. Replace - * it with a call to your own function which should return the desired metrics - * as a string. That's it. - * - * But I want to re-use the metrics maintained by the "process" collector. - * - * In this case you can do the same as above and use - * \c pcr_init(PROM_PROCESS, ...) to initialize the default - * prom registry - * \c PROM_COLLECTOR_REGISTRY. When it is time to expose the metrics just - * call \c pcr_bridge(PROM_COLLECTOR_REGISTRY) and append - * the returned string to the output of your own export. + * * For each file containing prometheus metrics, call its corresponding metric initialization function + * + * @code{.c} + * + * foo_metric_init() + * + * @endcode + * + * After initialization is complete, you may proceed to do work and update your metrics. + * + * @section Metric-Exposition-Over-HTTP Metric Exposition Over HTTP * + * @todo Describe how to use libpromhttp to expose metrics over HTTP * * @section Where-To-Go-From-Here Where to Go From Here? * - * Take a look at the [Files](./files.html) + * Take a look at the [Files](https://github.internal.digitalocean.com/pages/timeseries/prometheus-client-c/files.html) * tab in this documentation site for more information about the public API available to you. Also, you can take a look * at the examples directory at the - * [Github repository](https://github.com/jelmd/libprom/tree/main/example) for inspiration. + * [Github repository](https://github.internal.digitalocean.com/timeseries/prometheus-client-c) for inspiration. */ #ifndef PROM_INCLUDED @@ -219,4 +131,4 @@ limitations under the License. #include "prom_metric_sample.h" #include "prom_metric_sample_histogram.h" -#endif // PROM_INCLUDED +#endif // PROM_INCLUDED
\ No newline at end of file diff --git a/prom/include/prom_collector.h b/prom/include/prom_collector.h index 16a5b6f..1475f13 100644 --- a/prom/include/prom_collector.h +++ b/prom/include/prom_collector.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,146 +17,84 @@ limitations under the License. #ifndef PROM_COLLECTOR_H #define PROM_COLLECTOR_H -#include <sys/types.h> #include "prom_map.h" #include "prom_metric.h" /** * @file prom_collector.h - * @brief A \c prom_collector is used to collect metrics. + * @brief A Prometheus collector returns a collection of metrics */ /** - * @brief A prom collector calls collect to prepare metrics and return - * them to the registry to which it is registered. + * @brief A prometheus collector calls collect to prepare metrics and return them to the registry to which it is + * registered. */ typedef struct prom_collector prom_collector_t; /** - * @brief The function used to prepare and return all relevant metrics of the - * given collector ready for Prometheus exposition. + * @brief The function responsible for preparing metric data and returning metrics for a given collector. * - * If you use the default collector registry, this should not concern you. If - * you are using a custom collector, you may set this function on your - * collector to do additional work before returning the contained metrics. + * If you use the default collector registry, this should not concern you. If you are using a custom collector, you may + * set this function on your collector to do additional work before returning the contained metrics. * - * @param self The collector with the relevant metrics. - * @return The metrics to expose. + * @param self The target prom_collector_t* + * @return The prom_map_t* containing the collected metrics */ typedef prom_map_t *prom_collect_fn(prom_collector_t *self); /** - * @brief The function to use to cleanup and free custom data attached via - * prom_collector_data_set(). Per default it gets called by - * \c prom_collector_destroy() right after the prom_collect_fn() has been set - * to \c NULL. The default implementation simply sets the pointer to the data - * to \c NULL, which may cause memory leaks. - */ -typedef void prom_collector_free_data_fn(prom_collector_t *self); - -/** * @brief Create a collector - * @param name name of the collector. - * @note Name MUST NOT be \c default or \c process. - * @return The new collector on success, \c NULL otherwise. + * @param name The name of the collector. The name MUST NOT be default or process. + * @return The constructed prom_collector_t* */ prom_collector_t *prom_collector_new(const char *name); /** - * @brief Create a prom collector which includes the default process metrics. - * @param limits_path If \c NULL POSIX and OS specific will be used to - * determine limits. Otherwise, read the limits from the given file path - - * ususally used for testing, only. - * @param stat_path If \c NULL POSIX and OS specific will be used to - * determine the stats. Otherwise, read the stats from the given file path - - * ususally used for testing, only. - * @param pid If the given \c limits_path or \c stat_path is \c NULL, collect - * the data from the process with the given \c pid . If \c pid is < 1, the - * process id of the running process will be used. - * @param label_keys An arbitrary set of labels to assign to all metrics - * managed by the created collector. Use \c NULL for none. - * @param label_vals The values to use for the given label_keys. Same order - * as label_keys is required. Use \c NULL for none. - * @return The new collector on success, \c NULL otherwise. + *@brief Construct a prom_collector_t* which includes the default process metrics + * @param limits_path Pass NULL to discover the path to the /proc/[pid]/limits file associated with process ID assigned + * by the host environment. Otherwise, pass a string to said path. + * @param stat_path Pass NULL to discover the path to the /proc/[pid]/stat file associated with process ID assigned + * by the host environment. Otherwise, pass a string to said path. + * @return The constructed prom_collector_t* */ -prom_collector_t *ppc_new(const char *limits_path, const char *stat_path, pid_t pid, const char **label_keys, const char **label_vals); +prom_collector_t *prom_collector_process_new(const char *limits_path, const char *stat_path); /** - * @brief Destroy the given collector including all attached metrics. - * @param self collector to destroy. - * @return A non-zero integer value upon failure, 0 otherwise. - * @note No matter what gets returned, you should never use any collector - * passed to this function but set it to \c NULL . Also remember, that per - * default all metrics of the given collector get freed via - * \c prom_gauge_destroy() or \c prom_counter_destroy() and should not be - * used anymore. + * @brief Destroy a collector. You MUST set self to NULL after destruction. + * @param self The target prom_collector_t* + * @return A non-zero integer value upon failure. */ int prom_collector_destroy(prom_collector_t *self); - /** - * @brief Cast the given pointer to \c prom_collector_t and call - * \c prom_collector_destroy() with it. - * @param gen Collector to destroy. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Frees a collector passed as a void pointer. You MUST set self to NULL after destruction. + * @param gen The target prom_collector_t* represented as a void* */ -int prom_collector_destroy_generic(void *gen); +void prom_collector_free_generic(void *gen); /** - * @brief Same as \c prom_collector_destroy_generic(), but drops any return - * codes. + * @brief Destroys a collector passed as a void pointer. You MUST set self to NULL after destruction. + * @param gen The target prom_collector_t* represented as a void* + * @return A non-zero integer value upon failure. */ -void prom_collector_free_generic(void *gen); +int prom_collector_destroy_generic(void *gen); /** - * @brief Add the given metric to the given collector. It gets automatically - * destroyed when the given collector gets destroyed. - * @param self Where to add the metric. - * @param metric Metric to add. \c NULL is allowed and gets silently ignored. - * @return A non-zero integer value upon failure, \c 0 otherwise. - * @see \c prom_collector_destroy(). + * @brief Add a metric to a collector + * @param self The target prom_collector_t* + * @param metric the prom_metric_t* to add to the prom_collector_t* passed as self. + * @return A non-zero integer value upon failure. */ int prom_collector_add_metric(prom_collector_t *self, prom_metric_t *metric); /** - * @brief Set the function, which prepares (if needed) and returns all relevant - * metrics of the given collector ready for Prometheus exposition. - * @param self Collector containing the metrics. - * @param fn The function to repare and return the metrics. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief The collect function is responsible for doing any work involving a set of metrics and then returning them + * for metric exposition. + * @param self The target prom_collector_t* + * @param fn The prom_collect_fn* which will be responsible for handling any metric collection operations before + * returning the collected metrics for exposition. + * @return A non-zero integer value upon failure. */ int prom_collector_set_collect_fn(prom_collector_t *self, prom_collect_fn *fn); -/** - * @brief Attach custom data to the given collector as well as the callback to - * use to clean it up. - * - * @param self Where to attach data and cleanup function. - * @param data A pointer to custom data to attach. It gets not used by the - * framework itself, just piggybacked to the collector as is. - * @param fn Function, which should be used to free/cleanup the given custom - * data. If not set or \c NULL, the default implementation will be used, which - * just sets the related pointer to \c NULL, which might cause memory leaks. - * It gets automagically called by prom_collector_destroy(). - * @return A pointer to the data currently attached to the collector or \c NULL - * if not yet set. - */ -void *prom_collector_data_set(prom_collector_t *self, void *data, prom_collector_free_data_fn *fn); - -/** - * @brief Get the pointer to the custom data attached to the given collector. - * - * @param self The collector in question. - * @return a pointer to custom data, which might be \c NULL. - */ -void *prom_collector_data_get(prom_collector_t *self); - -/** - * @brief Get a map of all metrics of the given collector keyed by their names. - * Per default this function will be used, if no collect function has been set. - * @param self The collector in question. - * @see \c prom_collector_set_collect_fn() - */ -prom_map_t *prom_collector_metrics_get(prom_collector_t *self); - #endif // PROM_COLLECTOR_H diff --git a/prom/include/prom_collector_registry.h b/prom/include/prom_collector_registry.h index dc1b774..abb74ab 100644 --- a/prom/include/prom_collector_registry.h +++ b/prom/include/prom_collector_registry.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,217 +22,101 @@ limitations under the License. #ifndef PROM_REGISTRY_H #define PROM_REGISTRY_H -#include <stdbool.h> #include "prom_collector.h" #include "prom_metric.h" -/** @brief Reserved label value for libprom's own scrape duration metrics. - @note Do not use unless you know, what you are doing. */ -#define METRIC_LABEL_SCRAPE "libprom" -/** @brief Reserved name for libprom's own scrape duration metric. - @note Do not use unless you know, what you are doing. */ -#define METRIC_NAME_SCRAPE "scrape_duration_seconds" -/** @brief Reserved name for libprom's own default prom collector, where - usually new metrics get attached. - @note Do not use unless you know, what you are doing. */ -#define COLLECTOR_NAME_DEFAULT "default" -/** @brief Reserved name for libprom's own process stats prom collector. - @note Do not use unless you know, what you are doing. */ -#define COLLECTOR_NAME_PROCESS "process" -/** @brief Reserved name for libprom's own default prom collector registry. - @note Do not use unless you know, what you are doing. */ -#define REGISTRY_NAME_DEFAULT "default" - -/** - * @brief flags for the setup of a prom collector registry. - * @see \c pcr_init() - */ -enum prom_init_flag { - /** placeholder for \c 0 - implies nothing */ - PROM_NONE = 0, - /** Automatically setup and attach a \c process collector, which collects - stats of this process on \c pcr_bridge() and - appends its to the output. */ - PROM_PROCESS = 1, - /** Automatically create and use a metric to monitor the time needed to - dump all the metrics of all registered collectors in Prometheus - exposition format and include it in the dump as well. The metric gets - labeled as \c METRIC_LABEL_SCRAPE , the metric's implied name is - \c METRIC_NAME_SCRAPE . */ - PROM_SCRAPETIME = 2, - /** Implies \c PROM_SCRAPETIME, but measures and dumps the dump time of - every single collector as well. The related metrics get labeled with - the name of the collector. */ - PROM_SCRAPETIME_ALL = 4, - /** Omit any "# HELP" and \c "# TYPE" lines in metric exports. These are - wrt. the Prometheus exposition format optional and e.g. Victoria-Metrics - vmagent as well as timeseries DB ignore them completely because simply - not needed. So allows less trash and communication overhead. */ - PROM_COMPACT = 8 -}; - -/** @brief collection of prom collector registry features. - @see \c prom_init_flag - */ -typedef unsigned int PROM_INIT_FLAGS; - /** * @brief A prom_registry_t is responsible for registering metrics and briding them to the string exposition format */ -typedef struct pcr pcr_t; - -/** - * @brief Initialize the default registry by calling pcr_init() within your app. - * @note You MUST NOT modify this value. - */ -extern pcr_t *PROM_COLLECTOR_REGISTRY; -/** @brief backward compatibility to 0.1.3 - will vanish soon. */ -#define PROM_COLLECTOR_REGISTRY_DEFAULT PROM_COLLECTOR_REGISTRY - -/** - * @brief Initializes the default collector registry. - * \c PROM_COLLECTOR_REGISTRY and enables metric collection on the executing - * process and sets the metric name prefix to \c METRIC_LABEL_SCRAPE + "_". - * Same as \c pcr_init(PROM_PROCESS|PROM_SCRAPETIME, METRIC_LABEL_SCRAPE "_"). - * @return A non-zero integer value upon failure. \c 0 otherwise. - */ -int pcr_default_init(void); +typedef struct prom_collector_registry prom_collector_registry_t; /** - * @brief Initializes the default collector registry - * \c PROM_COLLECTOR_REGISTRY named \c REGISTRY_NAME_DEFAULT. - * @param features If \c 0, a prom collector registry gets created, which - * just contains a single empty collector named \c COLLECTOR_NAME_DEFAULT - * where per default all new metrics get attached. - * @param mprefix If not \c NULL, prefix each metric's name with this - * string when metrics get exposed. E.g. one may use "appname_". - * @return A non-zero integer value upon failure - the registry is unusable. + * @brief Initialize the default registry by calling prom_collector_registry_init within your program. You MUST NOT + * modify this value. */ -int pcr_init(PROM_INIT_FLAGS features, const char *mprefix); +extern prom_collector_registry_t *PROM_COLLECTOR_REGISTRY_DEFAULT; /** - * @brief Constructs a registry named \c default which contains one empty - * prom collector named \c default , only. - * @param name Name of the collector registry. It MUST NOT be \c default. - * @return The new registry on success, \c NULL otherwise. + * @brief Initializes the default collector registry and enables metric collection on the executing process + * @return A non-zero integer value upon failure */ -pcr_t *pcr_new(const char *name); +int prom_collector_registry_default_init(void); /** - * @brief Destroy the given collector registry. Before it releases its handles - * to registered collectors, it calls \c prom_collector_destroy() on them, and - * this in turn calls \c prom_metric_destroy() for all the collector's metrics. - * So keep in mind, that after this call all registered collectors and related - * metrics will not work anymore. - * @param self Registry to destroy. - * @return A non-zero integer value upon failure, 0 otherwise. - * @note No matter what is returned, one should always set the pointer of - * the given registry to \c NULL because it gets always passed to \c free() - * and thus points to an invalid memory location on return. + * @brief Constructs a prom_collector_registry_t* + * @param name The name of the collector registry. It MUST NOT be default. + * @return The constructed prom_collector_registry_t* */ -int pcr_destroy(pcr_t *self); +prom_collector_registry_t *prom_collector_registry_new(const char *name); /** - * @brief Enable process metrics on the given collector registry. - * @param self The registry, where to attach the process metrics. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Destroy a collector registry. You MUST set self to NULL after destruction. + * @param self The target prom_collector_registry_t* + * @return A non-zero integer value upon failure */ -int pcr_enable_process_metrics(pcr_t *self); +int prom_collector_registry_destroy(prom_collector_registry_t *self); /** - * @brief Create a scrape duration gauge metric and attach it to the given - * prom collector registry. If available, \c pcr_bridge() - * measures the time needed to collect and export all metrics of the registry, - * updates the metric and appends it to the export. - * @param self Where to enable scrape duration monitoring. - * @return A non-zero integer if the given registry is \c NULL, or the metric - * could not be added to its \c default collector, 0 otherwise. + * @brief Enable process metrics on the given collector registry + * @param self The target prom_collector_registry_t* + * @return A non-zero integer value upon failure */ -int pcr_enable_scrape_metrics(pcr_t *self); +int prom_collector_registry_enable_process_metrics(prom_collector_registry_t *self); /** - * @brief Registers a metric with the default collector on - * PROM_COLLECTOR_REGISTRY. + * @brief Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY * - * The metric to be registered MUST NOT already be registered with the given. - * If so, the function calls exit() - probably not what you want! NOTE: - * PROM_COLLECTOR_REGISTRY must be registered via pcr_init() prior to calling - * this function. The metric will be added to the default registry's default - * collector. + * The metric to be registered MUST NOT already be registered with the given . If so, the program will + * halt. It returns a prom_metric_t* to simplify metric creation and registration. Furthermore, + * PROM_DEFAULT_COLLECTOR_REGISTRY must be registered via prom_collector_registry_default_init() prior to calling this + * function. The metric will be added to the default registry's default collector. * - * @param metric The metric to register. - * @return The registered metric, or \c NULL if registration failed. + * @param metric The metric to register on PROM_DEFAULT_COLLECTOR_REGISTRY* + * @return The registered prom_metric_t* */ -prom_metric_t *pcr_must_register_metric(prom_metric_t *metric); +prom_metric_t *prom_collector_registry_must_register_metric(prom_metric_t *metric); /** - * @brief Registers a metric with the default collector on - * PROM_COLLECTOR_REGISTRY. + * @brief Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. Returns an non-zero integer + * value on failure. * - * See also: pcr_must_register_metric. + * See prom_collector_registry_must_register_metric. * - * @param metric The metric to register on PROM_COLLECTOR_REGISTRY* - * @return A non-zero integer value upon failure. + * @param metric The metric to register on PROM_DEFAULT_COLLECTOR_REGISTRY* + * @return A non-zero integer value upon failure */ -int pcr_register_metric(prom_metric_t *metric); +int prom_collector_registry_register_metric(prom_metric_t *metric); /** - * @brief Register a collector with the given registry. If the registry already - * contains a collector with the same name, the registration will fail. - * @param self Where to register the collector. - * @param collector The collector to register. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Register a collector with the given registry. Returns a non-zero integer value on failure. + * @param self The target prom_collector_registry_t* + * @param collector The prom_collector_t* to register onto the prom_collector_registry_t* as self + * @return A non-zero integer value upon failure */ -int pcr_register_collector(pcr_t *self, prom_collector_t *collector); +int prom_collector_registry_register_collector(prom_collector_registry_t *self, prom_collector_t *collector); /** - * @brief Get a reference to the prom collector with the given \a name from - * the given prom collector registry. - * @param self Registry to query. - * @param name Name of the collector to lookup. - * @return \c NULL if not found, a reference to the related prom collector - * otherwise. - */ -prom_collector_t *pcr_get(pcr_t *self, const char *name); - -/** - * @brief Export all relevant metrics registered with the given registry in - * the default metric exposition format as a single string. This string MUST - * be freed to avoid unnecessary heap memory growth. + * @brief Returns a string in the default metric exposition format. The string MUST be freed to avoid unnecessary heap + * memory growth. * * Reference: https://prometheus.io/docs/instrumenting/exposition_formats/ * - * @param self The registry containing the collectors with the relevant metrics. - * @return \c NULL on failure, the export otherwise. + * @param self The target prom_collector_registry_t* + * @return The string int he default metric exposition format. */ -char *pcr_bridge(pcr_t *self); +const char *prom_collector_registry_bridge(prom_collector_registry_t *self); /** *@brief Validates that the given metric name complies with the specification: * * Reference: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels * - * Returns a non-zero integer value on failure, \c 0 otherwise. - * - * @param self Registry to use. - * @param metric_name Name to validate - * @return A non-zero integer value upon failure, \c 0 otherwise. - * - *@deprecated since 1.1.0 - *@see Use \c pcr_check_name(name, 1) instead. - */ -int pcr_validate_metric_name(pcr_t *self, const char *metric_name); - -/** - *@brief Check whether the given label | metric name complies with the specification: - * - * Reference: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels + * Returns a non-zero integer value on failure. * - * @param name Name to validate - * @param is_label Use 0 to indicate name is a metric name, or 1 to force a - * label name check. - * @return \c 0 if the given name is ok, a non-zero integer value otherwise. + * @param self The target prom_collector_registry_t* + * @param metric_name The metric name to validate + * @return A non-zero integer value upon failure */ -int pcr_check_name(const char *name, bool is_label); +int prom_collector_registry_validate_metric_name(prom_collector_registry_t *self, const char *metric_name); #endif // PROM_H diff --git a/prom/include/prom_counter.h b/prom/include/prom_counter.h index d2f8a7a..cd3d20a 100644 --- a/prom/include/prom_counter.h +++ b/prom/include/prom_counter.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,7 +27,7 @@ limitations under the License. */ /** - * @brief Prometheus metric: counter + * @brief A prometheus counter. * * References * * See https://prometheus.io/docs/concepts/metric_types/#counter @@ -36,87 +35,69 @@ limitations under the License. typedef prom_metric_t prom_counter_t; /** - * @brief Construct a new metric of type \c counter (or short: counter). - * @param name Name of the counter. - * @param help Short counter description. - * @param label_key_count The number of labels associated with the given - * counter. Pass \c 0 if the counter does not require labels. - * @param label_keys A collection of label keys. The number of keys MUST match - * the value passed as \c label_key_count. If no labels are required, pass - * \c NULL. Otherwise, it may be convenient to pass this value as a literal. - * @return The new prom counter on success, \c NULL otherwise. + * @brief Construct a prom_counter_t* + * @param name The name of the metric + * @param help The metric description + * @param label_key_count The number of labels associated with the given metric. Pass 0 if the metric does not + * require labels. + * @param label_keys A collection of label keys. The number of keys MUST match the value passed as label_key_count. If + * no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a + * literal. + * @return The constructed prom_counter_t* * * *Example* * - * // An example with labels - * prom_counter_new("foo", "foo is a counter with labels", 2, (const char**) { "one", "two" }); + * // An example with labels + * prom_counter_new("foo", "foo is a counter with labels", 2, (const char**) { "one", "two" }); * - * // An example without labels - * prom_counter_new("foo", "foo is a counter without labels", 0, NULL); + * // An example without labels + * prom_counter_new("foo", "foo is a counter without labels", 0, NULL); */ prom_counter_t *prom_counter_new(const char *name, const char *help, size_t label_key_count, const char **label_keys); /** - * @brief Destroys the given counter. - * @param self Counter to destroy. - * @return A non-zero integer value upon failure, \c 0 otherwise. - * @note No matter what gets returned, you should never use any metric - * passed to this function but set it to \c NULL . + * @brief Destroys a prom_counter_t*. You must set self to NULL after destruction. A non-zero integer value will be + * returned on failure. + * @param self A prom_counter_t* + * @return A non-zero integer value upon failure. */ int prom_counter_destroy(prom_counter_t *self); /** - * @brief Increment the given counter by 1. - * @param self counter to increment. - * @param label_values The label values associated with the counter sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the counter's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Increment the prom_counter_t by 1. A non-zero integer value will be returned on failure. + * @param self The target prom_counter_t* + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the counter's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return A non-zero integer value upon failure. * * *Example* * - * // An example with labels - * prom_counter_inc(foo_counter, (const char**) { "bar", "bang" }); - * - * // An example without labels - * prom_counter_inc(foo_counter, NULL); + * // An example with labels + * prom_counter_inc(foo_counter, (const char**) { "bar", "bang" }); + ** + * // An example without labels + * prom_counter_inc(foo_counter, NULL); */ int prom_counter_inc(prom_counter_t *self, const char **label_values); /** - * @brief Add the value to the give counter. - * @param self Where to add the value. - * @param r_value Value to add. MUST be >= 0. - * @param label_values The label values associated with the counter sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the counter's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Add the value to the prom_counter_t*. A non-zero integer value will be returned on failure. + * @param self The target prom_counter_t* + * @param r_value The double to add to the prom_counter_t passed as self. The value MUST be greater than or equal to 0. + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the counter's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return A non-zero integer value upon failure. * * *Example* * - * // An example with labels - * prom_counter_add(foo_counter, 22, (const char**) { "bar", "bang" }); + * // An example with labels + * prom_counter_add(foo_counter, 22, (const char**) { "bar", "bang" }); * - * // An example without labels - * prom_counter_add(foo_counter, 22, NULL); + * // An example without labels + * prom_counter_add(foo_counter, 22, NULL); */ int prom_counter_add(prom_counter_t *self, double r_value, const char **label_values); -/** - * @brief Reset the given counter to the given value. - * @param self Where to set the given value. - * @param r_value Value to set. MUST be >= 0. - * @param label_values The label values associated with the counter sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the counter's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. - */ -int prom_counter_reset(prom_counter_t *self, double r_value, const char **label_values); - #endif // PROM_COUNTER_H diff --git a/prom/include/prom_gauge.h b/prom/include/prom_gauge.h index 09c5fed..4b3f55e 100644 --- a/prom/include/prom_gauge.h +++ b/prom/include/prom_gauge.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,7 +27,7 @@ limitations under the License. #include "prom_metric.h" /** - * @brief Prometheus metric: gauge + * @brief A prometheus gauge. * * References * * See https://prometheus.io/docs/concepts/metric_types/#gauge @@ -36,133 +35,120 @@ limitations under the License. typedef prom_metric_t prom_gauge_t; /** - * @brief Construct a new metric of type \c gauge (or short: gauge). - * @param name Name of the gauge. - * @param help Short gauge description. - * @param label_key_count The number of labels associated with the given - * gauge. Pass \c 0 if the gauge does not require labels. - * @param label_keys A collection of label keys. The number of keys MUST match - * the value passed as \c label_key_count. If no labels are required, pass - * \c NULL. Otherwise, it may be convenient to pass this value as a literal. - * @return The new gauge on success, \c NULL otherwise. - * - * // An example with labels - * prom_gauge_new("foo", "foo is a gauge with labels", 2, (const char**) { "one", "two" }); - * - * // An example without labels - * prom_gauge_new("foo", "foo is a gauge without labels", 0, NULL); + * @brief Constructs a prom_gauge_t* + * @param name The name of the metric + * @param help The metric description + * @param label_key_count The number of labels associated with the given metric. Pass 0 if the metric does not + * require labels. + * @param label_keys A collection of label keys. The number of keys MUST match the value passed as label_key_count. If + * no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a + * literal. + * @return The constructed prom_guage_t* + * + * // An example with labels + * prom_gauge_new("foo", "foo is a gauge with labels", 2, (const char**) { "one", "two" }); + * + * // An example without labels + * prom_gauge_new("foo", "foo is a gauge without labels", 0, NULL); */ prom_gauge_t *prom_gauge_new(const char *name, const char *help, size_t label_key_count, const char **label_keys); /** - * @brief Destroys the given gauge. - * @param self Gauge to destroy. - * @return A non-zero integer value upon failure, \c 0 otherwise. - * @note No matter what gets returned, you should never use any metric - * passed to this function but set it to \c NULL . + * @brief Destroys a prom_gauge_t*. You must set self to NULL after destruction. A non-zero integer value will be + * returned on failure. + * @param self The target prom_gauge_t* + * @return A non-zero integer value upon failure */ int prom_gauge_destroy(prom_gauge_t *self); /** - * @brief Increment the given gauge by 1. - * @param self Gauge to increment. - * @param label_values The label values associated with the gauge sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the gauge's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. - * + * @brief Increment the prom_gauge_t* by 1. + * @param self The target prom_gauger_t* + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the gauge's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return A non-zero integer value upon failure * *Example* * - * // An example with labels - * prom_gauge_inc(foo_gauge, (const char**) { "bar", "bang" }); + * // An example with labels + * prom_gauge_inc(foo_gauge, (const char**) { "bar", "bang" }); * - * // An example without labels - * prom_gauge_inc(foo_gauge, NULL); + * // An example without labels + * prom_gauge_inc(foo_gauge, NULL); */ int prom_gauge_inc(prom_gauge_t *self, const char **label_values); /** - * @brief Decrement the given gauge by 1. - * @param self Gauge to decrement. - * @param label_values The label values associated with the gauge sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the gauge's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. - * + * @brief Decrement the prom_gauge_t* by 1. + * @param self The target prom_gauger_t* + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the gauge's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return A non-zero integer value upon failure. * *Example* * - * // An example with labels - * prom_gauge_dec(foo_gauge, (const char**) { "bar", "bang" }); + * // An example with labels + * prom_gauge_dec(foo_gauge, (const char**) { "bar", "bang" }); * - * // An example without labels - * prom_gauge_dec(foo_gauge, NULL); + * // An example without labels + * prom_gauge_dec(foo_gauge, NULL); */ int prom_gauge_dec(prom_gauge_t *self, const char **label_values); /** - * @brief Add the given value to the given gauge. - * @param self Where to add the given value. - * @param r_value Value to add. MUST be >= 0. - * @param label_values The label values associated with the gauge sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the gauge's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Add the value to the prom_gauge_t*. + * @param self The target prom_gauge_t* + * @param r_value The double to add to the prom_gauge_t passed as self. + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the gauge's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return A non-zero integer value upon failure. * * *Example* * - * // An example with labels - * prom_gauge_add(foo_gauge 22, (const char**) { "bar", "bang" }); + * // An example with labels + * prom_gauge_add(foo_gauge 22, (const char**) { "bar", "bang" }); * - * // An example without labels - * prom_gauge_add(foo_gauge, 22, NULL); + * // An example without labels + * prom_gauge_add(foo_gauge, 22, NULL); */ int prom_gauge_add(prom_gauge_t *self, double r_value, const char **label_values); /** - * @brief Subtract the value to the given gauge. - * @param self Where to substract the given value. - * @param r_value Value to substract (which might be < 0). - * @param label_values The label values associated with the gauge sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the gauge's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Subtract the value to the prom_gauge. A non-zero integer value will be returned on failure. + * @param self The target prom_gauge_t* + * @param r_value The double to add to the prom_gauge_t passed as self. + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the gauge's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return A non-zero integer value upon failure. * * *Example* * - * // An example with labels - * prom_gauge_sub(foo_gauge 22, (const char**) { "bar", "bang" }); + * // An example with labels + * prom_gauge_sub(foo_gauge 22, (const char**) { "bar", "bang" }); * - * // An example without labels - * prom_gauge_sub(foo_gauge, 22, NULL); + * // An example without labels + * prom_gauge_sub(foo_gauge, 22, NULL); */ int prom_gauge_sub(prom_gauge_t *self, double r_value, const char **label_values); /** - * @brief Set the given gauge to the given value. - * @param self Where to set the given value. - * @param r_value Value to set (which might be < 0). - * @param label_values The label values associated with the gauge sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the gauge's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Set the value for the prom_gauge_t* + * @param self The target prom_gauge_t* + * @param r_value The double to which the prom_gauge_t* passed as self will be set + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the gauge's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return A non-zero integer value upon failure. * * *Example* * - * // An example with labels - * prom_gauge_set(foo_gauge 22, (const char**) { "bar", "bang" }); + * // An example with labels + * prom_gauge_set(foo_gauge 22, (const char**) { "bar", "bang" }); * - * // An example without labels - * prom_gauge_set(foo_gauge, 22, NULL); + * // An example without labels + * prom_gauge_set(foo_gauge, 22, NULL); */ int prom_gauge_set(prom_gauge_t *self, double r_value, const char **label_values); diff --git a/prom/include/prom_histogram.h b/prom/include/prom_histogram.h index 9966827..e887ccb 100644 --- a/prom/include/prom_histogram.h +++ b/prom/include/prom_histogram.h @@ -1,7 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> - Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -30,7 +28,7 @@ limitations under the License. #include "prom_metric.h" /** - * @brief Prometheus metric: histogram + * @brief A prometheus histogram. * * References * * See https://prometheus.io/docs/concepts/metric_types/#histogram @@ -38,47 +36,45 @@ limitations under the License. typedef prom_metric_t prom_histogram_t; /** - * @brief Construct a new metric of type \c histogram (or short: histogram) - * @param name Name of the histogram. - * @param help Sort histogram description. - * @param buckets Buckets to assign. See prom_histogram_buckets.h . - * @param label_key_count The number of labels associated with the given - * histogram. Pass \c 0 if the histogram does not require labels. - * @param label_keys A collection of label keys. The number of keys MUST match - * the value passed as \c label_key_count. If no labels are required, pass - * \c NULL. Otherwise, it may be convenient to pass this value as a literal. - * @return The new prom histogram on success, \c NULL otherwise. + *@brief Construct a prom_histogram_t* + * @param name The name of the metric + * @param help The metric description + * @param buckets The prom_histogram_buckets_t*. See prom_histogram_buckets.h. + * @param label_key_count is the number of labels associated with the given metric. Pass 0 if the metric does not + * require labels. + * @param label_keys A collection of label keys. The number of keys MUST match the value passed as label_key_count. If + * no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a + * literal. + * @return The constructed prom_histogram_t* * * *Example* * - * // An example with labels - * phb_t* buckets = phb_linear(5.0, 5.0, 10); - * prom_histogram_new("foo", "foo is a histogram with labels", buckets, 2, (const char**) { "one", "two" }); + * // An example with labels + * prom_histogram_buckets_t* buckets = prom_histogram_buckets_linear(5.0, 5.0, 10); + * prom_histogram_new("foo", "foo is a counter with labels", buckets, 2, (const char**) { "one", "two" }); * - * // An example without labels - * phb_t* buckets = phb_linear(5.0, 5.0, 10); - * prom_histogram_new("foo", "foo is a histogram without labels", buckets, 0, NULL); + * // An example without labels + * prom_histogram_buckets_t* buckets = prom_histogram_buckets_linear(5.0, 5.0, 10); + * prom_histogram_new("foo", "foo is a counter without labels", buckets, 0, NULL); */ -prom_histogram_t *prom_histogram_new(const char *name, const char *help, phb_t *buckets, size_t label_key_count, const char **label_keys); +prom_histogram_t *prom_histogram_new(const char *name, const char *help, prom_histogram_buckets_t *buckets, + size_t label_key_count, const char **label_keys); /** - * @brief Destroy the given histogram. - * @return Non-zero value upon failure, \c 0 otherwise. - * @note No matter what gets returned, you should never use any metric - * passed to this function but set it to \c NULL . + * @brief Destroy a prom_histogram_t*. self MUSTS be set to NULL after destruction. Returns a non-zero integer value + * upon failure. + * @return Non-zero value upon failure. */ int prom_histogram_destroy(prom_histogram_t *self); /** - * @brief Observe the given value of the given histogram with the given labels. - * @param self Histogram to observe. - * @param value Value to observe. - * @param label_values The label values associated with the histogram sample - * being updated. The number of labels must match the value passed as - * \c label_key_count in the histogram's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return A non-zero integer value upon failure, \c 0 otherwise. + * @brief Observe the prom_histogram_t given the value and labells + * @param self The target prom_histogram_t* + * @param value The value to observe + * @param label_keys A collection of label keys. The number of keys MUST match the value passed as label_key_count. If + * no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a + * literal. + * @return Non-zero value upon failure */ int prom_histogram_observe(prom_histogram_t *self, double value, const char **label_values); diff --git a/prom/include/prom_histogram_buckets.h b/prom/include/prom_histogram_buckets.h index 91cdae9..d3112d8 100644 --- a/prom/include/prom_histogram_buckets.h +++ b/prom/include/prom_histogram_buckets.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,8 +17,6 @@ limitations under the License. /** * @file prom_histogram_buckets.h * @brief https://prometheus.io/docs/concepts/metric_types/#histogram - * @note To get rid off braindamaged long names, you may replace - * \c prom_histogram_bucket with \c PHB . */ #include "stdlib.h" @@ -27,60 +24,58 @@ limitations under the License. #ifndef PROM_HISTOGRAM_BUCKETS_H #define PROM_HISTOGRAM_BUCKETS_H -typedef struct phb { - int count; /**< Number of buckets */ - const double *upper_bound; /**< count ascending upper limits */ - const char **key; /**< count keys used to lookup samples. */ -} phb_t; +typedef struct prom_histogram_buckets { + int count; /**< Number of buckets */ + const double *upper_bounds; /**< The bucket values */ +} prom_histogram_buckets_t; /** - * @brief Construct a new histogram bucket with the given values. - * @param count Number of buckets. - * @param bucket \c count values to add to the bucket. - * @return The new histogram bucket, or \c NULL if an error occured. + * @brief Construct a prom_histogram_buckets_t* + * @param count The number of buckets + * @param bucket The first bucket. A variable number of bucket values may be passed. This quantity MUST equal the value + * passed as count. + * @return The constructed prom_histogram_buckets_t* */ -phb_t *phb_new(size_t count, double bucket, ...); +prom_histogram_buckets_t *prom_histogram_buckets_new(size_t count, double bucket, ...); /** - * @brief default histogram buckets: .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10 + * @brief the default histogram buckets: .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10 */ -extern phb_t *prom_histogram_default_buckets; +extern prom_histogram_buckets_t *prom_histogram_default_buckets; /** - * @brief Construct a linearly sized prom histogram bucket. - * @param start The first inclusive upper bound. - * @param width The distance between each upper bound. - * @param count The total number of buckets. The final +Inf bucket is not - * counted and not included. - * @return The constructed histogram bucket or \c NULL if an error occured. + *@brief Construct a linearly sized prom_histogram_buckets_t* + * @param start The first inclusive upper bound + * @param width The distance between each upper bound + * @param count The total number of buckets. The final +Inf bucket is not counted and not included. + * @return The constructed prom_histogram_buckets_t* */ -phb_t *phb_linear(double start, double width, size_t count); +prom_histogram_buckets_t *prom_histogram_buckets_linear(double start, double width, size_t count); /** - * @brief Construct an exponentially sized prom histogram bucket. - * @param start The first inclusive upper bound. The value MUST be > 0. - * @param factor The factor to apply to the previous upper bound to produce - * the next upper bound. The value MUST be greater than 1. - * @param count The total number of buckets. The final +Inf bucket is not - * counted and not included. The value MUST be greater than or equal to 1. - * @return The new histogram bucket, or \c NULL if an error occured. + * @brief Construct an exponentially sized prom_histogram_buckets_t* + * @param start The first inclusive upper bound. The value MUST be greater than 0. + * @param factor The factor to apply to the previous upper bound to produce the next upper bound. The value MUST be + * greater than 1. + * @param count The total number of buckets. The final +Inf bucket is not counted and not included. The value MUST be + * greater than or equal to 1 + * @return The constructed prom_histogram_buckets_t* */ -phb_t *phb_exponential(double start, double factor, size_t count); +prom_histogram_buckets_t *prom_histogram_buckets_exponential(double start, double factor, size_t count); /** - * @brief Destroy the given prom histogram bucket. - * @param self The bucket to destroy. - * @return Non-zero integer value upon failure, otherwise \c 0 . - * @note No matter what gets returned, you should never use any bucket - * passed to this function but set it to \c NULL . + * @brief Destroy a prom_histogram_buckets_t*. Self MUST be set to NULL after destruction. Returns a non-zero integer + * value upon failure. + * @param self The target prom_histogram_buckets_t* + * @return Non-zero integer value upon failure */ -int phb_destroy(phb_t *self); +int prom_histogram_buckets_destroy(prom_histogram_buckets_t *self); /** - * @brief Get the number of valus in the given bucket. - * @param self The bucket to query. - * @return The number of values in the bucket. + * @brief Get the count of buckets + * @param self The target prom_histogram_buckets_t* + * @return The count of buckets */ -size_t phb_count(phb_t *self); +size_t prom_histogram_buckets_count(prom_histogram_buckets_t *self); #endif // PROM_HISTOGRAM_BUCKETS_H diff --git a/prom/include/prom_linked_list.h b/prom/include/prom_linked_list.h index fdd9ebc..7381622 100644 --- a/prom/include/prom_linked_list.h +++ b/prom/include/prom_linked_list.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,10 +19,10 @@ limitations under the License. #include <stdlib.h> -struct pll; +struct prom_linked_list; /** * @brief Provides a generic linked list */ -typedef struct pll pll_t; +typedef struct prom_linked_list prom_linked_list_t; #endif // PROM_LIST_H diff --git a/prom/include/prom_log.h b/prom/include/prom_log.h deleted file mode 100644 index 9bc915f..0000000 --- a/prom/include/prom_log.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de>. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file prom_log.h - * @brief logging - */ - -#ifndef PROM_LOG_H -#define PROM_LOG_H - -#ifdef PROM_LOG_ENABLE - -#include <stdio.h> - -/** - * @brief Available log levels. - */ -typedef enum { - PLL_NONE = 0, /**< placeholder for \c 0 - implies nothing. Do not use! */ - PLL_DBG, /**< debug level */ - PLL_INFO, /**< info level */ - PLL_WARN, /**< warning level */ - PLL_ERR, /**< error level */ - PLL_FATAL, /**< fatal level */ - PLL_COUNT /**< number of log levels */ -} PROM_LOG_LEVEL; - -/** - * @brief If the given \c PROM_LOG_LEVEL is >= the log level set, generate and - * log a related message, otherwise do nothing. Right now \c format and the - * optional arguments get passed to \c printf() as is and the related string - * pushed to \c stderr with a trailing linefeed. - * The log level to compare to, if not already set, gets determined the - * first time this function gets called: It evaluates the environment variable - * **PROM_LOG_LEVEL**. If it is unset or has an unknown value, \c INFO will be - * used. Otherwise the corresponding level for \c DEBUG, \c INFO, \c WARN, - * \c ERROR, or \c FATAL. - * - * @param PROM_LOG_LEVEL Log level to use to decide, whether to log. - * @param format Same as for \c printf(3). - * @param ... Optional format args. - */ -void prom_log(PROM_LOG_LEVEL level, const char* format, ...); - -/** - * @brief Set the current log level. - * @param level The loglevel to set. Use \c PLL_NONE to get the loglevel - * currently set returned and the current loglevel stays untouched. - * @return The previously loglevel used (might be PLL_NONE, if not yet set). - */ -PROM_LOG_LEVEL prom_log_level(PROM_LOG_LEVEL level); - -/** - * @brief Parse the given log \c level name (for convenience, a single digit - * gets recognized as well) and return its corresponding log level value. - * @param level Name of the log level or its corresponding value to parse. - * @return \c PLL_NONE if the given \c level name could not be parsed - * successfully, the corresponding log level value otherwise. - */ -PROM_LOG_LEVEL prom_log_level_parse(const char *level); - -/** - * @brief Use the given \c stream for logging. This function duplicates the - * stream's underlying file descriptor, opens it in \c APPEND mode and writes - * from now on all messages to it. It gets automatically flushed and synced - * linewise. The callee should close the given stream to avoid any garbage. - * @param stream Stream to use for logging. \c NULL or invalid streams are - * ignored. - * @return \c NULL on failure, the previously used logging stream (which is - * initially \c stderr ) otherwise. The callee should close it, if not needed - * anymore. - */ -FILE *prom_log_use(FILE *stream); - -#define PROM_LOG_PRIV(level, fmt, ...) \ - prom_log(level, "%s:%d::%s(): " fmt , \ - __FILE__, __LINE__, __func__, __VA_ARGS__); - -/** - * @brief Log a debug message prefixed with the location of this macro - * within the source code (file, line, function). - */ -#define PROM_DEBUG(fmt, ...) PROM_LOG_PRIV(PLL_DBG, fmt, __VA_ARGS__); -/** - * @brief Log an info message prefixed with the location of this macro - * within the source code (file, line, function). - */ -#define PROM_INFO(fmt, ...) PROM_LOG_PRIV(PLL_INFO, fmt, __VA_ARGS__); -/** - * @brief Log a warn message prefixed with the location of this macro - * within the source code (file, line, function). - */ -#define PROM_WARN(fmt, ...) PROM_LOG_PRIV(PLL_WARN, fmt, __VA_ARGS__); -/** - * @brief Log an error message prefixed with the location of this macro - * within the source code (file, line, function). - */ -#define PROM_ERROR(fmt, ...) PROM_LOG_PRIV(PLL_ERR, fmt, __VA_ARGS__); -/** - * @brief Log a fatal message prefixed with the location of this macro - * within the source code (file, line, function). - */ -#define PROM_FATAL(fmt, ...) PROM_LOG_PRIV(PLL_FATAL, fmt, __VA_ARGS__); -/** - * @brief Log a info message prefixed with the location of this macro - * within the source code (file, line, function), which has no optional arg. - */ -#define PROM_LOG(msg) PROM_INFO("%s", msg); - -#else - -#define PROM_DEBUG(fmt, ...) -#define PROM_INFO(fmt, ...) -#define PROM_WARN(fmt, ...) -#define PROM_ERROR(fmt, ...) -#define PROM_FATAL(fmt, ...) -#define PROM_LOG(msg) - -#define prom_log(x, fmt, ...) -#define prom_log_level(x) 0 -#define prom_log_level_parse(x) 0 -#define prom_log_use(x) NULL - -#endif // PROM_LOG_ENABLE - -#endif // PROM_LOG_H diff --git a/prom/include/prom_metric.h b/prom/include/prom_metric.h index 5b9df02..0d8a549 100644 --- a/prom/include/prom_metric.h +++ b/prom/include/prom_metric.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,67 +16,52 @@ limitations under the License. /** * @file prom_metric.h - * @brief Functions for retrieving metric samples from metrics given an - * ordered set of labels. + * @brief Functions for retrieving metric samples from metrics given an ordered set of labels */ #ifndef PROM_METRIC_H #define PROM_METRIC_H -#include <math.h> - -#ifdef NAN -#define NaN NAN -#else -#define NaN (0.0f / 0.0f) -#endif - #include "prom_metric_sample.h" #include "prom_metric_sample_histogram.h" struct prom_metric; /** * @brief A prometheus metric. + * * Reference: https://prometheus.io/docs/concepts/data_model */ typedef struct prom_metric prom_metric_t; /** - * @brief Get a prom metric sample by label values. The order of label_values - * is significant. + * @brief Returns a prom_metric_sample_t*. The order of label_values is significant. * - * You may use this function to cache metric samples to avoid sample lookup. - * Metric samples are stored in a hash map with O(1) lookups in average case. - * Nonethless, caching metric samples and updating them directly might be + * You may use this function to cache metric samples to avoid sample lookup. Metric samples are stored in a hash map + * with O(1) lookups in average case; nonethless, caching metric samples and updating them directly might be * preferrable in performance-sensitive situations. * - * @param self Metric to use for lookup. - * @param label_values label values associated with the metric sample being - * searched. The number of labels must match the value passed to - * label_key_count in the counter's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return The sample found, \c NULL otherwise. + * @param self The target prom_metric_t* + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the counter's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return A prom_metric_sample_t* */ -pms_t *pms_from_labels(prom_metric_t *self, const char **label_values); +prom_metric_sample_t *prom_metric_sample_from_labels(prom_metric_t *self, const char **label_values); /** - * @brief Get a prom histogram metric sample by label values. The order of - * label_values is significant. + * @brief Returns a prom_metric_sample_histogram_t*. The order of label_values is significant. * - * You may use this function to cache metric samples to avoid sample lookup. - * Metric samples are stored in a hash map with O(1) lookups in average case. - * Nonethless, caching metric samples and updating them directly might be + * You may use this function to cache metric samples to avoid sample lookup. Metric samples are stored in a hash map + * with O(1) lookups in average case; nonethless, caching metric samples and updating them directly might be * preferrable in performance-sensitive situations. * - * @param self Metric to use for lookup. - * @param label_values label values associated with the metric sample being - * searched. The number of labels must match the value passed to - * label_key_count in the counter's constructor. If no label values are - * necessary, pass \c NULL. Otherwise, it may be convenient to pass this value - * as a literal. - * @return The histogram sample found, \c NULL otherwise. + * @param self The target prom_histogram_metric_t* + * @param label_values The label values associated with the metric sample being updated. The number of labels must + * match the value passed to label_key_count in the counter's constructor. If no label values are + * necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. + * @return prom_metric_sample_histogram_t* */ -pms_histogram_t *pms_histogram_from_labels(prom_metric_t *self, const char **label_values); +prom_metric_sample_histogram_t *prom_metric_sample_histogram_from_labels(prom_metric_t *self, + const char **label_values); #endif // PROM_METRIC_H diff --git a/prom/include/prom_metric_sample.h b/prom/include/prom_metric_sample.h index 2bb867d..72757b9 100644 --- a/prom/include/prom_metric_sample.h +++ b/prom/include/prom_metric_sample.h @@ -1,7 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> - Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,36 +22,39 @@ limitations under the License. #ifndef PROM_METRIC_SAMPLE_H #define PROM_METRIC_SAMPLE_H -struct pms; +struct prom_metric_sample; /** * @brief Contains the specific metric and value given the name and label set - * @note All operations MUST be called on a sample derived from a gauge metric. * Reference: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels */ -typedef struct pms pms_t; +typedef struct prom_metric_sample prom_metric_sample_t; /** - * @brief Add the given r_value to the given sample. - * @param self Where to add the given value. - * @param r_value Value to add. Must be >= 0. - * @return Non-zero integer value upon failure, \c 0 otherwise. + * @brief Add the r_value to the sample. The value must be greater than or equal to zero. + * @param self The target prom_metric_sample_t* + * @param r_value The double to add to prom_metric_sample_t* provided by self + * @return Non-zero integer value upon failure */ -int pms_add(pms_t *self, double r_value); +int prom_metric_sample_add(prom_metric_sample_t *self, double r_value); /** - * @brief Subtract the given r_value from the given sample. - * @param self Where to add the given value. - * @param r_value Value to substract. - * @return Non-zero integer value upon failure, \c 0 otherwise. + * @brief Subtract the r_value from the sample. + * + * This operation MUST be called a sample derived from a gauge metric. + * @param self The target prom_metric_sample_t* + * @param r_value The double to subtract from the prom_metric_sample_t* provided by self + * @return Non-zero integer value upon failure */ -int pms_sub(pms_t *self, double r_value); +int prom_metric_sample_sub(prom_metric_sample_t *self, double r_value); /** - * @brief Set the given r_value to the given ample. - * @param self Where to set the given value. - * @param r_value Value to set. - * @return Non-zero integer value upon failure, \c 0 otherwise. + * @brief Set the r_value of the sample. + * + * This operation MUST be called on a sample derived from a gauge metric. + * @param self The target prom_metric_sample_t* + * @param r_value The double which will be set to the prom_metric_sample_t* provided by self + * @return Non-zero integer value upon failure */ -int pms_set(pms_t *self, double r_value); +int prom_metric_sample_set(prom_metric_sample_t *self, double r_value); #endif // PROM_METRIC_SAMPLE_H diff --git a/prom/include/prom_metric_sample_histogram.h b/prom/include/prom_metric_sample_histogram.h index 7c17494..5dedffd 100644 --- a/prom/include/prom_metric_sample_histogram.h +++ b/prom/include/prom_metric_sample_histogram.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. -Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,20 +22,18 @@ limitations under the License. #ifndef PROM_METRIC_SAMPLE_HISOTGRAM_H #define PROM_METRIC_SAMPLE_HISOTGRAM_H -struct pms_histogram; +struct prom_metric_sample_histogram; /** - * @brief A histogram metric sample. + * @brief A histogram metric sample */ -typedef struct pms_histogram pms_histogram_t; +typedef struct prom_metric_sample_histogram prom_metric_sample_histogram_t; /** - * @brief Find the bucket for the given value in the given prom sample - * metric histogram and increment the sample assigned to it by 1. Furthermore - * update its sum and count sample, if found and appropriate. - * @param self Where to lockup the bucket and sample. - * @param value The value to find. - * @return Non-zero integer value upon failure, \c 0 otherwise. + * @brief Observe the double for the given prom_metric_sample_histogram_observe_t + * @param self The target prom_metric_sample_histogram_t* + * @param value The value to observe. + * @return Non-zero integer value upon failure */ -int pms_histogram_observe(pms_histogram_t *self, double value); +int prom_metric_sample_histogram_observe(prom_metric_sample_histogram_t *self, double value); #endif // PROM_METRIC_SAMPLE_HISOTGRAM_H diff --git a/prom/include/prom_string_builder.h b/prom/include/prom_string_builder.h deleted file mode 100644 index 2d839d8..0000000 --- a/prom/include/prom_string_builder.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file prom_string_builder.h - * A StringBuilder: uses an internal buffer to append strings and characters - * as needed and keeps track of the constructed string, grows the buffer by - * factor 2 automagically. - * - * @note All \c psb_t parameter in the related functions are expected to - * be != \c NULL, otherwise be prepared for core dumps. - * - */ -#ifndef PROM_STRING_BUILDER_I_H -#define PROM_STRING_BUILDER_I_H - -#include <stddef.h> - -/** @brief A string builder. */ -struct psb; -typedef struct psb psb_t; - -/** - * @brief Setup a new string builder. - * @return A new string builder or \c NULL on error. - */ -psb_t *psb_new(void); - -/** - * @brief Destroys the given string builder. - * @param self String builder to destroy. - * @return \c 0 . - */ -int psb_destroy(psb_t *self); - -/** - * @brief Append the given string to the buffered string of the given - * string builder. - * @param self Where to append the string. - * @param str String to append. - * @return \c 0 on success, a number > 0 otherwise. - */ -int psb_add_str(psb_t *self, const char *str); - -/** - * @brief Append the given character to the buffered string of the given - * string builder. - * @param self Where to append the character. - * @param c Character to append. - * @return \c 0 on success, a number > 0 otherwise. - */ -int psb_add_char(psb_t *self, char c); - -/** - * @brief Free the allocated string buffer area of the given string builder, - * allocate a new one with a default initial size and set its length to \c 0. - * @param self String builder to free. - * @return \c 0 on success, a number > 0 otherwise. - */ -int psb_clear(psb_t *self); - -/** - * @brief Set the length of the buffered string of the given string builder - * to the given length and append \c '\0'. - * @param self String builder to truncate. - * @param len The new length of the buffered string. If it is bigger than - * its current length, this function is a no-op. - * @return \c 0 on success, a number > 0 otherwise. - */ -int psb_truncate(psb_t *self, size_t len); - -/** - * @brief Get the length of the buffered string of the given string builder. - * @param self String builder to query. - * @return The length of the buffered string. - */ -size_t psb_len(psb_t *self); - -/** - * @brief Get a copy of the buffered string of the given string builder. - * @param self String builder to ask. - * @return Metric as string in Prometheus exposition format. - * @note The returned string must be freed when no longer needed. - */ -char *psb_dump(psb_t *self); - -/** - * @brief Get a reference to the buffered string. One should **NOT** modify - * the string, treat it as a read-only and never ever free() it, otherwise - * be prepared for buffer overflows and core dumps. It has been made public - * solely to avoid the strdup() overhead of \c psb_dump(). - * @return a string, or \c NULL if not initialized yet. - */ -char *psb_str(psb_t *self); - -#endif // PROM_STRING_BUILDER_I_H diff --git a/prom/src/prom_collector.c b/prom/src/prom_collector.c index b19d29f..c25349c 100644 --- a/prom/src/prom_collector.c +++ b/prom/src/prom_collector.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,124 +15,251 @@ */ #include <stdio.h> -#include <unistd.h> -#include <sys/sysinfo.h> // Public #include "prom_alloc.h" #include "prom_collector.h" +#include "prom_collector_registry.h" // Private +#include "prom_assert.h" #include "prom_collector_t.h" #include "prom_log.h" +#include "prom_map_i.h" #include "prom_metric_i.h" -#include "prom_string_builder.h" +#include "prom_process_fds_i.h" +#include "prom_process_fds_t.h" +#include "prom_process_limits_i.h" +#include "prom_process_limits_t.h" +#include "prom_process_stat_i.h" +#include "prom_process_stat_t.h" +#include "prom_string_builder_i.h" -prom_map_t * -prom_collector_metrics_get(prom_collector_t *self) { - return self->metrics; -} +prom_map_t *prom_collector_default_collect(prom_collector_t *self) { return self->metrics; } -prom_collector_t * -prom_collector_new(const char *name) { - prom_collector_t *self = (prom_collector_t *) - prom_malloc(sizeof(prom_collector_t)); - if (self == NULL) - return NULL; - - self->name = prom_strdup(name); - self->data = NULL; - self->free_data_fn = NULL; - self->collect_fn = &prom_collector_metrics_get; - self->string_builder = NULL; - - self->metrics = prom_map_new(); - if (self->metrics == NULL) - goto fail; - if (prom_map_set_free_value_fn(self->metrics, &prom_metric_free_generic)) - goto fail; - if ((self->string_builder = psb_new()) == NULL) - goto fail; - return self; - -fail: +prom_collector_t *prom_collector_new(const char *name) { + int r = 0; + prom_collector_t *self = (prom_collector_t *)prom_malloc(sizeof(prom_collector_t)); + self->name = prom_strdup(name); + self->metrics = prom_map_new(); + if (self->metrics == NULL) { + prom_collector_destroy(self); + return NULL; + } + r = prom_map_set_free_value_fn(self->metrics, &prom_metric_free_generic); + if (r) { prom_collector_destroy(self); return NULL; + } + self->collect_fn = &prom_collector_default_collect; + self->string_builder = prom_string_builder_new(); + if (self->string_builder == NULL) { + prom_collector_destroy(self); + return NULL; + } + self->proc_limits_file_path = NULL; + self->proc_stat_file_path = NULL; + return self; } -int -prom_collector_destroy(prom_collector_t *self) { - if (self == NULL) - return 0; - - int r = 0; - - self->collect_fn = NULL; - if (self->free_data_fn != NULL) { - self->free_data_fn(self); - self->free_data_fn = NULL; - } - self->data = NULL; - r += prom_map_destroy(self->metrics); - self->metrics = NULL; - r += psb_destroy(self->string_builder); - self->string_builder = NULL; - prom_free((char *)self->name); - self->name = NULL; - prom_free(self); - return r; +int prom_collector_destroy(prom_collector_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + + int r = 0; + int ret = 0; + + r = prom_map_destroy(self->metrics); + if (r) ret = r; + self->metrics = NULL; + + r = prom_string_builder_destroy(self->string_builder); + if (r) ret = r; + self->string_builder = NULL; + + prom_free((char *)self->name); + self->name = NULL; + prom_free(self); + self = NULL; + + return ret; } -int -prom_collector_destroy_generic(void *gen) { - if (gen == NULL) - return 0; - prom_collector_t *self = (prom_collector_t *)gen; - return prom_collector_destroy(self); +int prom_collector_destroy_generic(void *gen) { + int r = 0; + prom_collector_t *self = (prom_collector_t *)gen; + r = prom_collector_destroy(self); + self = NULL; + return r; } -void -prom_collector_free_generic(void *gen) { - if (gen == NULL) - return; - prom_collector_t *self = (prom_collector_t *)gen; - prom_collector_destroy(self); +void prom_collector_free_generic(void *gen) { + prom_collector_t *self = (prom_collector_t *)gen; + prom_collector_destroy(self); } -int -prom_collector_set_collect_fn(prom_collector_t *self, prom_collect_fn *fn) { - if (self == NULL) - return 1; - self->collect_fn = fn; - return 0; +int prom_collector_set_collect_fn(prom_collector_t *self, prom_collect_fn *fn) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + self->collect_fn = fn; + return 0; } -int -prom_collector_add_metric(prom_collector_t *self, prom_metric_t *metric) { - if (self == NULL) - return 0; - if (prom_map_get(self->metrics, metric->name) != NULL) { - PROM_LOG("metric already found in collector"); - return 1; - } - return prom_map_set(self->metrics, metric->name, metric); +int prom_collector_add_metric(prom_collector_t *self, prom_metric_t *metric) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (prom_map_get(self->metrics, metric->name) != NULL) { + PROM_LOG("metric already found in collector"); + return 1; + } + return prom_map_set(self->metrics, metric->name, metric); } -void * -prom_collector_data_set(prom_collector_t *self, void *data, - prom_collector_free_data_fn *fn) -{ - if (self == NULL) - return NULL; - void *old = self->data; - self->data = data; - self->free_data_fn = fn; - return old; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Process Collector + +prom_map_t *prom_collector_process_collect(prom_collector_t *self); + +prom_collector_t *prom_collector_process_new(const char *limits_path, const char *stat_path) { + prom_collector_t *self = prom_collector_new("process"); + PROM_ASSERT(self != NULL); + if (self == NULL) return NULL; + + int r = 0; + + self->proc_limits_file_path = limits_path; + self->proc_stat_file_path = stat_path; + self->collect_fn = &prom_collector_process_collect; + + r = prom_process_limits_init(); + if (r) return NULL; + + r = prom_process_stats_init(); + if (r) return NULL; + + r = prom_process_fds_init(); + if (r) return NULL; + + r = prom_collector_add_metric(self, prom_process_max_fds); + if (r) return NULL; + + r = prom_collector_add_metric(self, prom_process_virtual_memory_max_bytes); + if (r) return NULL; + + r = prom_collector_add_metric(self, prom_process_cpu_seconds_total); + if (r) return NULL; + + r = prom_collector_add_metric(self, prom_process_virtual_memory_bytes); + if (r) return NULL; + + r = prom_collector_add_metric(self, prom_process_start_time_seconds); + if (r) return NULL; + + r = prom_collector_add_metric(self, prom_process_open_fds); + if (r) return NULL; + + return self; } -void * -prom_collector_data_get(prom_collector_t *self) { - if (self == NULL) - return NULL; - return self->data; +prom_map_t *prom_collector_process_collect(prom_collector_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return NULL; + + int r = 0; + + // Allocate and create a *prom_process_limits_file_t + prom_process_limits_file_t *limits_f = prom_process_limits_file_new(self->proc_limits_file_path); + if (limits_f == NULL) { + prom_process_limits_file_destroy(limits_f); + return NULL; + } + + // Allocate and create a *prom_map_t from prom_process_limits_file_t. This is the main storage container for the + // limits metric data + prom_map_t *limits_map = prom_process_limits(limits_f); + if (limits_map == NULL) { + prom_process_limits_file_destroy(limits_f); + prom_map_destroy(limits_map); + return NULL; + } + + // Retrieve the *prom_process_limits_row_t for Max open files + prom_process_limits_row_t *max_fds = (prom_process_limits_row_t *)prom_map_get(limits_map, "Max open files"); + if (max_fds == NULL) { + prom_process_limits_file_destroy(limits_f); + prom_map_destroy(limits_map); + return NULL; + } + + // Retrieve the *prom_process_limits_row_t for Max address space + prom_process_limits_row_t *virtual_memory_max_bytes = + (prom_process_limits_row_t *)prom_map_get(limits_map, "Max address space"); + if (virtual_memory_max_bytes == NULL) { + prom_process_limits_file_destroy(limits_f); + prom_map_destroy(limits_map); + return NULL; + } + + // Set the metric values for max_fds and virtual_memory_max_bytes + r = prom_gauge_set(prom_process_max_fds, max_fds->soft, NULL); + if (r) return NULL; + r = prom_gauge_set(prom_process_virtual_memory_max_bytes, virtual_memory_max_bytes->soft, NULL); + if (r) return NULL; + + // Aloocate and create a *prom_process_stat_file_t + prom_process_stat_file_t *stat_f = prom_process_stat_file_new(self->proc_stat_file_path); + if (stat_f == NULL) { + prom_process_limits_file_destroy(limits_f); + prom_map_destroy(limits_map); + return self->metrics; + } + + // Allocate and create a *prom_process_stat_t from *prom_process_stat_file_t + prom_process_stat_t *stat = prom_process_stat_new(stat_f); + + // Set the metrics related to the stat file + r = prom_gauge_set(prom_process_cpu_seconds_total, ((stat->cutime + stat->cstime) / 100), NULL); + if (r) { + prom_process_limits_file_destroy(limits_f); + prom_map_destroy(limits_map); + prom_process_stat_file_destroy(stat_f); + prom_process_stat_destroy(stat); + return NULL; + } + r = prom_gauge_set(prom_process_virtual_memory_bytes, stat->vsize, NULL); + if (r) { + prom_process_limits_file_destroy(limits_f); + prom_map_destroy(limits_map); + prom_process_stat_file_destroy(stat_f); + prom_process_stat_destroy(stat); + return NULL; + } + r = prom_gauge_set(prom_process_start_time_seconds, stat->starttime, NULL); + if (r) { + prom_process_limits_file_destroy(limits_f); + prom_map_destroy(limits_map); + prom_process_stat_file_destroy(stat_f); + prom_process_stat_destroy(stat); + return NULL; + } + r = prom_gauge_set(prom_process_open_fds, prom_process_fds_count(NULL), NULL); + if (r) { + prom_process_limits_file_destroy(limits_f); + prom_map_destroy(limits_map); + prom_process_stat_file_destroy(stat_f); + prom_process_stat_destroy(stat); + return NULL; + } + + // If there is any issue deallocating the following structures, return NULL to indicate failure + r = prom_process_limits_file_destroy(limits_f); + if (r) return NULL; + r = prom_map_destroy(limits_map); + if (r) return NULL; + r = prom_process_stat_file_destroy(stat_f); + if (r) return NULL; + r = prom_process_stat_destroy(stat); + if (r) return NULL; + + return self->metrics; } diff --git a/prom/src/prom_collector_registry.c b/prom/src/prom_collector_registry.c index c1d9a32..4c2bc2d 100644 --- a/prom/src/prom_collector_registry.c +++ b/prom/src/prom_collector_registry.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +17,11 @@ #include <pthread.h> #include <regex.h> #include <stdio.h> -#include <time.h> // Public #include "prom_alloc.h" #include "prom_collector.h" #include "prom_collector_registry.h" -#include "prom_gauge.h" // Private #include "prom_assert.h" @@ -37,273 +34,184 @@ #include "prom_metric_i.h" #include "prom_metric_t.h" #include "prom_process_limits_i.h" -#include "prom_string_builder.h" - -pcr_t *PROM_COLLECTOR_REGISTRY; - -pcr_t * -pcr_new(const char *name) { - pcr_t *self = (pcr_t *) prom_malloc(sizeof(pcr_t)); - if (self == NULL) - return NULL; - - self->features = 0; - self->scrape_duration = NULL; - self->mprefix = NULL; - - self->name = prom_strdup(name); - self->collectors = prom_map_new(); - if (self->collectors != NULL) { - prom_map_set_free_value_fn(self->collectors, - &prom_collector_free_generic); - prom_map_set(self->collectors, COLLECTOR_NAME_DEFAULT, - prom_collector_new(COLLECTOR_NAME_DEFAULT)); - } - - self->metric_formatter = pmf_new(); - self->string_builder = psb_new(); - self->lock = (pthread_rwlock_t *) prom_malloc(sizeof(pthread_rwlock_t)); - if (pthread_rwlock_init(self->lock, NULL) != 0 || self->name == NULL - || self->collectors == NULL || self->metric_formatter == 0 - || self->string_builder == NULL) - { - PROM_WARN("failed to initialize rwlock for pcr '%s'", name); - pcr_destroy(self); - return NULL; - } - return self; -} +#include "prom_string_builder_i.h" -int -pcr_enable_process_metrics(pcr_t *self) { - if (self == NULL) - return 0; - - const char *cname = COLLECTOR_NAME_PROCESS; - if (prom_map_get(self->collectors, cname) != NULL) { - PROM_WARN("A collector named '%s' is already registered.", cname); - return 1; - } - prom_collector_t *c = ppc_new(NULL, NULL, 0, NULL, NULL); - if (c == NULL) - return 2; - if (prom_map_set(self->collectors, cname, c) != 0) { - return 3; - } - - self->features |= PROM_PROCESS; - return 0; -} +prom_collector_registry_t *PROM_COLLECTOR_REGISTRY_DEFAULT; + +prom_collector_registry_t *prom_collector_registry_new(const char *name) { + int r = 0; + + prom_collector_registry_t *self = (prom_collector_registry_t *)prom_malloc(sizeof(prom_collector_registry_t)); -int -pcr_enable_scrape_metrics(pcr_t *self) { - const char *mname = METRIC_NAME_SCRAPE; - if (self == NULL) - return 1; - - prom_gauge_t *g = prom_gauge_new(mname, "Duration of a collector scrape", - 1, (const char *[]) {"collector"}); - if (g == NULL) - return 1; - self->scrape_duration = g; - self->features |= PROM_SCRAPETIME; - return 0; + self->disable_process_metrics = false; + + self->name = prom_strdup(name); + self->collectors = prom_map_new(); + prom_map_set_free_value_fn(self->collectors, &prom_collector_free_generic); + prom_map_set(self->collectors, "default", prom_collector_new("default")); + + self->metric_formatter = prom_metric_formatter_new(); + self->string_builder = prom_string_builder_new(); + self->lock = (pthread_rwlock_t *)prom_malloc(sizeof(pthread_rwlock_t)); + r = pthread_rwlock_init(self->lock, NULL); + if (r) { + PROM_LOG("failed to initialize rwlock"); + return NULL; + } + return self; } -int -pcr_enable_custom_process_metrics(pcr_t *self, const char *limits_path, - const char *stats_path) -{ - const char *cname = COLLECTOR_NAME_PROCESS; - if (self == NULL) { - PROM_WARN("pcr_t is NULL", ""); - return 1; - } - prom_collector_t *c = pcr_get(self, cname); - if (c != NULL) { - PROM_WARN("The registry '%s' already contains a '%s' collector.", - self->name, cname); - return 1; - } - c = ppc_new(limits_path, stats_path, 0, NULL, NULL); - if (c == NULL) { - PROM_WARN("Failed to create a new '%s' collector from '%s' and '%s'.", - cname, limits_path, stats_path); - return 1; - } - - if (prom_map_set(self->collectors, cname, c) != 0) { - prom_collector_destroy(c); - return 1; - } - self->features |= PROM_PROCESS; +int prom_collector_registry_enable_process_metrics(prom_collector_registry_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + prom_collector_t *process_collector = prom_collector_process_new(NULL, NULL); + if (process_collector) { + prom_map_set(self->collectors, "process", process_collector); return 0; + } + return 1; } -int -pcr_init(PROM_INIT_FLAGS features, const char *mprefix) { - int err = 0; - - const char *cname = REGISTRY_NAME_DEFAULT; - - if (PROM_COLLECTOR_REGISTRY != NULL) { - PROM_WARN("The registry '%s' is already set as default registry.", - PROM_COLLECTOR_REGISTRY->name); - return 1; - } - - PROM_COLLECTOR_REGISTRY = pcr_new(cname); - if (PROM_COLLECTOR_REGISTRY == NULL) - return 1; - - if (features & PROM_PROCESS) - err += pcr_enable_process_metrics(PROM_COLLECTOR_REGISTRY); - if (features & PROM_SCRAPETIME_ALL) - features |= PROM_SCRAPETIME; - if ((err == 0) && (features & PROM_SCRAPETIME)) - err += pcr_enable_scrape_metrics(PROM_COLLECTOR_REGISTRY); - if (err) { - pcr_destroy(PROM_COLLECTOR_REGISTRY); - PROM_COLLECTOR_REGISTRY = NULL; - } else { - if (features & PROM_SCRAPETIME_ALL) - PROM_COLLECTOR_REGISTRY->features |= PROM_SCRAPETIME_ALL; - if (features & PROM_COMPACT) - PROM_COLLECTOR_REGISTRY->features |= PROM_COMPACT; - PROM_COLLECTOR_REGISTRY->mprefix = (mprefix==NULL||strlen(mprefix) == 0) - ? NULL - : prom_strdup(mprefix); - } - - return err; +int prom_collector_registry_enable_custom_process_metrics(prom_collector_registry_t *self, + const char *process_limits_path, + const char *process_stats_path) { + PROM_ASSERT(self != NULL); + if (self == NULL) { + PROM_LOG("prom_collector_registry_t is NULL"); + return 1; + } + prom_collector_t *process_collector = prom_collector_process_new(process_limits_path, process_stats_path); + if (process_collector) { + prom_map_set(self->collectors, "process", process_collector); + return 0; + } + return 1; } -int -pcr_default_init(void) { - return pcr_init(PROM_PROCESS | PROM_SCRAPETIME, METRIC_LABEL_SCRAPE "_"); -} +int prom_collector_registry_default_init(void) { + if (PROM_COLLECTOR_REGISTRY_DEFAULT != NULL) return 0; -int -pcr_destroy(pcr_t *self) { - if (self == NULL) - return 0; - - if (PROM_COLLECTOR_REGISTRY == self) - PROM_COLLECTOR_REGISTRY = NULL; - int err = prom_map_destroy(self->collectors); - err += prom_gauge_destroy(self->scrape_duration); - err += pmf_destroy(self->metric_formatter); - err += psb_destroy(self->string_builder); - err += pthread_rwlock_destroy(self->lock); - prom_free(self->lock); - if (self->mprefix != NULL) - prom_free((char *) self->mprefix); - prom_free((char *)self->name); - prom_free(self); - return err; + PROM_COLLECTOR_REGISTRY_DEFAULT = prom_collector_registry_new("default"); + if (PROM_COLLECTOR_REGISTRY_DEFAULT) { + return prom_collector_registry_enable_process_metrics(PROM_COLLECTOR_REGISTRY_DEFAULT); + } + return 1; } -int -pcr_register_metric(prom_metric_t *metric) { - PROM_ASSERT(metric != NULL); +int prom_collector_registry_destroy(prom_collector_registry_t *self) { + if (self == NULL) return 0; - prom_collector_t *default_collector = (prom_collector_t *) - prom_map_get(PROM_COLLECTOR_REGISTRY->collectors, - COLLECTOR_NAME_DEFAULT); + int r = 0; + int ret = 0; - if (default_collector == NULL) - return 1; + r = prom_map_destroy(self->collectors); + self->collectors = NULL; + if (r) ret = r; - return prom_collector_add_metric(default_collector, metric); -} + r = prom_metric_formatter_destroy(self->metric_formatter); + self->metric_formatter = NULL; + if (r) ret = r; + + r = prom_string_builder_destroy(self->string_builder); + self->string_builder = NULL; + if (r) ret = r; + + r = pthread_rwlock_destroy(self->lock); + prom_free(self->lock); + self->lock = NULL; + if (r) ret = r; + + prom_free((char *)self->name); + self->name = NULL; -prom_metric_t * -pcr_must_register_metric(prom_metric_t *metric) { - if (pcr_register_metric(metric)) - exit(1); - return metric; + prom_free(self); + self = NULL; + + return ret; } -int -pcr_register_collector(pcr_t *self, prom_collector_t *collector) { - int ret = 1; - if (self == NULL) - return 1; - - if (pthread_rwlock_wrlock(self->lock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_LOCK_ERROR, NULL); - return 2; - } - if (prom_map_get(self->collectors, collector->name) != NULL) { - PROM_WARN("The prom_collector '%s' is already registered - skipping.", - collector->name); - goto end; - } - if (prom_map_set(self->collectors, collector->name, collector)) - goto end; - - ret = 0; - -end: - if (pthread_rwlock_unlock(self->lock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - return 1; - } - return ret; +int prom_collector_registry_register_metric(prom_metric_t *metric) { + PROM_ASSERT(metric != NULL); + + prom_collector_t *default_collector = + (prom_collector_t *)prom_map_get(PROM_COLLECTOR_REGISTRY_DEFAULT->collectors, "default"); + + if (default_collector == NULL) { + return 1; + } + + return prom_collector_add_metric(default_collector, metric); } -prom_collector_t * -pcr_get(pcr_t *self, const char *name) { - return (self == NULL || name == NULL) - ? NULL - : prom_map_get(self->collectors, name); +prom_metric_t *prom_collector_registry_must_register_metric(prom_metric_t *metric) { + int err = prom_collector_registry_register_metric(metric); + if (err != 0) { + exit(err); + } + return metric; } -int -pcr_validate_metric_name(pcr_t *self, const char *metric_name) { - return pcr_check_name(metric_name, 0); +int prom_collector_registry_register_collector(prom_collector_registry_t *self, prom_collector_t *collector) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + + int r = 0; + + r = pthread_rwlock_wrlock(self->lock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_LOCK_ERROR); + return 1; + } + if (prom_map_get(self->collectors, collector->name) != NULL) { + PROM_LOG("the given prom_collector_t* is already registered"); + int rr = pthread_rwlock_unlock(self->lock); + if (rr) { + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); + return rr; + } else { + return 1; + } + } + r = prom_map_set(self->collectors, collector->name, collector); + if (r) { + int rr = pthread_rwlock_unlock(self->lock); + if (rr) { + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); + return rr; + } else { + return r; + } + } + r = pthread_rwlock_unlock(self->lock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); + return 1; + } + return 0; } -int -pcr_check_name(const char *name, bool is_label) { - regex_t r; - int ret; - const char *regex = is_label - ? "^[a-zA-Z_][a-zA-Z0-9_]*$" - : "^[a-zA-Z_:][a-zA-Z0-9_:]*$"; - ret = regcomp(&r, regex, REG_NOSUB); - ret += regexec(&r, name, 0, NULL, 0); - regfree(&r); - return ret; +int prom_collector_registry_validate_metric_name(prom_collector_registry_t *self, const char *metric_name) { + regex_t r; + int ret = 0; + ret = regcomp(&r, "^[a-zA-Z_:][a-zA-Z0-9_:]*$", REG_EXTENDED); + if (ret) { + PROM_LOG(PROM_REGEX_REGCOMP_ERROR); + regfree(&r); + return ret; + } + + ret = regexec(&r, metric_name, 0, NULL, 0); + if (ret) { + PROM_LOG(PROM_REGEX_REGEXEC_ERROR); + regfree(&r); + return ret; + } + regfree(&r); + return 0; } -char * -pcr_bridge(pcr_t *self) { - if (self == NULL) - return strdup("# pcr_bridge(NULL)"); - - struct timespec start, end; - static const char *labels[] = { METRIC_LABEL_SCRAPE }; - bool scrape = (self->scrape_duration != NULL) - && (self->features & PROM_SCRAPETIME); - bool compact = (self->features & PROM_COMPACT) ? true : false; - - if (scrape) - clock_gettime(CLOCK_MONOTONIC, &start); - - pmf_clear(self->metric_formatter); - pmf_load_metrics(self->metric_formatter, self->collectors, - (self->features & PROM_SCRAPETIME_ALL) ? self->scrape_duration : NULL, - self->mprefix, compact); - - if (scrape) { - int r = clock_gettime(CLOCK_MONOTONIC, &end); - time_t s = (r == 0) ? end.tv_sec - start.tv_sec : 0; - long ns = (r == 0) ? end.tv_nsec - start.tv_nsec : 0; - double duration = s + ns*1e-9; - prom_gauge_set(self->scrape_duration, duration, labels); - pmf_load_metric(self->metric_formatter, self->scrape_duration, - self->mprefix, compact); - } - return pmf_dump(self->metric_formatter); +const char *prom_collector_registry_bridge(prom_collector_registry_t *self) { + prom_metric_formatter_clear(self->metric_formatter); + prom_metric_formatter_load_metrics(self->metric_formatter, self->collectors); + return (const char *)prom_metric_formatter_dump(self->metric_formatter); } diff --git a/prom/src/prom_collector_registry_i.h b/prom/src/prom_collector_registry_i.h index 022f35e..3cd35ce 100644 --- a/prom/src/prom_collector_registry_i.h +++ b/prom/src/prom_collector_registry_i.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +19,8 @@ #ifndef PROM_COLLECTOR_REGISTRY_I_INCLUDED #define PROM_COLLECTOR_REGISTRY_I_INCLUDED -int pcr_enable_custom_process_metrics(pcr_t *self, const char *process_limits_path, const char *process_stats_path); +int prom_collector_registry_enable_custom_process_metrics(prom_collector_registry_t *self, + const char *process_limits_path, + const char *process_stats_path); #endif // PROM_COLLECTOR_REGISTRY_I_INCLUDED diff --git a/prom/src/prom_collector_registry_t.h b/prom/src/prom_collector_registry_t.h index e559ee4..4bca14d 100644 --- a/prom/src/prom_collector_registry_t.h +++ b/prom/src/prom_collector_registry_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,17 +26,15 @@ // Private #include "prom_map_t.h" #include "prom_metric_formatter_t.h" -#include "prom_string_builder.h" +#include "prom_string_builder_t.h" -struct pcr { - const char *name; /**< name of the registry. Do not modify! */ - const char *mprefix; /**< prefix each metric name with this */ - PROM_INIT_FLAGS features; /**< enabled registry features */ - prom_metric_t *scrape_duration; /**< scrape duration metric to use */ - prom_map_t *collectors; /**< Map of collectors keyed by name */ - psb_t *string_builder; /**< string building */ - pmf_t *metric_formatter; /**< export metric(s) */ - pthread_rwlock_t *lock; /**< mutex to guard concurrent modfications */ +struct prom_collector_registry { + const char *name; + bool disable_process_metrics; /**< Disables the collection of process metrics */ + prom_map_t *collectors; /**< Map of collectors keyed by name */ + prom_string_builder_t *string_builder; /**< Enables string building */ + prom_metric_formatter_t *metric_formatter; /**< metric formatter for metric exposition on bridge call */ + pthread_rwlock_t *lock; /**< mutex for safety against concurrent registration */ }; #endif // PROM_REGISTRY_T_H diff --git a/prom/src/prom_collector_t.h b/prom/src/prom_collector_t.h index 869fcb1..db9aab6 100644 --- a/prom/src/prom_collector_t.h +++ b/prom/src/prom_collector_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,15 +19,15 @@ #include "prom_collector.h" #include "prom_map_t.h" -#include "prom_string_builder.h" +#include "prom_string_builder_t.h" struct prom_collector { - const char *name; - prom_map_t *metrics; - prom_collect_fn *collect_fn; - psb_t *string_builder; - void *data; - prom_collector_free_data_fn *free_data_fn; + const char *name; + prom_map_t *metrics; + prom_collect_fn *collect_fn; + prom_string_builder_t *string_builder; + const char *proc_limits_file_path; + const char *proc_stat_file_path; }; #endif // PROM_COLLECTOR_T_H diff --git a/prom/src/prom_counter.c b/prom/src/prom_counter.c index 7cbe989..01dc438 100644 --- a/prom/src/prom_counter.c +++ b/prom/src/prom_counter.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,55 +28,39 @@ #include "prom_metric_sample_t.h" #include "prom_metric_t.h" -prom_counter_t * -prom_counter_new(const char *name, const char *help, size_t label_key_count, - const char **label_keys) -{ - return (prom_counter_t *) - prom_metric_new(PROM_COUNTER, name, help, label_key_count, label_keys); +prom_counter_t *prom_counter_new(const char *name, const char *help, size_t label_key_count, const char **label_keys) { + return (prom_counter_t *)prom_metric_new(PROM_COUNTER, name, help, label_key_count, label_keys); } -int -prom_counter_destroy(prom_counter_t *self) { - return (self == NULL) ? 0 : prom_metric_destroy(self); +int prom_counter_destroy(prom_counter_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + int r = 0; + r = prom_metric_destroy(self); + self = NULL; + return r; } -int -prom_counter_inc(prom_counter_t *self, const char **label_vals) { - if (self == NULL) - return 1; - if (self->type != PROM_COUNTER) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_t *s = pms_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_add(s, 1.0); +int prom_counter_inc(prom_counter_t *self, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->type != PROM_COUNTER) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + prom_metric_sample_t *sample = prom_metric_sample_from_labels(self, label_values); + if (sample == NULL) return 1; + return prom_metric_sample_add(sample, 1.0); } -int -prom_counter_add(prom_counter_t *self, double r_value, const char **label_vals) -{ - if (self == NULL) - return 1; - if (self->type != PROM_COUNTER) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_t *s = pms_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_add(s, r_value); -} - -int -prom_counter_reset(prom_counter_t *self, double r_value, const char **label_vals) { - if (self == NULL) - return 1; - if (self->type != PROM_COUNTER) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_t *s = pms_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_set(s, r_value); // pms_set handles vals < 0 +int prom_counter_add(prom_counter_t *self, double r_value, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->type != PROM_COUNTER) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + prom_metric_sample_t *sample = prom_metric_sample_from_labels(self, label_values); + if (sample == NULL) return 1; + return prom_metric_sample_add(sample, r_value); } diff --git a/prom/src/prom_gauge.c b/prom/src/prom_gauge.c index d232f0c..d9fe845 100644 --- a/prom/src/prom_gauge.c +++ b/prom/src/prom_gauge.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,80 +28,74 @@ #include "prom_metric_sample_t.h" #include "prom_metric_t.h" -prom_gauge_t * -prom_gauge_new(const char *name, const char *help, size_t label_key_count, - const char **label_keys) -{ - return (prom_gauge_t *) - prom_metric_new(PROM_GAUGE, name, help, label_key_count, label_keys); +prom_gauge_t *prom_gauge_new(const char *name, const char *help, size_t label_key_count, const char **label_keys) { + return (prom_gauge_t *)prom_metric_new(PROM_GAUGE, name, help, label_key_count, label_keys); } -int -prom_gauge_destroy(prom_gauge_t *self) { - return (self == NULL) ? 0 : prom_metric_destroy(self); +int prom_gauge_destroy(prom_gauge_t *self) { + PROM_ASSERT(self != NULL); + int r = 0; + r = prom_metric_destroy(self); + self = NULL; + return r; } -int -prom_gauge_inc(prom_gauge_t *self, const char **label_vals) { - if (self == NULL) - return 1; - if (self->type != PROM_GAUGE) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_t *s = pms_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_add(s, 1.0); +int prom_gauge_inc(prom_gauge_t *self, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->type != PROM_GAUGE) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + prom_metric_sample_t *sample = prom_metric_sample_from_labels(self, label_values); + if (sample == NULL) return 1; + return prom_metric_sample_add(sample, 1.0); } -int -prom_gauge_dec(prom_gauge_t *self, const char **label_vals) { - if (self == NULL) - return 1; - if (self->type != PROM_GAUGE) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_t *s = pms_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_sub(s, 1.0); +int prom_gauge_dec(prom_gauge_t *self, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->type != PROM_GAUGE) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + prom_metric_sample_t *sample = prom_metric_sample_from_labels(self, label_values); + if (sample == NULL) return 1; + return prom_metric_sample_sub(sample, 1.0); } -int -prom_gauge_add(prom_gauge_t *self, double r_value, const char **label_vals) { - if (self == NULL) - return 1; - if (self->type != PROM_GAUGE) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_t *s = pms_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_add(s, r_value); +int prom_gauge_add(prom_gauge_t *self, double r_value, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->type != PROM_GAUGE) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + prom_metric_sample_t *sample = prom_metric_sample_from_labels(self, label_values); + if (sample == NULL) return 1; + return prom_metric_sample_add(sample, r_value); } -int -prom_gauge_sub(prom_gauge_t *self, double r_value, const char **label_vals) { - if (self == NULL) - return 1; - if (self->type != PROM_GAUGE) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_t *s = pms_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_sub(s, r_value); +int prom_gauge_sub(prom_gauge_t *self, double r_value, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->type != PROM_GAUGE) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + prom_metric_sample_t *sample = prom_metric_sample_from_labels(self, label_values); + if (sample == NULL) return 1; + return prom_metric_sample_sub(sample, r_value); } -int -prom_gauge_set(prom_gauge_t *self, double r_value, const char **label_vals) { - if (self == NULL) - return 1; - if (self->type != PROM_GAUGE) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_t *s = pms_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_set(s, r_value); +int prom_gauge_set(prom_gauge_t *self, double r_value, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->type != PROM_GAUGE) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + prom_metric_sample_t *sample = prom_metric_sample_from_labels(self, label_values); + if (sample == NULL) return 1; + return prom_metric_sample_set(sample, r_value); } diff --git a/prom/src/prom_histogram.c b/prom/src/prom_histogram.c index 725c68f..49fdcc1 100644 --- a/prom/src/prom_histogram.c +++ b/prom/src/prom_histogram.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,48 +30,50 @@ #include "prom_metric_sample_histogram_t.h" #include "prom_metric_t.h" -prom_histogram_t * -prom_histogram_new(const char *name, const char *help, phb_t *buckets, - size_t label_key_count, const char **label_keys) -{ - prom_histogram_t *self = (prom_histogram_t *) - prom_metric_new(PROM_HISTOGRAM,name, help, label_key_count, label_keys); - if (buckets == NULL) { - if (prom_histogram_default_buckets == NULL) { - prom_histogram_default_buckets = phb_new(11, 0.005, 0.01, 0.025, - 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0); - } - self->buckets = prom_histogram_default_buckets; - } else { - // Ensure the bucket values are increasing - for (int i = 1; i < buckets->count; i++) { - if (buckets->upper_bound[i - 1] > buckets->upper_bound[i] - || buckets->key[i] == NULL) - { - return NULL; - } - } - self->buckets = buckets; - } - return self; +prom_histogram_t *prom_histogram_new(const char *name, const char *help, prom_histogram_buckets_t *buckets, + size_t label_key_count, const char **label_keys) { + prom_histogram_t *self = (prom_histogram_t *)prom_metric_new(PROM_HISTOGRAM, name, help, label_key_count, label_keys); + if (buckets == NULL) { + if (!prom_histogram_default_buckets) { + prom_histogram_default_buckets = prom_histogram_buckets_new(11, + 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0); + } + self->buckets = prom_histogram_default_buckets; + } else { + // Ensure the bucket values are increasing + for (int i = 0; i < buckets->count; i++) { + if (i == 0) { + continue; + } + if (buckets->upper_bounds[i - 1] > buckets->upper_bounds[i]) { + return NULL; + } + } + self->buckets = buckets; + } + return self; } -int -prom_histogram_destroy(prom_histogram_t *self) { - return (self == NULL) ? 0 : prom_metric_destroy(self); +int prom_histogram_destroy(prom_histogram_t *self) { + PROM_ASSERT(self != NULL); + + int r = 0; + + if (self == NULL) return r; + r = prom_metric_destroy(self); + if (r) return r; + self = NULL; + return r; } -int -prom_histogram_observe(prom_histogram_t *self, double val, - const char **label_vals) -{ - if (self == NULL) - return 1; - if (self->type != PROM_HISTOGRAM) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s", - self->type, self->name); - return 1; - } - pms_histogram_t *s = pms_histogram_from_labels(self, label_vals); - return (s == NULL) ? 1 : pms_histogram_observe(s, val); +int prom_histogram_observe(prom_histogram_t *self, double value, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->type != PROM_HISTOGRAM) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + prom_metric_sample_histogram_t *h_sample = prom_metric_sample_histogram_from_labels(self, label_values); + if (h_sample == NULL) return 1; + return prom_metric_sample_histogram_observe(h_sample, value); } diff --git a/prom/src/prom_histogram_buckets.c b/prom/src/prom_histogram_buckets.c index b44b04d..0fee6e0 100644 --- a/prom/src/prom_histogram_buckets.c +++ b/prom/src/prom_histogram_buckets.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,134 +25,79 @@ #include "prom_assert.h" #include "prom_log.h" -phb_t *prom_histogram_default_buckets = NULL; +prom_histogram_buckets_t *prom_histogram_default_buckets = NULL; -static char * -double_to_str(double value) { - char buf[32]; - int len = sprintf(buf, "%.17g", value); - if (!strchr(buf, '.') && len < 30) { - buf[len] = '.'; buf[len+1] = '0'; len += 2; buf[len] = '\0'; - } - return strdup(buf); +prom_histogram_buckets_t *prom_histogram_buckets_new(size_t count, double bucket, ...) { + prom_histogram_buckets_t *self = (prom_histogram_buckets_t *)prom_malloc(sizeof(prom_histogram_buckets_t)); + self->count = count; + double *upper_bounds = (double *)prom_malloc(sizeof(double) * count); + upper_bounds[0] = bucket; + if (count == 1) { + self->upper_bounds = upper_bounds; + return self; + } + va_list arg_list; + va_start(arg_list, bucket); + for (int i = 1; i < count; i++) { + upper_bounds[i] = va_arg(arg_list, double); + } + va_end(arg_list); + self->upper_bounds = upper_bounds; + return self; } -phb_t * -phb_new(size_t count, double bucket, ...) { - phb_t *self = (phb_t *) prom_malloc(sizeof(phb_t)); - if (self == NULL) - return NULL; +prom_histogram_buckets_t *prom_histogram_buckets_linear(double start, double width, size_t count) { + if (count <= 1) return NULL; - self->count = count; - self->upper_bound = NULL; - self->key = NULL; - double *upper_bounds = (double *) prom_malloc(sizeof(double) * count); - const char **keys = (const char **) prom_malloc(sizeof(char *) * count); - if (upper_bounds == NULL || keys == NULL) { - phb_destroy(self); - return NULL; - } - upper_bounds[0] = bucket; - keys[0] = double_to_str(bucket); - if (count == 1) { - self->upper_bound = upper_bounds; - self->key = keys; - return self; - } - va_list arg_list; - va_start(arg_list, bucket); - for (int i = 1; i < count; i++) { - upper_bounds[i] = va_arg(arg_list, double); - keys[i] = double_to_str(upper_bounds[i]); - } - va_end(arg_list); - self->upper_bound = upper_bounds; - self->key = keys; - return self; -} - -phb_t * -phb_linear(double start, double width, size_t count) { - if (count <= 1) { - PROM_WARN("count must be greater than %d", 1); - return NULL; - } + prom_histogram_buckets_t *self = (prom_histogram_buckets_t *)prom_malloc(sizeof(prom_histogram_buckets_t)); - phb_t *self = (phb_t *) prom_malloc(sizeof(phb_t)); - if (self == NULL) - return NULL; - self->upper_bound = NULL; - self->key = NULL; - double *upper_bounds = (double *) prom_malloc(sizeof(double) * count); - const char **keys = (const char **) prom_malloc(sizeof(char *) * count); - if (upper_bounds == NULL || keys == NULL) { - phb_destroy(self); - return NULL; - } - upper_bounds[0] = start; - keys[0] = double_to_str(start); - for (size_t i = 1; i < count; i++) { - upper_bounds[i] = upper_bounds[i - 1] + width; - keys[i] = double_to_str(upper_bounds[i]); - } - self->upper_bound = upper_bounds; - self->key = keys; - self->count = count; - return self; + double *upper_bounds = (double *)prom_malloc(sizeof(double) * count); + upper_bounds[0] = start; + for (size_t i = 1; i < count; i++) { + upper_bounds[i] = upper_bounds[i - 1] + width; + } + self->upper_bounds = upper_bounds; + self->count = count; + return self; } -phb_t * -phb_exponential(double start, double factor, size_t count) { - if (count < 1) { - PROM_WARN("count must be greater than or equal to %d", 1); - return NULL; - } - if (start <= 0) { - PROM_WARN("start must be greater than %d", 0); - return NULL; - } - if (factor <= 1) { - PROM_WARN("factor must be greater than %d", 1); - return NULL; - } +prom_histogram_buckets_t *prom_histogram_buckets_exponential(double start, double factor, size_t count) { + if (count < 1) { + PROM_LOG("count must be less than 1"); + return NULL; + } + if (start <= 0) { + PROM_LOG("start must be less than or equal to 0"); + return NULL; + } + if (factor <= 1) { + PROM_LOG("factor must be less than or equal to 1"); + return NULL; + } + + prom_histogram_buckets_t *self = (prom_histogram_buckets_t *)prom_malloc(sizeof(prom_histogram_buckets_t)); - phb_t *self = (phb_t *) prom_malloc(sizeof(phb_t)); - if (self == NULL) - return NULL; - self->upper_bound = NULL; - self->key = NULL; - double *upper_bounds = (double *) prom_malloc(sizeof(double) * count); - const char **keys = (const char **) prom_malloc(sizeof(char *) * count); - if (upper_bounds == NULL || keys == NULL) { - phb_destroy(self); - return NULL; - } - upper_bounds[0] = start; - keys[0] = double_to_str(start); - for (size_t i = 1; i < count; i++) { - upper_bounds[i] = upper_bounds[i - 1] * factor; - keys[i] = double_to_str(upper_bounds[i]); - } - self->upper_bound = upper_bounds; - self->key = keys; - self->count = count; - return self; + double *upper_bounds = (double *)prom_malloc(sizeof(double) * count); + upper_bounds[0] = start; + for (size_t i = 1; i < count; i++) { + upper_bounds[i] = upper_bounds[i - 1] * factor; + } + self->upper_bounds = upper_bounds; + self->count = count; + return self; } -int -phb_destroy(phb_t *self) { - if (self == NULL) - return 0; - for (int i=0; i < self->count; i++) - free((char *) self->key[i]); - prom_free((double *) self->upper_bound); - prom_free((char **) self->key); - prom_free(self); - return 0; +int prom_histogram_buckets_destroy(prom_histogram_buckets_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + prom_free((double *)self->upper_bounds); + self->upper_bounds = NULL; + prom_free(self); + self = NULL; + return 0; } -size_t -phb_count(phb_t *self) { - PROM_ASSERT(self != NULL); - return self->count; +size_t prom_histogram_buckets_count(prom_histogram_buckets_t *self) { + PROM_ASSERT(self != NULL); + return self->count; } diff --git a/prom/src/prom_linked_list.c b/prom/src/prom_linked_list.c index 0153c33..87d77eb 100644 --- a/prom/src/prom_linked_list.c +++ b/prom/src/prom_linked_list.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,203 +23,199 @@ #include "prom_linked_list_t.h" #include "prom_log.h" -pll_t * -pll_new(void) { - pll_t *self = (pll_t *) prom_malloc(sizeof(pll_t)); - if (self == NULL) - return NULL; - self->head = NULL; - self->tail = NULL; - self->free_fn = NULL; - self->compare_fn = NULL; - self->size = 0; - return self; +prom_linked_list_t *prom_linked_list_new(void) { + prom_linked_list_t *self = (prom_linked_list_t *)prom_malloc(sizeof(prom_linked_list_t)); + self->head = NULL; + self->tail = NULL; + self->free_fn = NULL; + self->compare_fn = NULL; + self->size = 0; + return self; } -int -pll_purge(pll_t *self) { - if (self == NULL) - return 1; - - pll_node_t *node = self->head; - while (node != NULL) { - pll_node_t *next = node->next; - if (node->item != NULL) { - if (self->free_fn) { - (*self->free_fn)(node->item); - } else { - prom_free(node->item); - } - } - prom_free(node); - node = NULL; - node = next; - } - self->head = NULL; - self->tail = NULL; - self->size = 0; - return 0; +int prom_linked_list_purge(prom_linked_list_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + prom_linked_list_node_t *node = self->head; + while (node != NULL) { + prom_linked_list_node_t *next = node->next; + if (node->item != NULL) { + if (self->free_fn) { + (*self->free_fn)(node->item); + } else { + prom_free(node->item); + } + } + prom_free(node); + node = NULL; + node = next; + } + self->head = NULL; + self->tail = NULL; + self->size = 0; + return 0; } -int -pll_destroy(pll_t *self) { - PROM_ASSERT(self != NULL); - pll_purge(self); - prom_free(self); - return 0; -} +int prom_linked_list_destroy(prom_linked_list_t *self) { + PROM_ASSERT(self != NULL); + int r = 0; + int ret = 0; -void * -pll_first(pll_t *self) { - PROM_ASSERT(self != NULL); - return (self->head) ? self->head->item : NULL; + r = prom_linked_list_purge(self); + if (r) ret = r; + prom_free(self); + self = NULL; + return ret; } -void * -pll_last(pll_t *self) { - PROM_ASSERT(self != NULL); - return (self->tail) ? self->tail->item : NULL; +void *prom_linked_list_first(prom_linked_list_t *self) { + PROM_ASSERT(self != NULL); + if (self->head) { + return self->head->item; + } else { + return NULL; + } } -int -pll_append(pll_t *self, void *item) { - if (self == NULL) - return 1; - pll_node_t *node = (pll_node_t *) prom_malloc(sizeof(pll_node_t)); - if (node == NULL) - return 2; - - node->item = item; - if (self->tail) { - self->tail->next = node; - } else { - self->head = node; - } - self->tail = node; - node->next = NULL; - self->size++; - return 0; +void *prom_linked_list_last(prom_linked_list_t *self) { + PROM_ASSERT(self != NULL); + if (self->tail) { + return self->tail->item; + } else { + return NULL; + } } -int -pll_push(pll_t *self, void *item) { - if (self == NULL) - return 1; - pll_node_t *node = (pll_node_t *) prom_malloc(sizeof(pll_node_t)); - if (node == NULL) - return 2; - - node->item = item; - node->next = self->head; - self->head = node; - if (self->tail == NULL) - self->tail = node; - self->size++; - return 0; +int prom_linked_list_append(prom_linked_list_t *self, void *item) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + prom_linked_list_node_t *node = (prom_linked_list_node_t *)prom_malloc(sizeof(prom_linked_list_node_t)); + + node->item = item; + if (self->tail) { + self->tail->next = node; + } else { + self->head = node; + } + self->tail = node; + node->next = NULL; + self->size++; + return 0; } -void * -pll_pop(pll_t *self) { - if (self == NULL) - return NULL; - pll_node_t *node = self->head; - if (node == NULL) - return NULL; - - void *item = node->item; - self->head = node->next; - if (self->tail == node) - self->tail = NULL; - if (node->item != NULL) { - if (self->free_fn) { - (*self->free_fn)(node->item); - } else { - prom_free(node->item); - } - } - node->item = NULL; - node = NULL; - self->size--; - return item; +int prom_linked_list_push(prom_linked_list_t *self, void *item) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + prom_linked_list_node_t *node = (prom_linked_list_node_t *)prom_malloc(sizeof(prom_linked_list_node_t)); + + node->item = item; + node->next = self->head; + self->head = node; + if (self->tail == NULL) { + self->tail = node; + } + self->size++; + return 0; } -int -pll_remove(pll_t *self, void *item) { - if (self == NULL) - return 1; - pll_node_t *node; - pll_node_t *prev_node = NULL; - - // Locate the node - for (node = self->head; node != NULL; node = node->next) { - if (self->compare_fn) { - if ((*self->compare_fn)(node->item, item) == PROM_EQUAL) - break; - } else if (node->item == item) { - break; - } - prev_node = node; - } - - if (node == NULL) - return 0; - - if (prev_node) { - prev_node->next = node->next; - } else { - self->head = node->next; - } - if (node->next == NULL) - self->tail = prev_node; - - if (node->item != NULL) { - if (self->free_fn) { - (*self->free_fn)(node->item); - } else { - prom_free(node->item); - } - } - - node->item = NULL; - prom_free(node); - node = NULL; - self->size--; - return 0; +void *prom_linked_list_pop(prom_linked_list_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return NULL; + prom_linked_list_node_t *node = self->head; + void *item = NULL; + if (node != NULL) { + item = node->item; + self->head = node->next; + if (self->tail == node) { + self->tail = NULL; + } + if (node->item != NULL) { + if (self->free_fn) { + (*self->free_fn)(node->item); + } else { + prom_free(node->item); + } + } + node->item = NULL; + node = NULL; + self->size--; + } + return item; } -pll_compare_t -pll_compare(pll_t *self, void *item_a, void *item_b) { - if (self == NULL) - return 1; - - return (self->compare_fn == NULL) - ? strcmp(item_a, item_b) - : (*self->compare_fn)(item_a, item_b); +int prom_linked_list_remove(prom_linked_list_t *self, void *item) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + prom_linked_list_node_t *node; + prom_linked_list_node_t *prev_node = NULL; + + // Locate the node + for (node = self->head; node != NULL; node = node->next) { + if (self->compare_fn) { + if ((*self->compare_fn)(node->item, item) == PROM_EQUAL) { + break; + } + } else { + if (node->item == item) { + break; + } + } + prev_node = node; + } + + if (node == NULL) return 0; + + if (prev_node) { + prev_node->next = node->next; + } else { + self->head = node->next; + } + if (node->next == NULL) { + self->tail = prev_node; + } + + if (node->item != NULL) { + if (self->free_fn) { + (*self->free_fn)(node->item); + } else { + prom_free(node->item); + } + } + + node->item = NULL; + prom_free(node); + node = NULL; + self->size--; + return 0; } -size_t -pll_size(pll_t *self) { - PROM_ASSERT(self != NULL); - return self->size; +prom_linked_list_compare_t prom_linked_list_compare(prom_linked_list_t *self, void *item_a, void *item_b) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (self->compare_fn) { + return (*self->compare_fn)(item_a, item_b); + } else { + return strcmp(item_a, item_b); + } } -int -pll_set_free_fn(pll_t *self, pll_free_item_fn free_fn) { - if (self == NULL) - return 1; - self->free_fn = free_fn; - return 0; +size_t prom_linked_list_size(prom_linked_list_t *self) { + PROM_ASSERT(self != NULL); + return self->size; } -int -pll_set_compare_fn(pll_t *self, pll_compare_item_fn compare_fn) { - if (self == NULL) - return 1; - self->compare_fn = compare_fn; - return 0; +int prom_linked_list_set_free_fn(prom_linked_list_t *self, prom_linked_list_free_item_fn free_fn) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + self->free_fn = free_fn; + return 0; } -void -pll_no_op_free(void *item) { - // no-op +int prom_linked_list_set_compare_fn(prom_linked_list_t *self, prom_linked_list_compare_item_fn compare_fn) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + self->compare_fn = compare_fn; + return 0; } + +void prom_linked_list_no_op_free(void *item) {} diff --git a/prom/src/prom_linked_list_i.h b/prom/src/prom_linked_list_i.h index 79c4ddf..a0ed1b6 100644 --- a/prom/src/prom_linked_list_i.h +++ b/prom/src/prom_linked_list_i.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,73 +21,74 @@ #include "prom_linked_list_t.h" /** - * @brief PRIVATE Returns a pointer to a pll + * @brief API PRIVATE Returns a pointer to a prom_linked_list */ -pll_t *pll_new(void); +prom_linked_list_t *prom_linked_list_new(void); /** - * @brief PRIVATE removes all nodes from the given pll * + * @brief API PRIVATE removes all nodes from the given prom_linked_list * */ -int pll_purge(pll_t *self); +int prom_linked_list_purge(prom_linked_list_t *self); /** - * @brief PRIVATE Destroys a pll + * @brief API PRIVATE Destroys a prom_linked_list */ -int pll_destroy(pll_t *self); +int prom_linked_list_destroy(prom_linked_list_t *self); /** - * @brief PRIVATE Append an item to the back of the list + * @brief API PRIVATE Append an item to the back of the list */ -int pll_append(pll_t *self, void *item); +int prom_linked_list_append(prom_linked_list_t *self, void *item); /** - * @brief PRIVATE Push an item onto the front of the list + * @brief API PRIVATE Push an item onto the front of the list */ -int pll_push(pll_t *self, void *item); +int prom_linked_list_push(prom_linked_list_t *self, void *item); /** - * @brief PRIVATE Pop the first item off of the list + * @brief API PRIVATE Pop the first item off of the list */ -void *pll_pop(pll_t *self); +void *prom_linked_list_pop(prom_linked_list_t *self); /** - * @brief PRIVATE Get the item at the head of the list or NULL if not present + * @brief API PRIVATE Returns the item at the head of the list or NULL if not present */ -void *pll_first(pll_t *self); +void *prom_linked_list_first(prom_linked_list_t *self); /** - * @brief PRIVATE Get the item at the tail of the list or NULL if not present + * @brief API PRIVATE Returns the item at the tail of the list or NULL if not present */ -void *pll_last(pll_t *self); +void *prom_linked_list_last(prom_linked_list_t *self); /** - * @brief PRIVATE Removes an item from the linked list + * @brief API PRIVATE Removes an item from the linked list */ -int pll_remove(pll_t *self, void *item); +int prom_linked_list_remove(prom_linked_list_t *self, void *item); /** - * @brief PRIVATE Compares two items within a linked list + * @brief API PRIVATE Compares two items within a linked list */ -pll_compare_t pll_compare(pll_t *self, void *item_a, void *node_b); +prom_linked_list_compare_t prom_linked_list_compare(prom_linked_list_t *self, void *item_a, void *node_b); /** - * @brief PRIVATE Get the size + * @brief API PRIVATE Get the size */ -size_t pll_size(pll_t *self); +size_t prom_linked_list_size(prom_linked_list_t *self); /** - * @brief PRIVATE Set the free_fn member on pll + * @brief API PRIVATE Set the free_fn member on prom_linked_list */ -int pll_set_free_fn(pll_t *self, pll_free_item_fn free_fn); +int prom_linked_list_set_free_fn(prom_linked_list_t *self, prom_linked_list_free_item_fn free_fn); /** - * @brief PRIVATE Set the compare_fn member on the pll + * @brief API PRIVATE Set the compare_fn member on the prom_linked_list */ -int pll_set_compare_fn(pll_t *self, pll_compare_item_fn compare_fn); +int prom_linked_list_set_compare_fn(prom_linked_list_t *self, prom_linked_list_compare_item_fn compare_fn); /** - * @brief PRIVATE does nothing + * API PRIVATE + * @brief does nothing */ -void pll_no_op_free(void *item); +void prom_linked_list_no_op_free(void *item); #endif // PROM_LIST_I_INCLUDED diff --git a/prom/src/prom_linked_list_t.h b/prom/src/prom_linked_list_t.h index 68433d9..f7d9e7e 100644 --- a/prom/src/prom_linked_list_t.h +++ b/prom/src/prom_linked_list_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,40 +19,36 @@ #include "prom_linked_list.h" -typedef enum { - PROM_LESS = -1, - PROM_EQUAL = 0, - PROM_GREATER = 1 -} pll_compare_t; +typedef enum { PROM_LESS = -1, PROM_EQUAL = 0, PROM_GREATER = 1 } prom_linked_list_compare_t; /** - * @brief PRIVATE Frees an item in a pll_node + * @brief API PRIVATE Frees an item in a prom_linked_list_node */ -typedef void (*pll_free_item_fn)(void *); +typedef void (*prom_linked_list_free_item_fn)(void *); /** - * @brief PRIVATE Compares two items within a pll + * @brief API PRIVATE Compares two items within a prom_linked_list */ -typedef pll_compare_t (*pll_compare_item_fn)(void *item_a, void *item_b); +typedef prom_linked_list_compare_t (*prom_linked_list_compare_item_fn)(void *item_a, void *item_b); /** - * @brief PRIVATE A struct containing a generic item, represented as a - * void pointer, and next, a pointer to the next pll_node* + * @brief API PRIVATE A struct containing a generic item, represented as a void pointer, and next, a pointer to the + * next prom_linked_list_node* */ -typedef struct pll_node { - struct pll_node *next; - void *item; -} pll_node_t; +typedef struct prom_linked_list_node { + struct prom_linked_list_node *next; + void *item; +} prom_linked_list_node_t; /** - * @brief PRIVATE A linked list comprised of pll_node* instances + * @brief API PRIVATE A linked list comprised of prom_linked_list_node* instances */ -struct pll { - pll_node_t *head; - pll_node_t *tail; - size_t size; - pll_free_item_fn free_fn; - pll_compare_item_fn compare_fn; +struct prom_linked_list { + prom_linked_list_node_t *head; + prom_linked_list_node_t *tail; + size_t size; + prom_linked_list_free_item_fn free_fn; + prom_linked_list_compare_item_fn compare_fn; }; #endif // PROM_LIST_T_H diff --git a/prom/src/prom_log.c b/prom/src/prom_log.c deleted file mode 100644 index 4536ff6..0000000 --- a/prom/src/prom_log.c +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de>. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <unistd.h> - -#include "prom_log.h" - -#ifdef PROM_LOG_ENABLE - -#define MAX_MSG_LEN 1024 - -static char LVL_TXT[][6] = { "", "DEBUG", "INFO", "WARN", "ERROR", "FATAL" }; -static FILE *stream = NULL; -static int stream_fd = -1; -static PROM_LOG_LEVEL lvl = PLL_NONE; - -FILE * -prom_log_use(FILE *dst) { - int fdold, fdnew; - FILE *fnew, *fold; - - if (dst == NULL) - return NULL; - fdold = fileno(dst); - if (fdold == -1) - return NULL; - fdnew = dup(fdold); - if (fdnew == -1) - return NULL; - fnew = fdopen(fdnew, "a"); - if (fnew == NULL) { - close(fdnew); - return NULL; - } - fold = stream; - stream = fnew; - stream_fd = fdnew; - return fold; -} - -PROM_LOG_LEVEL -prom_log_level(PROM_LOG_LEVEL level) { - PROM_LOG_LEVEL old; - if (level == PLL_NONE) - return lvl; - old = lvl; - lvl = level; - return old; -} - -PROM_LOG_LEVEL -prom_log_level_parse(const char *level) { - if (level == NULL) - return 0; - // allow 1..5 as well - if (strlen(level) == 1) { - int c = level[0] - '0'; - return (c > 0 && c < PLL_COUNT) ? c : PLL_NONE; - } - if (strncmp("DEBUG", level, 6) == 0) { - return PLL_DBG; - } else if (strncmp("INFO", level, 5) == 0) { - return PLL_INFO; - } else if (strncmp("WARN", level, 5) == 0) { - return PLL_WARN; - } else if (strncmp("ERROR", level, 6) == 0) { - return PLL_ERR; - } else if (strncmp("FATAL", level, 6) == 0) { - return PLL_FATAL; - } - return PLL_NONE; -} - -void -prom_log(PROM_LOG_LEVEL level, const char* format, ...) { - char s[MAX_MSG_LEN]; - size_t slen; - va_list args; - - if (lvl == PLL_NONE) { - char *s = getenv("PROM_LOG_LEVEL"); - if ((lvl = prom_log_level_parse(s)) == PLL_NONE) - lvl = PLL_INFO; - } - - if (level < lvl) - return; - - // just because of Linux: stderr is not a constant ... - if (stream == NULL) - stream = stderr; - - va_start(args,format); - - slen = snprintf(s, sizeof(s) - 2, "%s: ", LVL_TXT[level]); - slen += vsnprintf(s + slen, sizeof(s) - 2 - slen, format, args); - fwrite(s, slen, 1, stream); - fputc('\n', stream); - fflush(stream); // flush to page cache - fsync(stream_fd); // flush to disk - - va_end(args); -} - -#endif // PROM_LOG_ENABLE diff --git a/prom/src/prom_log.h b/prom/src/prom_log.h new file mode 100644 index 0000000..4209bdb --- /dev/null +++ b/prom/src/prom_log.h @@ -0,0 +1,28 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <stdio.h> + +#ifndef PROM_LOG_H +#define PROM_LOG_H + +#ifdef PROM_LOG_ENABLE +#define PROM_LOG(msg) printf("%s %s %s %s %d %s\n", __DATE__, __TIME__, __FILE__, __FUNCTION__, __LINE__, msg); +#else +#define PROM_LOG(msg) +#endif // PROM_LOG_ENABLE + +#endif // PROM_LOG_H diff --git a/prom/src/prom_map.c b/prom/src/prom_map.c index 2d068b7..3f21ba5 100644 --- a/prom/src/prom_map.c +++ b/prom/src/prom_map.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,418 +31,385 @@ #define PROM_MAP_INITIAL_SIZE 32 -static void -destroy_map_node_value_no_op(void *value) { - // no op -} +static void destroy_map_node_value_no_op(void *value) {} -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // prom_map_node -////////////////////////////////////////////////////////////////////////////// - -prom_map_node_t * -prom_map_node_new(const char *key, void *value, - prom_map_node_free_value_fn free_value_fn) -{ - prom_map_node_t *self = prom_malloc(sizeof(prom_map_node_t)); - if (self == NULL) - return NULL; - self->key = prom_strdup(key); - self->value = value; - self->free_value_fn = free_value_fn; - return self; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +prom_map_node_t *prom_map_node_new(const char *key, void *value, prom_map_node_free_value_fn free_value_fn) { + prom_map_node_t *self = prom_malloc(sizeof(prom_map_node_t)); + self->key = prom_strdup(key); + self->value = value; + self->free_value_fn = free_value_fn; + return self; } -int -prom_map_node_destroy(prom_map_node_t *self) { - if (self == NULL) - return 0; - prom_free((void *)self->key); - self->key = NULL; - if (self->value != NULL) - (*self->free_value_fn)(self->value); - self->value = NULL; - prom_free(self); - return 0; +int prom_map_node_destroy(prom_map_node_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + prom_free((void *)self->key); + self->key = NULL; + if (self->value != NULL) (*self->free_value_fn)(self->value); + self->value = NULL; + prom_free(self); + self = NULL; + return 0; } -void -prom_map_node_free(void *item) { - prom_map_node_destroy((prom_map_node_t *) item); +void prom_map_node_free(void *item) { + prom_map_node_t *map_node = (prom_map_node_t *)item; + prom_map_node_destroy(map_node); } -pll_compare_t -prom_map_node_compare(void *item_a, void *item_b) { - prom_map_node_t *a = (prom_map_node_t *) item_a; - prom_map_node_t *b = (prom_map_node_t *) item_b; - if (a == b) - return 0; - if (a == NULL) - return -1; - if (b == NULL) - return 1; - - if (a->key == b->key) - return 0; - if (a->key == NULL) - return -1; - if (b ->key == NULL) - return 1; - return strcmp(a->key, b->key); +prom_linked_list_compare_t prom_map_node_compare(void *item_a, void *item_b) { + prom_map_node_t *map_node_a = (prom_map_node_t *)item_a; + prom_map_node_t *map_node_b = (prom_map_node_t *)item_b; + + return strcmp(map_node_a->key, map_node_b->key); } -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // prom_map -////////////////////////////////////////////////////////////////////////////// - -prom_map_t * -prom_map_new() { - prom_map_t *self = (prom_map_t *) prom_malloc(sizeof(prom_map_t)); - if (self == NULL) - return NULL; - - self->size = 0; - self->max_size = PROM_MAP_INITIAL_SIZE; - self->free_value_fn = destroy_map_node_value_no_op; - self->addrs = NULL; - self->rwlock = NULL; - - self->keys = pll_new(); - if (self->keys == NULL) { - prom_free(self); - return NULL; - } - - // These each key will be allocated once by prom_map_node_new and used here - // as well to save memory. With that said we will only have to deallocate - // each key once. That will happen on prom_map_node_destroy. - if (pll_set_free_fn(self->keys, pll_no_op_free)) - goto fail; - - self->addrs = prom_malloc(sizeof(pll_t) * self->max_size); - if (self->addrs == NULL) - goto fail; - - for (int i = 0; i < self->max_size; i++) { - self->addrs[i] = pll_new(); - if (pll_set_free_fn(self->addrs[i], prom_map_node_free)) - goto fail; - if (pll_set_compare_fn(self->addrs[i], prom_map_node_compare)) - goto fail; - } - - self->rwlock = (pthread_rwlock_t *) prom_malloc(sizeof(pthread_rwlock_t)); - if (self->rwlock == NULL) - goto fail; - if (pthread_rwlock_init(self->rwlock, NULL)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_INIT_ERROR, NULL); - goto fail; - } - - return self; - -fail: - prom_map_destroy(self); - return NULL; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +prom_map_t *prom_map_new() { + int r = 0; + + prom_map_t *self = (prom_map_t *)prom_malloc(sizeof(prom_map_t)); + self->size = 0; + self->max_size = PROM_MAP_INITIAL_SIZE; + + self->keys = prom_linked_list_new(); + if (self->keys == NULL) return NULL; + + // These each key will be allocated once by prom_map_node_new and used here as well to save memory. With that said + // we will only have to deallocate each key once. That will happen on prom_map_node_destroy. + r = prom_linked_list_set_free_fn(self->keys, prom_linked_list_no_op_free); + if (r) { + prom_map_destroy(self); + return NULL; + } + + self->addrs = prom_malloc(sizeof(prom_linked_list_t) * self->max_size); + self->free_value_fn = destroy_map_node_value_no_op; + + for (int i = 0; i < self->max_size; i++) { + self->addrs[i] = prom_linked_list_new(); + r = prom_linked_list_set_free_fn(self->addrs[i], prom_map_node_free); + if (r) { + prom_map_destroy(self); + return NULL; + } + r = prom_linked_list_set_compare_fn(self->addrs[i], prom_map_node_compare); + if (r) { + prom_map_destroy(self); + return NULL; + } + } + + self->rwlock = (pthread_rwlock_t *)prom_malloc(sizeof(pthread_rwlock_t)); + r = pthread_rwlock_init(self->rwlock, NULL); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_INIT_ERROR); + prom_map_destroy(self); + return NULL; + } + + return self; } -int -prom_map_destroy(prom_map_t *self) { - if (self == NULL) - return 0; - - pll_destroy(self->keys); - self->keys = NULL; - for (size_t i = 0; i < self->max_size; i++) { - pll_destroy(self->addrs[i]); - self->addrs[i] = NULL; - } - prom_free(self->addrs); - self->addrs = NULL; - pthread_rwlock_destroy(self->rwlock); - prom_free(self->rwlock); - self->rwlock = NULL; - prom_free(self); - return 0; +int prom_map_destroy(prom_map_t *self) { + PROM_ASSERT(self != NULL); + int r = 0; + int ret = 0; + + r = prom_linked_list_destroy(self->keys); + if (r) ret = r; + self->keys = NULL; + + for (size_t i = 0; i < self->max_size; i++) { + r = prom_linked_list_destroy(self->addrs[i]); + if (r) ret = r; + self->addrs[i] = NULL; + } + prom_free(self->addrs); + self->addrs = NULL; + + r = pthread_rwlock_destroy(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_DESTROY_ERROR) + ret = r; + } + + prom_free(self->rwlock); + self->rwlock = NULL; + prom_free(self); + self = NULL; + + return ret; } -static size_t -prom_map_get_index_internal(const char *key, size_t *size, size_t *max_size) { - PROM_ASSERT(key != NULL); - size_t index; - size_t a = 31415, b = 27183; - for (index = 0; *key != '\0'; key++, a = a * b % (*max_size - 1)) { - index = (a * index + *key) % *max_size; - } - return index; +static size_t prom_map_get_index_internal(const char *key, size_t *size, size_t *max_size) { + size_t index; + size_t a = 31415, b = 27183; + for (index = 0; *key != '\0'; key++, a = a * b % (*max_size - 1)) { + index = (a * index + *key) % *max_size; + } + return index; } /** - * @brief PRIVATE hash function that returns an array index from the given - * key and prom_map. + * @brief API PRIVATE hash function that returns an array index from the given key and prom_map. * - * The algorithm is based off of Horner's method. In a simpler version, you set - * the return value to 0. Next, for each character in the string, you add the - * integer value of the current character to the product of the prime number and - * the current return value, set the result to the return value, then finally - * return the return value. + * The algorithm is based off of Horner's method. In a simpler version, you set the return value to 0. Next, for each + * character in the string, you add the integer value of the current character to the product of the prime number and + * the current return value, set the result to the return value, then finally return the return value. * - * In this version of the algorithm, we attempt to achieve a probabily of key - * to index conversion collisions to 1/M (with M being the max_size of the map). - * This optimizes dispersion and consequently, evens out the performance for - * gets and sets for each item. Instead of using a fixed prime number, we - * generate a coefficient for each iteration through the loop. + * In this version of the algorithm, we attempt to achieve a probabily of key to index conversion collisions to + * 1/M (with M being the max_size of the map). This optimizes dispersion and consequently, evens out the performance + * for gets and sets for each item. Instead of using a fixed prime number, we generate a coefficient for each iteration + * through the loop. * * Reference: * * Algorithms in C: Third Edition by Robert Sedgewick, p579 */ -size_t -prom_map_get_index(prom_map_t *self, const char *key) { +size_t prom_map_get_index(prom_map_t *self, const char *key) { return prom_map_get_index_internal(key, &self->size, &self->max_size); } -static void * -prom_map_get_internal(const char *key, size_t *size, size_t *max_size, - pll_t *keys, pll_t **addrs, prom_map_node_free_value_fn free_value_fn) -{ - if (key == NULL) - return NULL; - - size_t index = prom_map_get_index_internal(key, size, max_size); - pll_t *list = addrs[index]; - prom_map_node_t *temp_map_node = prom_map_node_new(key, NULL,free_value_fn); - - for (pll_node_t *current_node = list->head; - current_node != NULL; current_node = current_node->next) - { - prom_map_node_t *current_map_node = (prom_map_node_t *) - current_node->item; - pll_compare_t result = - pll_compare(list, current_map_node, temp_map_node); - if (result == PROM_EQUAL) { - prom_map_node_destroy(temp_map_node); - temp_map_node = NULL; - return current_map_node->value; - } - } - prom_map_node_destroy(temp_map_node); - return NULL; +static void *prom_map_get_internal(const char *key, size_t *size, size_t *max_size, prom_linked_list_t *keys, + prom_linked_list_t **addrs, prom_map_node_free_value_fn free_value_fn) { + size_t index = prom_map_get_index_internal(key, size, max_size); + prom_linked_list_t *list = addrs[index]; + prom_map_node_t *temp_map_node = prom_map_node_new(key, NULL, free_value_fn); + + for (prom_linked_list_node_t *current_node = list->head; current_node != NULL; current_node = current_node->next) { + prom_map_node_t *current_map_node = (prom_map_node_t *)current_node->item; + prom_linked_list_compare_t result = prom_linked_list_compare(list, current_map_node, temp_map_node); + if (result == PROM_EQUAL) { + prom_map_node_destroy(temp_map_node); + temp_map_node = NULL; + return current_map_node->value; + } + } + prom_map_node_destroy(temp_map_node); + temp_map_node = NULL; + return NULL; } -void * -prom_map_get(prom_map_t *self, const char *key) { - if (key == NULL) - return NULL; - - if (pthread_rwlock_wrlock(self->rwlock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_LOCK_ERROR, NULL); - return NULL; - } - - void *value = prom_map_get_internal(key, &self->size, &self->max_size, - self->keys, self->addrs, self->free_value_fn); - - if (pthread_rwlock_unlock(self->rwlock)) - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - - return value; +void *prom_map_get(prom_map_t *self, const char *key) { + PROM_ASSERT(self != NULL); + int r = 0; + r = pthread_rwlock_wrlock(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_LOCK_ERROR); + NULL; + } + void *payload = + prom_map_get_internal(key, &self->size, &self->max_size, self->keys, self->addrs, self->free_value_fn); + r = pthread_rwlock_unlock(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); + return NULL; + } + return payload; } -static int -prom_map_set_internal(const char *key, void *value, size_t *size, - size_t *max_size, pll_t *keys, pll_t **addrs, - prom_map_node_free_value_fn free_value_fn, bool destroy_current_value) -{ - prom_map_node_t *map_node = prom_map_node_new(key, value, free_value_fn); - if (map_node == NULL) - return 1; - - size_t index = prom_map_get_index_internal(key, size, max_size); - pll_t *list = addrs[index]; - for (pll_node_t *current_node = list->head; - current_node != NULL; current_node = current_node->next) - { - prom_map_node_t *current_map_node = (prom_map_node_t *) - current_node->item; - pll_compare_t result = - pll_compare(list, current_map_node, map_node); - if (result != PROM_EQUAL) - continue; - - if (destroy_current_value) { - free_value_fn(current_map_node->value); - current_map_node->value = NULL; - } - prom_free((char *) current_map_node->key); - current_map_node->key = NULL; - prom_free(current_map_node); - current_map_node = NULL; - current_node->item = map_node; - return 0; - } - pll_append(list, map_node); - pll_append(keys, (char *) map_node->key); - (*size)++; - return 0; +static int prom_map_set_internal(const char *key, void *value, size_t *size, size_t *max_size, prom_linked_list_t *keys, + prom_linked_list_t **addrs, prom_map_node_free_value_fn free_value_fn, + bool destroy_current_value) { + prom_map_node_t *map_node = prom_map_node_new(key, value, free_value_fn); + if (map_node == NULL) return 1; + + size_t index = prom_map_get_index_internal(key, size, max_size); + prom_linked_list_t *list = addrs[index]; + for (prom_linked_list_node_t *current_node = list->head; current_node != NULL; current_node = current_node->next) { + prom_map_node_t *current_map_node = (prom_map_node_t *)current_node->item; + prom_linked_list_compare_t result = prom_linked_list_compare(list, current_map_node, map_node); + if (result == PROM_EQUAL) { + if (destroy_current_value) { + free_value_fn(current_map_node->value); + current_map_node->value = NULL; + } + prom_free((char *)current_map_node->key); + current_map_node->key = NULL; + prom_free(current_map_node); + current_map_node = NULL; + current_node->item = map_node; + return 0; + } + } + prom_linked_list_append(list, map_node); + prom_linked_list_append(keys, (char *)map_node->key); + (*size)++; + return 0; } -int -prom_map_ensure_space(prom_map_t *self) { - PROM_ASSERT(self != NULL); - - if (self->size <= self->max_size >> 1) - return 0; - - // Increase the max size - size_t new_max = self->max_size << 1; - size_t new_size = 0; - - // Create a new list of keys - pll_t *new_keys = pll_new(); - if (new_keys == NULL) - return 1; - - if (pll_set_free_fn(new_keys, pll_no_op_free)) - return 2; - - // Create a new array of addrs - pll_t **new_addrs = - prom_malloc(sizeof(pll_t) * new_max); - - // Initialize the new array - for (int i = 0; i < new_max; i++) { - new_addrs[i] = pll_new(); - if (pll_set_free_fn(new_addrs[i], prom_map_node_free)) - return 3; - if (pll_set_compare_fn(new_addrs[i],prom_map_node_compare)) - return 4; - } - - // Iterate through each linked-list at each memory region in the map's - // backbone - for (int i = 0; i < self->max_size; i++) { - // Create a new map node for each node in the linked list and insert it - // into the new map. Afterwards, deallocate the old map node - pll_t *list = self->addrs[i]; - pll_node_t *current_node = list->head; - while (current_node != NULL) { - prom_map_node_t *map_node = (prom_map_node_t *) current_node->item; - if (prom_map_set_internal(map_node->key, map_node->value, - &new_size, &new_max, new_keys, new_addrs, self->free_value_fn, - false)) - { - return 5; - } - pll_node_t *next = current_node->next; - prom_free(current_node); - current_node = NULL; - prom_free((void *) map_node->key); - map_node->key = NULL; - prom_free(map_node); - map_node = NULL; - current_node = next; - } - // We're done deallocating each map node in the linked list, so - // deallocate the linked-list object - prom_free(self->addrs[i]); - self->addrs[i] = NULL; - } - // Destroy the collection of keys in the map - pll_destroy(self->keys); - self->keys = NULL; - - // Deallocate the backbone of the map - prom_free(self->addrs); - self->addrs = NULL; - - // Update the members of the current map - self->size = new_size; - self->max_size = new_max; - self->keys = new_keys; - self->addrs = new_addrs; - return 0; +int prom_map_ensure_space(prom_map_t *self) { + PROM_ASSERT(self != NULL); + int r = 0; + + if (self->size <= self->max_size / 2) { + return 0; + } + + // Increase the max size + size_t new_max = self->max_size * 2; + size_t new_size = 0; + + // Create a new list of keys + prom_linked_list_t *new_keys = prom_linked_list_new(); + if (new_keys == NULL) return 1; + + r = prom_linked_list_set_free_fn(new_keys, prom_linked_list_no_op_free); + if (r) return r; + + // Create a new array of addrs + prom_linked_list_t **new_addrs = prom_malloc(sizeof(prom_linked_list_t) * new_max); + + // Initialize the new array + for (int i = 0; i < new_max; i++) { + new_addrs[i] = prom_linked_list_new(); + r = prom_linked_list_set_free_fn(new_addrs[i], prom_map_node_free); + if (r) return r; + r = prom_linked_list_set_compare_fn(new_addrs[i], prom_map_node_compare); + if (r) return r; + } + + // Iterate through each linked-list at each memory region in the map's backbone + for (int i = 0; i < self->max_size; i++) { + // Create a new map node for each node in the linked list and insert it into the new map. Afterwards, deallocate + // the old map node + prom_linked_list_t *list = self->addrs[i]; + prom_linked_list_node_t *current_node = list->head; + while (current_node != NULL) { + prom_map_node_t *map_node = (prom_map_node_t *)current_node->item; + r = prom_map_set_internal(map_node->key, map_node->value, &new_size, &new_max, new_keys, new_addrs, + self->free_value_fn, false); + if (r) return r; + + prom_linked_list_node_t *next = current_node->next; + prom_free(current_node); + current_node = NULL; + prom_free((void *)map_node->key); + map_node->key = NULL; + prom_free(map_node); + map_node = NULL; + current_node = next; + } + // We're done deallocating each map node in the linked list, so deallocate the linked-list object + prom_free(self->addrs[i]); + self->addrs[i] = NULL; + } + // Destroy the collection of keys in the map + prom_linked_list_destroy(self->keys); + self->keys = NULL; + + // Deallocate the backbone of the map + prom_free(self->addrs); + self->addrs = NULL; + + // Update the members of the current map + self->size = new_size; + self->max_size = new_max; + self->keys = new_keys; + self->addrs = new_addrs; + + return 0; } -int -prom_map_set(prom_map_t *self, const char *key, void *value) { - PROM_ASSERT(self != NULL); - if (pthread_rwlock_wrlock(self->rwlock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_LOCK_ERROR, NULL); - return 1; - } - - if (prom_map_ensure_space(self)) { - if (pthread_rwlock_unlock(self->rwlock)) - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - return 2; - } - if (prom_map_set_internal(key, value, &self->size, &self->max_size, - self->keys, self->addrs, self->free_value_fn, true)) - { - if (pthread_rwlock_unlock(self->rwlock)) - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - return 3; - } - if (pthread_rwlock_unlock(self->rwlock)) - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - return 0; +int prom_map_set(prom_map_t *self, const char *key, void *value) { + PROM_ASSERT(self != NULL); + int r = 0; + r = pthread_rwlock_wrlock(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_LOCK_ERROR); + return r; + } + + r = prom_map_ensure_space(self); + if (r) { + int rr = 0; + rr = pthread_rwlock_unlock(self->rwlock); + if (rr) { + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); + return rr; + } else { + return r; + } + } + r = prom_map_set_internal(key, value, &self->size, &self->max_size, self->keys, self->addrs, self->free_value_fn, + true); + if (r) { + int rr = 0; + rr = pthread_rwlock_unlock(self->rwlock); + if (rr) { + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); + return rr; + } else { + return r; + } + } + r = pthread_rwlock_unlock(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); + } + return r; } -static int -prom_map_delete_internal(const char *key, size_t *size, size_t *max_size, - pll_t *keys, pll_t **addrs, prom_map_node_free_value_fn free_value_fn) -{ - PROM_ASSERT(key != NULL); - size_t index = prom_map_get_index_internal(key, size, max_size); - pll_t *list = addrs[index]; - prom_map_node_t *temp_map_node = - prom_map_node_new(key, NULL, free_value_fn); - - for (pll_node_t *current_node = list->head; - current_node != NULL; current_node = current_node->next) - { - prom_map_node_t *current_map_node = (prom_map_node_t *) - current_node->item; - pll_compare_t result = - pll_compare(list, current_map_node, temp_map_node); - if (result != PROM_EQUAL) - continue; - - if (pll_remove(list, current_node)) - return 1; - if (pll_remove(keys, (char *)current_map_node->key)) - return 2; - (*size)--; - break; - } - return prom_map_node_destroy(temp_map_node); +static int prom_map_delete_internal(const char *key, size_t *size, size_t *max_size, prom_linked_list_t *keys, + prom_linked_list_t **addrs, prom_map_node_free_value_fn free_value_fn) { + int r = 0; + size_t index = prom_map_get_index_internal(key, size, max_size); + prom_linked_list_t *list = addrs[index]; + prom_map_node_t *temp_map_node = prom_map_node_new(key, NULL, free_value_fn); + + for (prom_linked_list_node_t *current_node = list->head; current_node != NULL; current_node = current_node->next) { + prom_map_node_t *current_map_node = (prom_map_node_t *)current_node->item; + prom_linked_list_compare_t result = prom_linked_list_compare(list, current_map_node, temp_map_node); + if (result == PROM_EQUAL) { + r = prom_linked_list_remove(list, current_node); + if (r) return r; + + r = prom_linked_list_remove(keys, (char *)current_map_node->key); + if (r) return r; + + (*size)--; + break; + } + } + r = prom_map_node_destroy(temp_map_node); + temp_map_node = NULL; + return r; } -int -prom_map_delete(prom_map_t *self, const char *key) { - PROM_ASSERT(self != NULL); - if (pthread_rwlock_wrlock(self->rwlock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_LOCK_ERROR, NULL); - return 1; - } - prom_map_delete_internal(key, &self->size, &self->max_size, self->keys, - self->addrs, self->free_value_fn); - if (pthread_rwlock_unlock(self->rwlock)) - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - return 0; +int prom_map_delete(prom_map_t *self, const char *key) { + PROM_ASSERT(self != NULL); + int r = 0; + int ret = 0; + r = pthread_rwlock_wrlock(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_LOCK_ERROR); + ret = r; + } + r = prom_map_delete_internal(key, &self->size, &self->max_size, self->keys, self->addrs, self->free_value_fn); + if (r) ret = r; + r = pthread_rwlock_unlock(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); + ret = r; + } + return ret; } -int -prom_map_set_free_value_fn(prom_map_t *self, - prom_map_node_free_value_fn free_value_fn) -{ - PROM_ASSERT(self != NULL); - self->free_value_fn = free_value_fn; - return 0; +int prom_map_set_free_value_fn(prom_map_t *self, prom_map_node_free_value_fn free_value_fn) { + PROM_ASSERT(self != NULL); + self->free_value_fn = free_value_fn; + return 0; } -size_t -prom_map_size(prom_map_t *self) { - PROM_ASSERT(self != NULL); - return self->size; +size_t prom_map_size(prom_map_t *self) { + PROM_ASSERT(self != NULL); + return self->size; } diff --git a/prom/src/prom_map_t.h b/prom/src/prom_map_t.h index 95c150a..66832ee 100644 --- a/prom/src/prom_map_t.h +++ b/prom/src/prom_map_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,21 +25,21 @@ // Private #include "prom_linked_list_t.h" -typedef void (*prom_map_node_free_value_fn) (void *); +typedef void (*prom_map_node_free_value_fn)(void *); struct prom_map_node { - const char *key; - void *value; - prom_map_node_free_value_fn free_value_fn; + const char *key; + void *value; + prom_map_node_free_value_fn free_value_fn; }; struct prom_map { - size_t size; /**< contains the size of the map */ - size_t max_size; /**< stores the current max_size */ - pll_t *keys; /**< linked list containing all keys present */ - pll_t **addrs; /**< Sequence of linked lists. Each list contains nodes with the same index */ - pthread_rwlock_t *rwlock; - prom_map_node_free_value_fn free_value_fn; + size_t size; /**< contains the size of the map */ + size_t max_size; /**< stores the current max_size */ + prom_linked_list_t *keys; /**< linked list containing containing all keys present */ + prom_linked_list_t **addrs; /**< Sequence of linked lists. Each list contains nodes with the same index */ + pthread_rwlock_t *rwlock; + prom_map_node_free_value_fn free_value_fn; }; #endif // PROM_MAP_T_H diff --git a/prom/src/prom_metric.c b/prom/src/prom_metric.c index ce8c9c1..c095771 100644 --- a/prom/src/prom_metric.c +++ b/prom/src/prom_metric.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,180 +30,209 @@ #include "prom_metric_sample_histogram_i.h" #include "prom_metric_sample_i.h" -const char *prom_metric_type_map[5] = - { "counter", "gauge", "histogram", "summary", "untyped" }; - -prom_metric_t * -prom_metric_new(prom_metric_type_t metric_type, const char *name, - const char *help, size_t label_key_count, const char **label_keys) -{ - prom_metric_t *self = (prom_metric_t *) prom_malloc(sizeof(prom_metric_t)); - if (self == NULL) - return NULL; - self->type = metric_type; - self->name = name; - self->help = help; - self->buckets = NULL; - self->formatter = NULL; - - const char **k = (const char **) - prom_malloc(sizeof(const char *) * label_key_count); - - for (int i = 0; i < label_key_count; i++) { - if (strcmp(label_keys[i], "le") == 0) { - PROM_WARN(PROM_METRIC_INVALID_LABEL_NAME "(%s)", "le"); - goto fail; - } - if (strcmp(label_keys[i], "quantile") == 0) { - PROM_WARN(PROM_METRIC_INVALID_LABEL_NAME "(%s)", "quantile"); - goto fail; - } - k[i] = prom_strdup(label_keys[i]); - } - self->label_keys = k; - self->label_key_count = label_key_count; - self->samples = prom_map_new(); - - if (metric_type == PROM_HISTOGRAM) { - if (prom_map_set_free_value_fn(self->samples, - &pms_histogram_free_generic)) - { - goto fail; - } - } else if (prom_map_set_free_value_fn(self->samples, &pms_free_generic)) { - goto fail; - } - - if ((self->formatter = pmf_new()) == NULL) - goto fail; - - self->rwlock = (pthread_rwlock_t *) prom_malloc(sizeof(pthread_rwlock_t)); - if (self->rwlock == NULL || pthread_rwlock_init(self->rwlock, NULL) != 0) { - PROM_WARN(PROM_PTHREAD_RWLOCK_INIT_ERROR, NULL); - return NULL; - } - return self; - -fail: - prom_metric_destroy(self); - return NULL; +char *prom_metric_type_map[4] = {"counter", "gauge", "histogram", "summary"}; + +prom_metric_t *prom_metric_new(prom_metric_type_t metric_type, const char *name, const char *help, + size_t label_key_count, const char **label_keys) { + int r = 0; + prom_metric_t *self = (prom_metric_t *)prom_malloc(sizeof(prom_metric_t)); + self->type = metric_type; + self->name = name; + self->help = help; + self->buckets = NULL; + + const char **k = (const char **)prom_malloc(sizeof(const char *) * label_key_count); + + for (int i = 0; i < label_key_count; i++) { + if (strcmp(label_keys[i], "le") == 0) { + PROM_LOG(PROM_METRIC_INVALID_LABEL_NAME); + prom_metric_destroy(self); + return NULL; + } + if (strcmp(label_keys[i], "quantile") == 0) { + PROM_LOG(PROM_METRIC_INVALID_LABEL_NAME); + prom_metric_destroy(self); + return NULL; + } + k[i] = prom_strdup(label_keys[i]); + } + self->label_keys = k; + self->label_key_count = label_key_count; + self->samples = prom_map_new(); + + if (metric_type == PROM_HISTOGRAM) { + r = prom_map_set_free_value_fn(self->samples, &prom_metric_sample_histogram_free_generic); + if (r) { + prom_metric_destroy(self); + return NULL; + } + } else { + r = prom_map_set_free_value_fn(self->samples, &prom_metric_sample_free_generic); + if (r) { + prom_metric_destroy(self); + return NULL; + } + } + + self->formatter = prom_metric_formatter_new(); + if (self->formatter == NULL) { + prom_metric_destroy(self); + return NULL; + } + self->rwlock = (pthread_rwlock_t *)prom_malloc(sizeof(pthread_rwlock_t)); + r = pthread_rwlock_init(self->rwlock, NULL); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_INIT_ERROR); + return NULL; + } + return self; } -int -prom_metric_destroy(prom_metric_t *self) { - if (self == NULL) - return 0; +int prom_metric_destroy(prom_metric_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; - phb_destroy(self->buckets); - self->buckets = NULL; + int r = 0; + int ret = 0; - prom_map_destroy(self->samples); - self->samples = NULL; + if (self->buckets != NULL) { + r = prom_histogram_buckets_destroy(self->buckets); + self->buckets = NULL; + if (r) ret = r; + } - pmf_destroy(self->formatter); - self->formatter = NULL; + r = prom_map_destroy(self->samples); + self->samples = NULL; + if (r) ret = r; - if (pthread_rwlock_destroy(self->rwlock)) - PROM_WARN(PROM_PTHREAD_RWLOCK_DESTROY_ERROR, NULL); + r = prom_metric_formatter_destroy(self->formatter); + self->formatter = NULL; + if (r) ret = r; - prom_free(self->rwlock); - self->rwlock = NULL; + r = pthread_rwlock_destroy(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_DESTROY_ERROR); + ret = r; + } - for (int i = 0; i < self->label_key_count; i++) { - prom_free((void *) self->label_keys[i]); - self->label_keys[i] = NULL; - } - prom_free(self->label_keys); - self->label_keys = NULL; + prom_free(self->rwlock); + self->rwlock = NULL; - prom_free(self); - return 0; + for (int i = 0; i < self->label_key_count; i++) { + prom_free((void *)self->label_keys[i]); + self->label_keys[i] = NULL; + } + prom_free(self->label_keys); + self->label_keys = NULL; + + prom_free(self); + self = NULL; + + return ret; } -int -prom_metric_destroy_generic(void *item) { - return prom_metric_destroy((prom_metric_t *) item); +int prom_metric_destroy_generic(void *item) { + int r = 0; + prom_metric_t *self = (prom_metric_t *)item; + r = prom_metric_destroy(self); + self = NULL; + return r; } -void -prom_metric_free_generic(void *item) { - prom_metric_destroy((prom_metric_t *) item); +void prom_metric_free_generic(void *item) { + prom_metric_t *self = (prom_metric_t *)item; + prom_metric_destroy(self); } -pms_t * -pms_from_labels(prom_metric_t *self, const char **label_values) { - PROM_ASSERT(self != NULL); - if (pthread_rwlock_wrlock(self->rwlock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_LOCK_ERROR, NULL); - return NULL; - } - - // Get l_value - if (pmf_load_l_value(self->formatter, self->name, NULL, - self->label_key_count, self->label_keys, label_values)) - { - goto fail; - } - - // This must be freed before returning - const char *l_value = pmf_dump(self->formatter); - if (l_value == NULL) - goto fail; - - // Get sample - pms_t *sample = (pms_t *) prom_map_get(self->samples, l_value); - if (sample == NULL) { - sample = pms_new(self->type, l_value, 0.0); - if (prom_map_set(self->samples, l_value, sample)) - goto fail; - } - pthread_rwlock_unlock(self->rwlock); - prom_free((void *) l_value); - return sample; - -fail: - if (pthread_rwlock_unlock(self->rwlock)) - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - return NULL; +prom_metric_sample_t *prom_metric_sample_from_labels(prom_metric_t *self, const char **label_values) { + PROM_ASSERT(self != NULL); + int r = 0; + r = pthread_rwlock_wrlock(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_LOCK_ERROR); + return NULL; + } + +#define PROM_METRIC_SAMPLE_FROM_LABELS_HANDLE_UNLOCK() \ + r = pthread_rwlock_unlock(self->rwlock); \ + if (r) PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); \ + return NULL; + + // Get l_value + r = prom_metric_formatter_load_l_value(self->formatter, self->name, NULL, self->label_key_count, self->label_keys, + label_values); + if (r) { + PROM_METRIC_SAMPLE_FROM_LABELS_HANDLE_UNLOCK(); + } + + // This must be freed before returning + const char *l_value = prom_metric_formatter_dump(self->formatter); + if (l_value == NULL) { + PROM_METRIC_SAMPLE_FROM_LABELS_HANDLE_UNLOCK(); + } + + // Get sample + prom_metric_sample_t *sample = (prom_metric_sample_t *)prom_map_get(self->samples, l_value); + if (sample == NULL) { + sample = prom_metric_sample_new(self->type, l_value, 0.0); + r = prom_map_set(self->samples, l_value, sample); + if (r) { + PROM_METRIC_SAMPLE_FROM_LABELS_HANDLE_UNLOCK(); + } + } + pthread_rwlock_unlock(self->rwlock); + prom_free((void *)l_value); + return sample; } -pms_histogram_t * -pms_histogram_from_labels(prom_metric_t *self, const char **label_values) { - PROM_ASSERT(self != NULL); - if (pthread_rwlock_wrlock(self->rwlock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_LOCK_ERROR, NULL); - return NULL; - } - - // Load the l_value - if (pmf_load_l_value(self->formatter, self->name, NULL, - self->label_key_count, self->label_keys, label_values)) - { - goto fail; - } - - // This must be freed before returning - const char *l_value = pmf_dump(self->formatter); - if (l_value == NULL) - goto fail; - - // Get sample - pms_histogram_t *sample = (pms_histogram_t *) - prom_map_get(self->samples, l_value); - if (sample == NULL) { - sample = pms_histogram_new(self->name, self->buckets, - self->label_key_count, self->label_keys, label_values); - if (sample == NULL || prom_map_set(self->samples, l_value, sample)) { - prom_free((void *) l_value); - goto fail; - } - } - pthread_rwlock_unlock(self->rwlock); - prom_free((void *) l_value); - return sample; - -fail: - if (pthread_rwlock_unlock(self->rwlock)) - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - return NULL; +prom_metric_sample_histogram_t *prom_metric_sample_histogram_from_labels(prom_metric_t *self, + const char **label_values) { + PROM_ASSERT(self != NULL); + + int r = 0; + r = pthread_rwlock_wrlock(self->rwlock); + if (r) { + PROM_LOG(PROM_PTHREAD_RWLOCK_LOCK_ERROR); + return NULL; + } + +#define PROM_METRIC_SAMPLE_HISTOGRAM_FROM_LABELS_HANDLE_UNLOCK() \ + r = pthread_rwlock_unlock(self->rwlock); \ + if (r) { \ + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); \ + return NULL; \ + } + + // Load the l_value + r = prom_metric_formatter_load_l_value(self->formatter, self->name, NULL, self->label_key_count, self->label_keys, + label_values); + if (r) { + PROM_METRIC_SAMPLE_HISTOGRAM_FROM_LABELS_HANDLE_UNLOCK(); + } + + // This must be freed before returning + const char *l_value = prom_metric_formatter_dump(self->formatter); + if (l_value == NULL) { + PROM_METRIC_SAMPLE_HISTOGRAM_FROM_LABELS_HANDLE_UNLOCK(); + } + + // Get sample + prom_metric_sample_histogram_t *sample = (prom_metric_sample_histogram_t *)prom_map_get(self->samples, l_value); + if (sample == NULL) { + sample = prom_metric_sample_histogram_new(self->name, self->buckets, self->label_key_count, self->label_keys, + label_values); + if (sample == NULL) { + prom_free((void *)l_value); + PROM_METRIC_SAMPLE_HISTOGRAM_FROM_LABELS_HANDLE_UNLOCK(); + } + r = prom_map_set(self->samples, l_value, sample); + if (r) { + prom_free((void *)l_value); + pthread_rwlock_unlock(self->rwlock); + PROM_METRIC_SAMPLE_HISTOGRAM_FROM_LABELS_HANDLE_UNLOCK(); + } + } + pthread_rwlock_unlock(self->rwlock); + prom_free((void *)l_value); + return sample; } diff --git a/prom/src/prom_metric_formatter.c b/prom/src/prom_metric_formatter.c index 56d624f..277afd7 100644 --- a/prom/src/prom_metric_formatter.c +++ b/prom/src/prom_metric_formatter.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,258 +18,244 @@ // Public #include "prom_alloc.h" -#include "prom_gauge.h" // Private #include "prom_assert.h" #include "prom_collector_t.h" #include "prom_linked_list_t.h" -#include "prom_log.h" #include "prom_map_i.h" #include "prom_metric_formatter_i.h" #include "prom_metric_sample_histogram_t.h" #include "prom_metric_sample_t.h" #include "prom_metric_t.h" -#include "prom_string_builder.h" - -pmf_t * -pmf_new() { - pmf_t *self = (pmf_t *) prom_malloc(sizeof(pmf_t)); - if (self == NULL) - return NULL; - if ((self->string_builder = psb_new()) == NULL) { - self->err_builder = NULL; - goto fail; - } - if ((self->err_builder = psb_new()) == NULL) - goto fail; - return self; - -fail: - pmf_destroy(self); - return NULL; +#include "prom_string_builder_i.h" + +prom_metric_formatter_t *prom_metric_formatter_new() { + prom_metric_formatter_t *self = (prom_metric_formatter_t *)prom_malloc(sizeof(prom_metric_formatter_t)); + self->string_builder = prom_string_builder_new(); + if (self->string_builder == NULL) { + prom_metric_formatter_destroy(self); + return NULL; + } + self->err_builder = prom_string_builder_new(); + if (self->err_builder == NULL) { + prom_metric_formatter_destroy(self); + return NULL; + } + return self; } -int -pmf_destroy(pmf_t *self) { - if (self == NULL) - return 0; +int prom_metric_formatter_destroy(prom_metric_formatter_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + + int r = 0; + int ret = 0; - psb_destroy(self->string_builder); - self->string_builder = NULL; + r = prom_string_builder_destroy(self->string_builder); + self->string_builder = NULL; + if (r) ret = r; - psb_destroy(self->err_builder); - self->err_builder = NULL; + r = prom_string_builder_destroy(self->err_builder); + self->err_builder = NULL; + if (r) ret = r; - prom_free(self); - return 0; + prom_free(self); + self = NULL; + return ret; } -int -pmf_load_help(pmf_t *self, const char *prefix, const char *name, - const char *help) -{ - if (self == NULL) - return 1; - if (help == NULL) - return 0; - - if (psb_add_str(self->string_builder, "# HELP ")) - return 2; - if (prefix != NULL && psb_add_str(self->string_builder, prefix)) - return 3; - if (psb_add_str(self->string_builder, name)) - return 4; - if (psb_add_char(self->string_builder, ' ')) - return 5; - if (psb_add_str(self->string_builder, help)) - return 6; - return psb_add_char(self->string_builder, '\n') ? 7 : 0; +int prom_metric_formatter_load_help(prom_metric_formatter_t *self, const char *name, const char *help) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + + int r = 0; + + r = prom_string_builder_add_str(self->string_builder, "# HELP "); + if (r) return r; + + r = prom_string_builder_add_str(self->string_builder, name); + if (r) return r; + + r = prom_string_builder_add_char(self->string_builder, ' '); + if (r) return r; + + r = prom_string_builder_add_str(self->string_builder, help); + if (r) return r; + + return prom_string_builder_add_char(self->string_builder, '\n'); } -int -pmf_load_type(pmf_t *self, const char *prefix, const char *name, - prom_metric_type_t metric_type) -{ - if (self == NULL) - return 1; - - if (psb_add_str(self->string_builder, "# TYPE ")) - return 2; - if (prefix != NULL && psb_add_str(self->string_builder, prefix)) - return 3; - if (psb_add_str(self->string_builder, name)) - return 4; - if (psb_add_char(self->string_builder, ' ')) - return 5; - if (psb_add_str(self->string_builder, prom_metric_type_map[metric_type])) - return 6; - - return psb_add_char(self->string_builder, '\n') ? 7 : 0; +int prom_metric_formatter_load_type(prom_metric_formatter_t *self, const char *name, prom_metric_type_t metric_type) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + + int r = 0; + + r = prom_string_builder_add_str(self->string_builder, "# TYPE "); + if (r) return r; + + r = prom_string_builder_add_str(self->string_builder, name); + if (r) return r; + + r = prom_string_builder_add_char(self->string_builder, ' '); + if (r) return r; + + r = prom_string_builder_add_str(self->string_builder, prom_metric_type_map[metric_type]); + if (r) return r; + + return prom_string_builder_add_char(self->string_builder, '\n'); } -int -pmf_load_l_value(pmf_t *self, const char *name, const char *suffix, - size_t label_count, const char **label_keys, const char **label_values) -{ - if (self == NULL || name == NULL) - return 1; - - if (psb_add_str(self->string_builder, name)) - return 3; - if (suffix != NULL) { - if (psb_add_char(self->string_builder, '_')) - return 4; - if (psb_add_str(self->string_builder, suffix)) - return 5; - } - if (label_count == 0) - return 0; - - if (psb_add_char(self->string_builder, '{')) - return 6; - for (int i = 0; i < label_count; i++) { - if (psb_add_str(self->string_builder, (const char *) label_keys[i])) - return 7; - if (psb_add_str(self->string_builder, "=\"")) - return 9; - if (psb_add_str(self->string_builder, (const char *) label_values[i])) - return 10; - if (psb_add_str(self->string_builder, "\",")) - return 11; - } - psb_truncate(self->string_builder, psb_len(self->string_builder) - 1); - if (psb_add_char(self->string_builder, '}')) - return 20; - - return 0; +int prom_metric_formatter_load_l_value(prom_metric_formatter_t *self, const char *name, const char *suffix, + size_t label_count, const char **label_keys, const char **label_values) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + + int r = 0; + + r = prom_string_builder_add_str(self->string_builder, name); + if (r) return r; + + if (suffix != NULL) { + r = prom_string_builder_add_char(self->string_builder, '_'); + if (r) return r; + + r = prom_string_builder_add_str(self->string_builder, suffix); + if (r) return r; + } + + if (label_count == 0) return 0; + + for (int i = 0; i < label_count; i++) { + if (i == 0) { + r = prom_string_builder_add_char(self->string_builder, '{'); + if (r) return r; + } + r = prom_string_builder_add_str(self->string_builder, (const char *)label_keys[i]); + if (r) return r; + + r = prom_string_builder_add_char(self->string_builder, '='); + if (r) return r; + + r = prom_string_builder_add_char(self->string_builder, '"'); + if (r) return r; + + r = prom_string_builder_add_str(self->string_builder, (const char *)label_values[i]); + if (r) return r; + + r = prom_string_builder_add_char(self->string_builder, '"'); + if (r) return r; + + if (i == label_count - 1) { + r = prom_string_builder_add_char(self->string_builder, '}'); + if (r) return r; + } else { + r = prom_string_builder_add_char(self->string_builder, ','); + if (r) return r; + } + } + return 0; } -int -pmf_load_sample(pmf_t *self, pms_t *sample, const char *prefix) { - if (self == NULL) - return 1; - if (prefix != NULL) - psb_add_str(self->string_builder, prefix); - if (psb_add_str(self->string_builder, sample->l_value)) - return 2; - char buffer[64]; - sprintf(buffer, " %.17g", sample->r_value); - if (psb_add_str(self->string_builder, buffer)) - return 3; - return psb_add_char(self->string_builder, '\n') ? 4 : 0; +int prom_metric_formatter_load_sample(prom_metric_formatter_t *self, prom_metric_sample_t *sample) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + + int r = 0; + + r = prom_string_builder_add_str(self->string_builder, sample->l_value); + if (r) return r; + + r = prom_string_builder_add_char(self->string_builder, ' '); + if (r) return r; + + char buffer[50]; + sprintf(buffer, "%.17g", sample->r_value); + r = prom_string_builder_add_str(self->string_builder, buffer); + if (r) return r; + + return prom_string_builder_add_char(self->string_builder, '\n'); } -int -pmf_clear(pmf_t *self) { - PROM_ASSERT(self != NULL); - return psb_clear(self->string_builder); +int prom_metric_formatter_clear(prom_metric_formatter_t *self) { + PROM_ASSERT(self != NULL); + return prom_string_builder_clear(self->string_builder); } -char * -pmf_dump(pmf_t *self) { - if (self == NULL) - return NULL; - char *data = psb_dump(self->string_builder); - psb_clear(self->string_builder); - return data; +char *prom_metric_formatter_dump(prom_metric_formatter_t *self) { + PROM_ASSERT(self != NULL); + int r = 0; + if (self == NULL) return NULL; + char *data = prom_string_builder_dump(self->string_builder); + if (data == NULL) return NULL; + r = prom_string_builder_clear(self->string_builder); + if (r) { + prom_free(data); + return NULL; + } + return data; } -int -pmf_load_metric(pmf_t *self, prom_metric_t *metric, const char *prefix, - bool compact) -{ - if (self == NULL) - return 1; - const char *p = (prefix != NULL && strlen(prefix) == 0) ? NULL : prefix; - - if (!compact) { - if (pmf_load_help(self,p,metric->name,metric->help)) - return 2; - if (pmf_load_type(self,p,metric->name,metric->type)) - return 3; - } - for (pll_node_t *current_node = metric->samples->keys->head; - current_node != NULL; current_node = current_node->next) - { - const char *key = (const char *) current_node->item; - if (metric->type == PROM_HISTOGRAM) { - pms_histogram_t *hist_sample = (pms_histogram_t *) - prom_map_get(metric->samples, key); - if (hist_sample == NULL) - return 4; - for (pll_node_t *current_hist_node = - hist_sample->l_value_list->head; current_hist_node != NULL; - current_hist_node = current_hist_node->next) - { - const char *hist_key = (const char *) current_hist_node->item; - pms_t *sample = (pms_t *) - prom_map_get(hist_sample->samples, hist_key); - if (sample == NULL) - return 5; - if (pmf_load_sample(self, sample, p)) - return 6; - } - } else { - pms_t *sample = (pms_t *) prom_map_get(metric->samples, key); - if (sample == NULL) - return 7; - if (pmf_load_sample(self, sample, p)) - return 8; - } - } - return psb_add_char(self->string_builder, '\n') ? 9 : 0; +int prom_metric_formatter_load_metric(prom_metric_formatter_t *self, prom_metric_t *metric) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + + int r = 0; + + r = prom_metric_formatter_load_help(self, metric->name, metric->help); + if (r) return r; + + r = prom_metric_formatter_load_type(self, metric->name, metric->type); + if (r) return r; + + for (prom_linked_list_node_t *current_node = metric->samples->keys->head; current_node != NULL; + current_node = current_node->next) { + const char *key = (const char *)current_node->item; + if (metric->type == PROM_HISTOGRAM) { + prom_metric_sample_histogram_t *hist_sample = + (prom_metric_sample_histogram_t *)prom_map_get(metric->samples, key); + + if (hist_sample == NULL) return 1; + + for (prom_linked_list_node_t *current_hist_node = hist_sample->l_value_list->head; current_hist_node != NULL; + current_hist_node = current_hist_node->next) { + const char *hist_key = (const char *)current_hist_node->item; + prom_metric_sample_t *sample = (prom_metric_sample_t *)prom_map_get(hist_sample->samples, hist_key); + if (sample == NULL) return 1; + r = prom_metric_formatter_load_sample(self, sample); + if (r) return r; + } + } else { + prom_metric_sample_t *sample = (prom_metric_sample_t *)prom_map_get(metric->samples, key); + if (sample == NULL) return 1; + r = prom_metric_formatter_load_sample(self, sample); + if (r) return r; + } + } + return prom_string_builder_add_char(self->string_builder, '\n'); } -int -pmf_load_metrics(pmf_t *self, prom_map_t *collectors, - prom_metric_t *scrape_metric, const char *mprefix, bool compact) -{ - PROM_ASSERT(self != NULL); - int r = 0; - struct timespec start, end; - static const char *labels[] = { "" }; - - for (pll_node_t *current_node = collectors->keys->head; - current_node != NULL; current_node = current_node->next) - { - if (scrape_metric != NULL) - clock_gettime(CLOCK_MONOTONIC, &start); - - const char *cname = (const char *) current_node->item; - prom_collector_t *c = (prom_collector_t *) - prom_map_get(collectors, cname); - if (c == NULL) { - PROM_WARN("Collector '%s' not found.", cname); - r++; - continue; - } - - prom_map_t *metrics = c->collect_fn(c); - if (metrics != NULL) { - for (pll_node_t *current_node = metrics->keys->head; - current_node != NULL; current_node = current_node->next) - { - const char *mname = (const char *) current_node->item; - prom_metric_t *metric = (prom_metric_t *) - prom_map_get(metrics, mname); - if (metric == NULL) { - PROM_WARN("Collector '%s' has no metric named '%s'.", cname, - mname); - r++; - continue; - } - r += pmf_load_metric(self,metric,mprefix,compact); - } - } - if (scrape_metric != NULL) { - int r = clock_gettime(CLOCK_MONOTONIC, &end); - time_t s = (r == 0) ? end.tv_sec - start.tv_sec : 0; - long ns = (r == 0) ? end.tv_nsec - start.tv_nsec : 0; - double duration = s + ns*1e-9; - labels[0] = cname; - prom_gauge_set(scrape_metric, duration, labels); - } - } - return r; +int prom_metric_formatter_load_metrics(prom_metric_formatter_t *self, prom_map_t *collectors) { + PROM_ASSERT(self != NULL); + int r = 0; + for (prom_linked_list_node_t *current_node = collectors->keys->head; current_node != NULL; + current_node = current_node->next) { + const char *collector_name = (const char *)current_node->item; + prom_collector_t *collector = (prom_collector_t *)prom_map_get(collectors, collector_name); + if (collector == NULL) return 1; + + prom_map_t *metrics = collector->collect_fn(collector); + if (metrics == NULL) return 1; + + for (prom_linked_list_node_t *current_node = metrics->keys->head; current_node != NULL; + current_node = current_node->next) { + const char *metric_name = (const char *)current_node->item; + prom_metric_t *metric = (prom_metric_t *)prom_map_get(metrics, metric_name); + if (metric == NULL) return 1; + r = prom_metric_formatter_load_metric(self, metric); + if (r) return r; + } + } + return r; } diff --git a/prom/src/prom_metric_formatter_i.h b/prom/src/prom_metric_formatter_i.h index 483b9d7..88eb93c 100644 --- a/prom/src/prom_metric_formatter_i.h +++ b/prom/src/prom_metric_formatter_i.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,67 +19,66 @@ #ifndef PROM_METRIC_FORMATTER_I_H #define PROM_METRIC_FORMATTER_I_H -#include <stdbool.h> - // Private #include "prom_metric_formatter_t.h" #include "prom_metric_t.h" /** - * @brief PRIVATE prom_metric_formatter constructor + * @brief API PRIVATE prom_metric_formatter constructor */ -pmf_t *pmf_new(); +prom_metric_formatter_t *prom_metric_formatter_new(); /** - * @brief PRIVATE prom_metric_formatter destructor + * @brief API PRIVATE prom_metric_formatter destructor */ -int pmf_destroy(pmf_t *self); +int prom_metric_formatter_destroy(prom_metric_formatter_t *self); /** - * @brief PRIVATE Loads the help text + * @brief API PRIVATE Loads the help text */ -int pmf_load_help(pmf_t *self, const char *prefix, const char *name, const char *help); +int prom_metric_formatter_load_help(prom_metric_formatter_t *self, const char *name, const char *help); /** - * @brief PRIVATE Loads the type text + * @brief API PRIVATE Loads the type text */ -int pmf_load_type(pmf_t *self, const char *prefix, const char *name, prom_metric_type_t metric_type); +int prom_metric_formatter_load_type(prom_metric_formatter_t *self, const char *name, prom_metric_type_t metric_type); /** - * @brief PRIVATE Loads the formatter with a metric sample L-value + * @brief API PRIVATE Loads the formatter with a metric sample L-value * @param name The metric name - * @param suffix The metric suffix for Summary and Histogram metric types. + * @param suffix The metric suffix. This is applicable to Summary and Histogram metric types. * @param label_count The number of labels for the given metric. * @param label_keys An array of constant strings. * @param label_values An array of constant strings. * * The number of const char **and prom_label_value must be the same. */ -int pmf_load_l_value(pmf_t *metric_formatter, const char *name, const char *suffix, size_t label_count, const char **label_keys, const char **label_values); +int prom_metric_formatter_load_l_value(prom_metric_formatter_t *metric_formatter, const char *name, const char *suffix, + size_t label_count, const char **label_keys, const char **label_values); /** - * @brief PRIVATE Loads the formatter with a metric sample + * @brief API PRIVATE Loads the formatter with a metric sample */ -int pmf_load_sample(pmf_t *metric_formatter, pms_t *sample, const char *prefix); +int prom_metric_formatter_load_sample(prom_metric_formatter_t *metric_formatter, prom_metric_sample_t *sample); /** - * @brief PRIVATE Loads a metric in the string exposition format + * @brief API PRIVATE Loads a metric in the string exposition format */ -int pmf_load_metric(pmf_t *self, prom_metric_t *metric, const char *prefix, bool compact); +int prom_metric_formatter_load_metric(prom_metric_formatter_t *self, prom_metric_t *metric); /** - * @brief PRIVATE Loads the given metrics + * @brief API PRIVATE Loads the given metrics */ -int pmf_load_metrics(pmf_t *self, prom_map_t *collectors, prom_metric_t *scrape_metric, const char *prefix, bool compact); +int prom_metric_formatter_load_metrics(prom_metric_formatter_t *self, prom_map_t *collectors); /** - * @brief PRIVATE Clear the underlying string_builder + * @brief API PRIVATE Clear the underlying string_builder */ -int pmf_clear(pmf_t *self); +int prom_metric_formatter_clear(prom_metric_formatter_t *self); /** - * @brief PRIVATE Returns the string built by prom_metric_formatter + * @brief API PRIVATE Returns the string built by prom_metric_formatter */ -char *pmf_dump(pmf_t *metric_formatter); +char *prom_metric_formatter_dump(prom_metric_formatter_t *metric_formatter); #endif // PROM_METRIC_FORMATTER_I_H diff --git a/prom/src/prom_metric_formatter_t.h b/prom/src/prom_metric_formatter_t.h index 65d0787..5e50f4b 100644 --- a/prom/src/prom_metric_formatter_t.h +++ b/prom/src/prom_metric_formatter_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +17,11 @@ #ifndef PROM_METRIC_FORMATTER_T_H #define PROM_METRIC_FORMATTER_T_H -#include "prom_string_builder.h" +#include "prom_string_builder_t.h" -typedef struct pmf { - psb_t *string_builder; - psb_t *err_builder; -} pmf_t; +typedef struct prom_metric_formatter { + prom_string_builder_t *string_builder; + prom_string_builder_t *err_builder; +} prom_metric_formatter_t; #endif // PROM_METRIC_FORMATTER_T_H diff --git a/prom/src/prom_metric_i.h b/prom/src/prom_metric_i.h index cfa3ffd..9fb1b1d 100644 --- a/prom/src/prom_metric_i.h +++ b/prom/src/prom_metric_i.h @@ -22,22 +22,23 @@ #define PROM_METRIC_I_INCLUDED /** - * @brief PRIVATE Returns a *prom_metric + * @brief API PRIVATE Returns a *prom_metric */ -prom_metric_t *prom_metric_new(prom_metric_type_t type, const char *name, const char *help, size_t label_key_count, const char **label_keys); +prom_metric_t *prom_metric_new(prom_metric_type_t type, const char *name, const char *help, size_t label_key_count, + const char **label_keys); /** - * @brief PRIVATE Destroys a *prom_metric + * @brief API PRIVATE Destroys a *prom_metric */ int prom_metric_destroy(prom_metric_t *self); /** - * @brief PRIVATE Cast given item to *prom_metric_t and destroy it + * @brief API PRIVATE takes a generic item, casts to a *prom_metric_t and destroys it */ int prom_metric_destroy_generic(void *item); /** - * @brief PRIVATE Casts given item to *prom_metric_t and destroy it. + * @brief API Private takes a generic item, casts to a *prom_metric_t and destroys it. Discards any errors. */ void prom_metric_free_generic(void *item); diff --git a/prom/src/prom_metric_sample.c b/prom/src/prom_metric_sample.c index 258fb78..6862548 100644 --- a/prom/src/prom_metric_sample.c +++ b/prom/src/prom_metric_sample.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,74 +26,72 @@ #include "prom_metric_sample_i.h" #include "prom_metric_sample_t.h" -pms_t * -pms_new(prom_metric_type_t type, const char *l_val, double r_val) { - pms_t *self = (pms_t *) prom_malloc(sizeof(pms_t)); - if (self == NULL) - return NULL; - self->type = type; - self->l_value = prom_strdup(l_val); - self->r_value = ATOMIC_VAR_INIT(r_val); - return self; +prom_metric_sample_t *prom_metric_sample_new(prom_metric_type_t type, const char *l_value, double r_value) { + prom_metric_sample_t *self = (prom_metric_sample_t *)prom_malloc(sizeof(prom_metric_sample_t)); + self->type = type; + self->l_value = prom_strdup(l_value); + self->r_value = ATOMIC_VAR_INIT(r_value); + return self; } -int -pms_destroy(pms_t *self) { - if (self == NULL) - return 0; - prom_free((void *) self->l_value); - self->l_value = NULL; - prom_free((void *) self); - return 0; +int prom_metric_sample_destroy(prom_metric_sample_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + prom_free((void *)self->l_value); + self->l_value = NULL; + prom_free((void *)self); + self = NULL; + return 0; } -int -pms_destroy_generic(void *gen) { - return pms_destroy((pms_t *) gen); +int prom_metric_sample_destroy_generic(void *gen) { + int r = 0; + + prom_metric_sample_t *self = (prom_metric_sample_t *)gen; + r = prom_metric_sample_destroy(self); + self = NULL; + return r; } -void -pms_free_generic(void *gen) { - pms_destroy((pms_t *) gen); +void prom_metric_sample_free_generic(void *gen) { + prom_metric_sample_t *self = (prom_metric_sample_t *)gen; + prom_metric_sample_destroy(self); } -int -pms_add(pms_t *self, double r_value) { - PROM_ASSERT(self != NULL); - if (r_value < 0) - return 1; - _Atomic double old = atomic_load(&self->r_value); - for (;;) { - _Atomic double new = ATOMIC_VAR_INIT(old + r_value); - if (atomic_compare_exchange_weak(&self->r_value, &old, new)) - return 0; - } +int prom_metric_sample_add(prom_metric_sample_t *self, double r_value) { + PROM_ASSERT(self != NULL); + if (r_value < 0) { + return 1; + } + _Atomic double old = atomic_load(&self->r_value); + for (;;) { + _Atomic double new = ATOMIC_VAR_INIT(old + r_value); + if (atomic_compare_exchange_weak(&self->r_value, &old, new)) { + return 0; + } + } } -int -pms_sub(pms_t *self, double r_value) { - PROM_ASSERT(self != NULL); - if (self->type != PROM_GAUGE) { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s = %s", - self->type, self->l_value, self->r_value); - return 1; - } - _Atomic double old = atomic_load(&self->r_value); - for (;;) { - _Atomic double new = ATOMIC_VAR_INIT(old - r_value); - if (atomic_compare_exchange_weak(&self->r_value, &old, new)) - return 0; - } +int prom_metric_sample_sub(prom_metric_sample_t *self, double r_value) { + PROM_ASSERT(self != NULL); + if (self->type != PROM_GAUGE) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + _Atomic double old = atomic_load(&self->r_value); + for (;;) { + _Atomic double new = ATOMIC_VAR_INIT(old - r_value); + if (atomic_compare_exchange_weak(&self->r_value, &old, new)) { + return 0; + } + } } -int -pms_set(pms_t *self, double r_value) { - if (self->type != PROM_GAUGE && (self->type != PROM_COUNTER || r_value < 0)) - { - PROM_WARN(PROM_METRIC_INCORRECT_TYPE " (%d) - %s = %s", - self->type, self->l_value, self->r_value); - return 1; - } - atomic_store(&self->r_value, r_value); - return 0; +int prom_metric_sample_set(prom_metric_sample_t *self, double r_value) { + if (self->type != PROM_GAUGE) { + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } + atomic_store(&self->r_value, r_value); + return 0; } diff --git a/prom/src/prom_metric_sample_histogram.c b/prom/src/prom_metric_sample_histogram.c index 000ac62..eca956d 100644 --- a/prom/src/prom_metric_sample_histogram.c +++ b/prom/src/prom_metric_sample_histogram.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,367 +31,479 @@ #include "prom_metric_sample_histogram_i.h" #include "prom_metric_sample_i.h" -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Static Declarations -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static const char *l_value_for_bucket(pms_histogram_t *self, const char *name, size_t label_count, const char **label_keys, const char **label_values, const char *bucket_key); +static const char *prom_metric_sample_histogram_l_value_for_bucket(prom_metric_sample_histogram_t *self, + const char *name, size_t label_count, + const char **label_keys, const char **label_values, + double bucket); -static const char *l_value_for_inf(pms_histogram_t *self, const char *name, size_t label_count, const char **label_keys, const char **label_values); +static const char *prom_metric_sample_histogram_l_value_for_inf(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values); -static void free_str_generic(void *gen); +static void prom_metric_sample_histogram_free_str_generic(void *gen); -static int init_bucket_samples(pms_histogram_t *self, const char *name, size_t label_count, const char **label_keys, const char **label_values); +static int prom_metric_sample_histogram_init_bucket_samples(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values); -static int init_inf(pms_histogram_t *self, const char *name, size_t label_count, const char **label_keys, const char **label_values); +static int prom_metric_sample_histogram_init_inf(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values); -static int init_count(pms_histogram_t *self, const char *name, size_t label_count, const char **label_keys, const char **label_values); +static int prom_metric_sample_histogram_init_count(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values); -static int init_summary(pms_histogram_t *self, const char *name, size_t label_count, const char **label_keys, const char **label_values); +static int prom_metric_sample_histogram_init_summary(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values); -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // End static declarations -////////////////////////////////////////////////////////////////////////////// - -pms_histogram_t * -pms_histogram_new(const char *name, phb_t *buckets, size_t label_count, - const char **label_keys, const char **label_values) -{ - // Allocate and set self - pms_histogram_t *self = (pms_histogram_t *) - prom_malloc(sizeof(pms_histogram_t)); - if (self == NULL) - return NULL; - memset(self, 0, sizeof(pms_histogram_t)); - - // Allocate and set the l_value_list - if ((self->l_value_list = pll_new()) == NULL) - goto fail; - // Allocate and set the metric formatter - if ((self->metric_formatter = pmf_new()) == NULL) - goto fail; - // Store map of l_value/pms_t - if ((self->samples = prom_map_new()) == NULL) - goto fail; - // Set the free value function on the samples map - if (prom_map_set_free_value_fn(self->samples, &pms_free_generic)) - goto fail; - // Store map of bucket/l_value - if ((self->l_values = prom_map_new()) == NULL) - goto fail; - // Set the free value function for thhe l_values map - if (prom_map_set_free_value_fn(self->l_values, free_str_generic)) - goto fail; - self->buckets = buckets; - // Allocate and initialize the lock - self->rwlock = (pthread_rwlock_t *) prom_malloc(sizeof(pthread_rwlock_t)); - if (self->rwlock == NULL || pthread_rwlock_init(self->rwlock, NULL)) - goto fail; - // Allocate and initialize bucket metric samples - if (init_bucket_samples(self, name, label_count, label_keys, label_values)) - goto fail; - // Allocate and initialize the +Inf metric sample - if (init_inf(self, name, label_count, label_keys, label_values)) - goto fail; - // Allocate and initialize the count metric sample - if (init_count(self, name, label_count, label_keys, label_values)) - goto fail; - // Add summary sample - if (init_summary(self, name, label_count, label_keys, label_values)) - goto fail; - // The value of nodes in this map will be simple pms pointers - if (prom_map_set_free_value_fn(self->samples, &pms_free_generic)) - goto fail; - - return self; - -fail: - pms_histogram_destroy(self); - return NULL; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +prom_metric_sample_histogram_t *prom_metric_sample_histogram_new(const char *name, prom_histogram_buckets_t *buckets, + size_t label_count, const char **label_keys, + const char **label_values) { + // Capture return codes + int r = 0; + + // Allocate and set self + prom_metric_sample_histogram_t *self = + (prom_metric_sample_histogram_t *)prom_malloc(sizeof(prom_metric_sample_histogram_t)); + + // Allocate and set the l_value_list + self->l_value_list = prom_linked_list_new(); + if (self->l_value_list == NULL) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Allocate and set the metric formatter + self->metric_formatter = prom_metric_formatter_new(); + if (self->metric_formatter == NULL) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Store map of l_value/prom_metric_sample_t + self->samples = prom_map_new(); + if (self->samples == NULL) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Set the free value function on the samples map + r = prom_map_set_free_value_fn(self->samples, &prom_metric_sample_free_generic); + if (r) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Set a map of bucket: l_value + self->l_values = prom_map_new(); // Store map of bucket/l_value + if (self->l_values == NULL) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Set the free value function for thhe l_values map + r = prom_map_set_free_value_fn(self->l_values, prom_metric_sample_histogram_free_str_generic); + if (r) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + self->buckets = buckets; + + // Allocate and initialize the lock + self->rwlock = (pthread_rwlock_t *)prom_malloc(sizeof(pthread_rwlock_t)); + r = pthread_rwlock_init(self->rwlock, NULL); + if (r) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Allocate and initialize bucket metric samples + r = prom_metric_sample_histogram_init_bucket_samples(self, name, label_count, label_keys, label_values); + if (r) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Allocate and initialize the +Inf metric sample + r = prom_metric_sample_histogram_init_inf(self, name, label_count, label_keys, label_values); + if (r) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Allocate and initialize the count metric sample + r = prom_metric_sample_histogram_init_count(self, name, label_count, label_keys, label_values); + if (r) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // Add summary sample + r = prom_metric_sample_histogram_init_summary(self, name, label_count, label_keys, label_values); + if (r) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + + // The value of nodes in this map will be simple prom_metric_sample pointers. + r = prom_map_set_free_value_fn(self->samples, &prom_metric_sample_free_generic); + if (r) { + prom_metric_sample_histogram_destroy(self); + return NULL; + } + return self; } -static int -init_bucket_samples(pms_histogram_t *self, const char *name, size_t label_count, - const char **label_keys, const char **label_values) -{ - PROM_ASSERT(self); - int bucket_count = phb_count(self->buckets); - - // For each bucket, create an pms_t with an appropriate - // l_value and default value of 0.0. The l_value will contain the metric - // name, user labels, and finally, the le label and bucket value. - for (int i = 0; i < bucket_count; i++) { - const char *bucket_key = self->buckets->key[i]; - if (bucket_key == NULL) - return 3; - const char *l_value = l_value_for_bucket(self, name, label_count, - label_keys, label_values, bucket_key); - if (l_value == NULL) - return 1; - if (pll_append(self->l_value_list, prom_strdup(l_value))) - return 2; - if (prom_map_set(self->l_values, bucket_key, (char *) l_value)) - return 4; - pms_t *sample = pms_new(PROM_HISTOGRAM, l_value, 0.0); - if (sample == NULL) - return 5; - if (prom_map_set(self->samples, l_value, sample)) - return 6; - } - return 0; +static int prom_metric_sample_histogram_init_bucket_samples(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values) { + PROM_ASSERT(self); + int r = 0; + int bucket_count = prom_histogram_buckets_count(self->buckets); + + // For each bucket, create an prom_metric_sample_t with an appropriate l_value and default value of 0.0. The + // l_value will contain the metric name, user labels, and finally, the le label and bucket value. + for (int i = 0; i < bucket_count; i++) { + const char *l_value = prom_metric_sample_histogram_l_value_for_bucket(self, name, label_count, label_keys, + label_values, self->buckets->upper_bounds[i]); + if (l_value == NULL) return 1; + + r = prom_linked_list_append(self->l_value_list, prom_strdup(l_value)); + if (r) return r; + + const char *bucket_key = prom_metric_sample_histogram_bucket_to_str(self->buckets->upper_bounds[i]); + if (bucket_key == NULL) return 1; + + r = prom_map_set(self->l_values, bucket_key, (char *)l_value); + if (r) return r; + + prom_metric_sample_t *sample = prom_metric_sample_new(PROM_HISTOGRAM, l_value, 0.0); + if (sample == NULL) return 1; + + r = prom_map_set(self->samples, l_value, sample); + if (r) return r; + + prom_free((void *)bucket_key); + } + return 0; } -static int -init_inf(pms_histogram_t *self, const char *name, size_t label_count, - const char **label_keys, const char **label_values) -{ - PROM_ASSERT(self != NULL); - const char *inf_l_value = - l_value_for_inf(self, name, label_count, label_keys, label_values); - if (inf_l_value == NULL) - return 1; - - if (pll_append(self->l_value_list, prom_strdup(inf_l_value))) - return 2; - if (prom_map_set(self->l_values, "+Inf", (char *) inf_l_value)) - return 3; - pms_t *inf_sample = pms_new(PROM_HISTOGRAM, (char *) inf_l_value, 0.0); - if (inf_sample == NULL) - return 4; - return prom_map_set(self->samples, inf_l_value, inf_sample); +static int prom_metric_sample_histogram_init_inf(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values) { + PROM_ASSERT(self != NULL); + int r = 0; + const char *inf_l_value = + prom_metric_sample_histogram_l_value_for_inf(self, name, label_count, label_keys, label_values); + if (inf_l_value == NULL) return 1; + + r = prom_linked_list_append(self->l_value_list, prom_strdup(inf_l_value)); + if (r) return r; + + r = prom_map_set(self->l_values, "+Inf", (char *)inf_l_value); + if (r) return r; + + prom_metric_sample_t *inf_sample = prom_metric_sample_new(PROM_HISTOGRAM, (char *)inf_l_value, 0.0); + if (inf_sample == NULL) return 1; + + return prom_map_set(self->samples, inf_l_value, inf_sample); } -static int -init_count(pms_histogram_t *self, const char *name, - size_t label_count, const char **label_keys, const char **label_values) -{ - PROM_ASSERT(self != NULL); - if (pmf_load_l_value(self->metric_formatter, name, "count", label_count, - label_keys, label_values)) - { - return 1; - } - - const char *count_l_val = pmf_dump(self->metric_formatter); - if (count_l_val == NULL) - return 1; - if (pll_append(self->l_value_list, prom_strdup(count_l_val))) - return 2; - if (prom_map_set(self->l_values, "count", (char *) count_l_val)) - return 3; - pms_t *count_sample = pms_new(PROM_HISTOGRAM, count_l_val, 0.0); - if (count_sample == NULL) - return 1; - return prom_map_set(self->samples, count_l_val, count_sample); +static int prom_metric_sample_histogram_init_count(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values) { + PROM_ASSERT(self != NULL); + int r = 0; + + r = prom_metric_formatter_load_l_value(self->metric_formatter, name, "count", label_count, label_keys, label_values); + if (r) return r; + + const char *count_l_value = prom_metric_formatter_dump(self->metric_formatter); + if (count_l_value == NULL) return 1; + + r = prom_linked_list_append(self->l_value_list, prom_strdup(count_l_value)); + if (r) return r; + + r = prom_map_set(self->l_values, "count", (char *)count_l_value); + if (r) return r; + + prom_metric_sample_t *count_sample = prom_metric_sample_new(PROM_HISTOGRAM, count_l_value, 0.0); + if (count_sample == NULL) return 1; + + return prom_map_set(self->samples, count_l_value, count_sample); } -static int -init_summary(pms_histogram_t *self, const char *name, size_t label_count, - const char **label_keys, const char **label_values) -{ - PROM_ASSERT(self != NULL); - if (pmf_load_l_value(self->metric_formatter, name, "sum", label_count, - label_keys, label_values)) - { - return 1; - } - const char *sum_l_val = pmf_dump(self->metric_formatter); - if (sum_l_val == NULL) - return 2; - - if (pll_append(self->l_value_list, prom_strdup(sum_l_val))) - return 3; - if (prom_map_set(self->l_values, "sum", (char *) sum_l_val)) - return 4; - - pms_t *sum_sample = pms_new(PROM_HISTOGRAM, sum_l_val, 0.0); - if (sum_sample == NULL) - return 1; - - return prom_map_set(self->samples, sum_l_val, sum_sample); +static int prom_metric_sample_histogram_init_summary(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values) { + PROM_ASSERT(self != NULL); + int r = 0; + + r = prom_metric_formatter_load_l_value(self->metric_formatter, name, "sum", label_count, label_keys, label_values); + if (r) return r; + + const char *sum_l_value = prom_metric_formatter_dump(self->metric_formatter); + if (sum_l_value == NULL) return 1; + + r = prom_linked_list_append(self->l_value_list, prom_strdup(sum_l_value)); + if (r) return r; + + r = prom_map_set(self->l_values, "sum", (char *)sum_l_value); + if (r) return r; + + prom_metric_sample_t *sum_sample = prom_metric_sample_new(PROM_HISTOGRAM, sum_l_value, 0.0); + if (sum_sample == NULL) return 1; + + return prom_map_set(self->samples, sum_l_value, sum_sample); } -int -pms_histogram_destroy(pms_histogram_t *self) { - if (self == NULL) - return 0; +int prom_metric_sample_histogram_destroy(prom_metric_sample_histogram_t *self) { + PROM_ASSERT(self != NULL); + int r = 0; + int ret = 0; + + if (self == NULL) return 0; + + r = prom_linked_list_destroy(self->l_value_list); + self->l_value_list = NULL; + if (r) ret = r; - pll_destroy(self->l_value_list); - self->l_value_list = NULL; + r = prom_map_destroy(self->samples); + if (r) ret = r; + self->samples = NULL; - prom_map_destroy(self->samples); - self->samples = NULL; + r = prom_map_destroy(self->l_values); + if (r) ret = r; + self->l_values = NULL; - prom_map_destroy(self->l_values); - self->l_values = NULL; + r = prom_metric_formatter_destroy(self->metric_formatter); + if (r) ret = r; + self->metric_formatter = NULL; - pmf_destroy(self->metric_formatter); - self->metric_formatter = NULL; + r = pthread_rwlock_destroy(self->rwlock); + if (r) ret = r; + + prom_free(self->rwlock); + self->rwlock = NULL; + + prom_free(self); + self = NULL; + return ret; +} - pthread_rwlock_destroy(self->rwlock); - prom_free(self->rwlock); - self->rwlock = NULL; +int prom_metric_sample_histogram_destroy_generic(void *gen) { + int r = 0; - prom_free(self); - return 0; + prom_metric_sample_histogram_t *self = (prom_metric_sample_histogram_t *)gen; + r = prom_metric_sample_histogram_destroy(self); + self = NULL; + return r; } -int -pms_histogram_destroy_generic(void *g) { - return pms_histogram_destroy((pms_histogram_t *) g); +void prom_metric_sample_histogram_free_generic(void *gen) { + prom_metric_sample_histogram_t *self = (prom_metric_sample_histogram_t *)gen; + prom_metric_sample_histogram_destroy(self); } -void -pms_histogram_free_generic(void *gen) { - pms_histogram_destroy((pms_histogram_t *) gen); +int prom_metric_sample_histogram_observe(prom_metric_sample_histogram_t *self, double value) { + int r = 0; + + r = pthread_rwlock_wrlock(self->rwlock); + if (r) { + printf("RETURN CODE: %d\n", r); + PROM_LOG(PROM_PTHREAD_RWLOCK_LOCK_ERROR); + return r; + } + +#define PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(r) \ + int rr = 0; \ + rr = pthread_rwlock_unlock(self->rwlock); \ + if (rr) { \ + PROM_LOG(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR); \ + return rr; \ + } else { \ + return r; \ + } + + // Update the counter for the proper bucket if found + int bucket_count = prom_histogram_buckets_count(self->buckets); + for (int i = (bucket_count - 1); i >= 0; i--) { + if (value > self->buckets->upper_bounds[i]) { + break; + } + + const char *bucket_key = prom_metric_sample_histogram_bucket_to_str(self->buckets->upper_bounds[i]); + if (bucket_key == NULL) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1) + } + + const char *l_value = prom_map_get(self->l_values, bucket_key); + if (l_value == NULL) { + prom_free((void *)bucket_key); + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1) + } + + prom_metric_sample_t *sample = prom_map_get(self->samples, l_value); + if (sample == NULL) { + prom_free((void *)bucket_key); + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1) + } + + prom_free((void *)bucket_key); + r = prom_metric_sample_add(sample, 1.0); + if (r) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(r); + } + } + + // Update the +Inf and count samples + const char *inf_l_value = prom_map_get(self->l_values, "+Inf"); + if (inf_l_value == NULL) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1); + } + + prom_metric_sample_t *inf_sample = prom_map_get(self->samples, inf_l_value); + if (inf_sample == NULL) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1); + } + + r = prom_metric_sample_add(inf_sample, 1.0); + if (r) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1); + } + + const char *count_l_value = prom_map_get(self->l_values, "count"); + if (count_l_value == NULL) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1); + } + + prom_metric_sample_t *count_sample = prom_map_get(self->samples, count_l_value); + if (count_sample == NULL) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1); + } + + r = prom_metric_sample_add(count_sample, 1.0); + if (r) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1); + } + + // Update the sum sample + const char *sum_l_value = prom_map_get(self->l_values, "sum"); + if (sum_l_value == NULL) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1); + } + + prom_metric_sample_t *sum_sample = prom_map_get(self->samples, sum_l_value); + if (sum_sample == NULL) { + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(1); + } + + r = prom_metric_sample_add(sum_sample, value); + PROM_METRIC_SAMPLE_HISTOGRAM_OBSERVE_HANDLE_UNLOCK(r); + return r; } -int -pms_histogram_observe(pms_histogram_t *self, double value) { - int err = 2; - if (pthread_rwlock_wrlock(self->rwlock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_LOCK_ERROR, NULL); - return 1; - } - - // Update the counter for the proper bucket if found - int bucket_count = phb_count(self->buckets); - for (int i = (bucket_count - 1); i >= 0; i--) { - if (value > self->buckets->upper_bound[i]) - break; - const char *bucket_key = self->buckets->key[i]; - if (bucket_key == NULL) - goto end; - const char *l_value = prom_map_get(self->l_values, bucket_key); - if (l_value == NULL) - goto end; - - pms_t *sample = prom_map_get(self->samples, l_value); - if (sample == NULL) - goto end; - - if (pms_add(sample, 1.0)) - goto end; - } - - // Update the +Inf and count samples - const char *inf_l_value = prom_map_get(self->l_values, "+Inf"); - if (inf_l_value == NULL) - goto end; - pms_t *inf_sample = prom_map_get(self->samples, inf_l_value); - if (inf_sample == NULL) - goto end; - if (pms_add(inf_sample, 1.0)) - goto end; - const char *count_l_value = prom_map_get(self->l_values, "count"); - if (count_l_value == NULL) - goto end; - pms_t *count_sample = prom_map_get(self->samples, count_l_value); - if (count_sample == NULL) - goto end; - if (pms_add(count_sample, 1.0)) - goto end; - - // Update the sum sample - const char *sum_l_value = prom_map_get(self->l_values, "sum"); - if (sum_l_value == NULL) - goto end; - pms_t *sum_sample = prom_map_get(self->samples, sum_l_value); - if (sum_sample == NULL) - goto end; - if (pms_add(sum_sample, value)) - goto end; - - err = 0; - -end: - if (pthread_rwlock_unlock(self->rwlock)) { - PROM_WARN(PROM_PTHREAD_RWLOCK_UNLOCK_ERROR, NULL); - err = 3; - } - return err; +static const char *prom_metric_sample_histogram_l_value_for_bucket(prom_metric_sample_histogram_t *self, + const char *name, size_t label_count, + const char **label_keys, const char **label_values, + double bucket) { + PROM_ASSERT(self != NULL); + int r = 0; + +#define PROM_METRIC_SAMPLE_HISTOGRAM_L_VALUE_FOR_BUCKET_CLEANUP() \ + for (size_t i = 0; i < label_count + 1; i++) { \ + prom_free((char *)new_keys[i]); \ + prom_free((char *)new_values[i]); \ + } \ + prom_free(new_keys); \ + prom_free(new_values); + + // Make new array to hold label_keys with le label key + const char **new_keys = (const char **)prom_malloc((label_count + 1) * sizeof(char *)); + for (size_t i = 0; i < label_count; i++) { + new_keys[i] = prom_strdup(label_keys[i]); + } + new_keys[label_count] = prom_strdup("le"); + + // Make new array to hold label_values with le label value + const char **new_values = (const char **)prom_malloc((label_count + 1) * sizeof(char *)); + for (size_t i = 0; i < label_count; i++) { + new_values[i] = prom_strdup(label_values[i]); + } + + new_values[label_count] = prom_metric_sample_histogram_bucket_to_str(bucket); + + r = prom_metric_formatter_load_l_value(self->metric_formatter, name, NULL, label_count + 1, new_keys, new_values); + if (r) { + PROM_METRIC_SAMPLE_HISTOGRAM_L_VALUE_FOR_BUCKET_CLEANUP(); + return NULL; + } + const char *ret = (const char *)prom_metric_formatter_dump(self->metric_formatter); + PROM_METRIC_SAMPLE_HISTOGRAM_L_VALUE_FOR_BUCKET_CLEANUP(); + return ret; } -static const char * -l_value_for_bucket(pms_histogram_t *self, const char *name, size_t label_count, - const char **label_keys, const char **label_values, const char *bucket_key) -{ - PROM_ASSERT(self != NULL); - - // Make new array to hold label_keys with le label key - const char **new_keys = (const char **) - prom_malloc((label_count + 1) * sizeof(char *)); - if (new_keys == NULL) - return NULL; - // Make new array to hold label_values with le label value - const char **new_values = (const char **) - prom_malloc((label_count + 1) * sizeof(char *)); - if (new_keys == NULL) { - prom_free(new_keys); - return NULL; - } - for (size_t i = 0; i < label_count; i++) { - new_keys[i] = prom_strdup(label_keys[i]); - new_values[i] = prom_strdup(label_values[i]); - } - new_keys[label_count] = prom_strdup("le"); - new_values[label_count] = prom_strdup(bucket_key); - - const char *ret = pmf_load_l_value(self->metric_formatter, name, "bucket", - label_count + 1, new_keys, new_values) - ? NULL - : (const char *) pmf_dump(self->metric_formatter); - - for (size_t i = 0; i < label_count + 1; i++) { - prom_free((char *) new_keys[i]); - prom_free((char *) new_values[i]); - } - prom_free(new_keys); - prom_free(new_values); - return ret; +static const char *prom_metric_sample_histogram_l_value_for_inf(prom_metric_sample_histogram_t *self, const char *name, + size_t label_count, const char **label_keys, + const char **label_values) { + PROM_ASSERT(self != NULL); + int r = 0; + +#define PROM_METRIC_SAMPLE_HISTOGRAM_L_VALUE_FOR_INF_CLEANUP() \ + for (size_t i = 0; i < label_count + 1; i++) { \ + prom_free((char *)new_keys[i]); \ + prom_free((char *)new_values[i]); \ + } \ + prom_free(new_keys); \ + prom_free(new_values); + + // Make new array to hold label_keys with le label key + const char **new_keys = (const char **)prom_malloc((label_count + 1) * sizeof(char *)); + for (size_t i = 0; i < label_count; i++) { + new_keys[i] = prom_strdup(label_keys[i]); + } + new_keys[label_count] = prom_strdup("le"); + + // Make new array to hold label_values with le label value + const char **new_values = (const char **)prom_malloc((label_count + 1) * sizeof(char *)); + for (size_t i = 0; i < label_count; i++) { + new_values[i] = prom_strdup(label_values[i]); + } + + new_values[label_count] = prom_strdup("+Inf"); + + r = prom_metric_formatter_load_l_value(self->metric_formatter, name, NULL, label_count + 1, new_keys, new_values); + if (r) { + PROM_METRIC_SAMPLE_HISTOGRAM_L_VALUE_FOR_INF_CLEANUP() + return NULL; + } + const char *ret = (const char *)prom_metric_formatter_dump(self->metric_formatter); + PROM_METRIC_SAMPLE_HISTOGRAM_L_VALUE_FOR_INF_CLEANUP() + return ret; } -static const char * -l_value_for_inf(pms_histogram_t *self, const char *name, size_t label_count, - const char **label_keys, const char **label_values) -{ - PROM_ASSERT(self != NULL); - - // Make new array to hold label_keys with le label key - const char **new_keys = (const char **) - prom_malloc((label_count + 1) * sizeof(char *)); - if (new_keys == NULL) - return NULL; - // Make new array to hold label_values with le label value - const char **new_values = (const char **) - prom_malloc((label_count + 1) * sizeof(char *)); - if (new_keys == NULL) { - prom_free(new_keys); - return NULL; - } - - for (size_t i = 0; i < label_count; i++) { - new_keys[i] = prom_strdup(label_keys[i]); - new_values[i] = prom_strdup(label_values[i]); - } - new_keys[label_count] = prom_strdup("le"); - new_values[label_count] = prom_strdup("+Inf"); - - const char *ret = pmf_load_l_value(self->metric_formatter, name, "bucket", - label_count + 1, new_keys, new_values) - ? NULL - : (const char *) pmf_dump(self->metric_formatter); - - for (size_t i = 0; i < label_count + 1; i++) { - prom_free((char *) new_keys[i]); - prom_free((char *) new_values[i]); - } - prom_free(new_keys); - prom_free(new_values); - return ret; +static void prom_metric_sample_histogram_free_str_generic(void *gen) { + char *str = (char *)gen; + prom_free((void *)str); + str = NULL; } -static void -free_str_generic(void *gen) { - prom_free((void *) gen); +char *prom_metric_sample_histogram_bucket_to_str(double bucket) { + char *buf = (char *)prom_malloc(sizeof(char) * 50); + sprintf(buf, "%g", bucket); + if (!strchr(buf, '.')) { + strcat(buf, ".0"); + } + return buf; } diff --git a/prom/src/prom_metric_sample_histogram_i.h b/prom/src/prom_metric_sample_histogram_i.h index 056b77b..325ca12 100644 --- a/prom/src/prom_metric_sample_histogram_i.h +++ b/prom/src/prom_metric_sample_histogram_i.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,20 +24,24 @@ #include "prom_metric_sample_histogram_t.h" /** - * @brief PRIVATE Create a pointer to a pms_histogram_t + * @brief API PRIVATE Create a pointer to a prom_metric_sample_histogram_t */ -pms_histogram_t *pms_histogram_new(const char *name, phb_t *buckets, size_t label_count, const char **label_keys, const char **label_vales); +prom_metric_sample_histogram_t *prom_metric_sample_histogram_new(const char *name, prom_histogram_buckets_t *buckets, + size_t label_count, const char **label_keys, + const char **label_vales); /** - * @brief PRIVATE Destroy a pms_histogram_t + * @brief API PRIVATE Destroy a prom_metric_sample_histogram_t */ -int pms_histogram_destroy(pms_histogram_t *self); +int prom_metric_sample_histogram_destroy(prom_metric_sample_histogram_t *self); /** - * @brief PRIVATE Cast to a pms_histogram_t* and destroy. + * @brief API PRIVATE Destroy a void pointer that is cast to a prom_metric_sample_histogram_t* */ -int pms_histogram_destroy_generic(void *gen); +int prom_metric_sample_histogram_destroy_generic(void *gen); -void pms_histogram_free_generic(void *gen); +char *prom_metric_sample_histogram_bucket_to_str(double bucket); + +void prom_metric_sample_histogram_free_generic(void *gen); #endif // PROM_METRIC_HISTOGRAM_SAMPLE_I_H diff --git a/prom/src/prom_metric_sample_histogram_t.h b/prom/src/prom_metric_sample_histogram_t.h index a8f0e32..18cabb3 100644 --- a/prom/src/prom_metric_sample_histogram_t.h +++ b/prom/src/prom_metric_sample_histogram_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,13 +27,13 @@ #ifndef PROM_METRIC_HISTOGRAM_SAMPLE_T_H #define PROM_METRIC_HISTOGRAM_SAMPLE_T_H -struct pms_histogram { - pll_t *l_value_list; - prom_map_t *l_values; - prom_map_t *samples; - pmf_t *metric_formatter; - phb_t *buckets; - pthread_rwlock_t *rwlock; +struct prom_metric_sample_histogram { + prom_linked_list_t *l_value_list; + prom_map_t *l_values; + prom_map_t *samples; + prom_metric_formatter_t *metric_formatter; + prom_histogram_buckets_t *buckets; + pthread_rwlock_t *rwlock; }; #endif // PROM_METRIC_HISTOGRAM_SAMPLE_T_H diff --git a/prom/src/prom_metric_sample_i.h b/prom/src/prom_metric_sample_i.h index 7a61893..eeb63ac 100644 --- a/prom/src/prom_metric_sample_i.h +++ b/prom/src/prom_metric_sample_i.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,31 +21,29 @@ #define PROM_METRIC_SAMPLE_I_H /** - * @brief PRIVATE Return a pms_t* + * @brief API PRIVATE Return a prom_metric_sample_t* * * @param type The type of metric sample * @param l_value The entire left value of the metric e.g metric_name{foo="bar"} * @param r_value A double representing the value of the sample */ -pms_t *pms_new(prom_metric_type_t type, const char *l_value, double r_value); +prom_metric_sample_t *prom_metric_sample_new(prom_metric_type_t type, const char *l_value, double r_value); /** - * @brief PRIVATE Destroy the pms + * @brief API PRIVATE Destroy the prom_metric_sample** */ -int pms_destroy(pms_t *self); +int prom_metric_sample_destroy(prom_metric_sample_t *self); /** - * @brief PRIVATE A pll_free_item_fn to enable item destruction - * within a linked list's destructor + * @brief API PRIVATE A prom_linked_list_free_item_fn to enable item destruction within a linked list's destructor */ -int pms_destroy_generic(void *); +int prom_metric_sample_destroy_generic(void *); /** - * @brief PRIVATE A pll_free_item_fn to enable item destruction - * within a linked list's destructor. + * @brief API PRIVATE A prom_linked_list_free_item_fn to enable item destruction within a linked list's destructor. * * This function ignores any errors. */ -void pms_free_generic(void *gen); +void prom_metric_sample_free_generic(void *gen); #endif // PROM_METRIC_SAMPLE_I_H diff --git a/prom/src/prom_metric_sample_t.h b/prom/src/prom_metric_sample_t.h index 93d7f4a..26e533f 100644 --- a/prom/src/prom_metric_sample_t.h +++ b/prom/src/prom_metric_sample_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +20,10 @@ #include "prom_metric_sample.h" #include "prom_metric_t.h" -struct pms { - prom_metric_type_t type; /**< metric type for the sample */ - char *l_value; /**< full metric name and label set as a str */ - _Atomic double r_value; /**< value of the metric sample */ +struct prom_metric_sample { + prom_metric_type_t type; /**< type is the metric type for the sample */ + char *l_value; /**< l_value is the full metric name and label set represeted as a string */ + _Atomic double r_value; /**< r_value is the value of the metric sample */ }; #endif // PROM_METRIC_SAMPLE_T_H diff --git a/prom/src/prom_metric_t.h b/prom/src/prom_metric_t.h index deff46b..4ab2706 100644 --- a/prom/src/prom_metric_t.h +++ b/prom/src/prom_metric_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,36 +29,29 @@ #include "prom_metric_formatter_t.h" /** - * @brief PRIVATE Contains metric type constants + * @brief API PRIVATE Contains metric type constants */ -typedef enum prom_metric_type { - PROM_COUNTER, - PROM_GAUGE, - PROM_HISTOGRAM, - PROM_SUMMARY, - PROM_UNTYPED -} prom_metric_type_t; +typedef enum prom_metric_type { PROM_COUNTER, PROM_GAUGE, PROM_HISTOGRAM, PROM_SUMMARY } prom_metric_type_t; /** - * @brief PRIVATE Maps metric type constants to human readable string values + * @brief API PRIVATE Maps metric type constants to human readable string values */ -extern const char *prom_metric_type_map[5]; +extern char *prom_metric_type_map[4]; /** - * @brief PRIVATE An opaque struct to users containing metric metadata; one or - * more metric samples; and a metric formatter for locating metric samples - * and exporting metric data + * @brief API PRIVATE An opaque struct to users containing metric metadata; one or more metric samples; and a metric + * formatter for locating metric samples and exporting metric data */ struct prom_metric { - prom_metric_type_t type; /**< metric type */ - const char *name; /**< metric name */ - const char *help; /**< metric help */ - prom_map_t *samples; /**< collected samples */ - phb_t *buckets; /**< histogram bucket upper bound values */ - size_t label_key_count; /**< number of labels */ - pmf_t *formatter; /**< metric formatter */ - pthread_rwlock_t *rwlock; /**< lock support non-atomic ops */ - const char **label_keys; /**< labels **/ + prom_metric_type_t type; /**< metric_type The type of metric */ + const char *name; /**< name The name of the metric */ + const char *help; /**< help The help output for the metric */ + prom_map_t *samples; /**< samples Map comprised of samples for the given metric */ + prom_histogram_buckets_t *buckets; /**< buckets Array of histogram bucket upper bound values */ + size_t label_key_count; /**< label_keys_count The count of labe_keys*/ + prom_metric_formatter_t *formatter; /**< formatter The metric formatter */ + pthread_rwlock_t *rwlock; /**< rwlock Required for locking on certain non-atomic operations */ + const char **label_keys; /**< labels Array comprised of const char **/ }; #endif // PROM_METRIC_T_H diff --git a/prom/src/prom_process_collector.c b/prom/src/prom_process_collector.c deleted file mode 100644 index b88b3b1..0000000 --- a/prom/src/prom_process_collector.c +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> - -// Public -#include "prom_alloc.h" -#include "prom_gauge.h" -#include "prom_log.h" -#include "prom_collector.h" -#include "prom_collector_registry.h" -#include "prom_log.h" - -// Private -#include "prom_process_collector_t.h" -#include "prom_process_fds_i.h" -#include "prom_process_limits_i.h" -#include "prom_process_stat_i.h" -#include "prom_process_stat_t.h" - -static prom_map_t *ppc_collect(prom_collector_t *self); - -typedef struct ppc_data { - const char **label_vals; - int fd[FD_COUNT]; - char *fd_dir; - pid_t pid; - prom_metric_t *m[PM_COUNT]; -} ppc_cdata_t; - -static void -ppc_free_data(prom_collector_t *self) { - if (self == NULL) - return; - ppc_cdata_t *data = prom_collector_data_get(self); - if (data == NULL) - return; - - // we are brave and reset before free, even so we do not need it - for (int i=0; i < FD_COUNT; i++) { - if (data->fd[i] >= 0) - close(data->fd[i]); - data->fd[i] = -3; - } - prom_free(data->fd_dir); - data->fd_dir = NULL; - memset(&(data->m[0]), 0, sizeof(data->m)); - data->label_vals = NULL; - prom_free(data); -} - -prom_collector_t * -ppc_new(const char *limits_path, const char *stat_path, pid_t pid, - const char **label_keys, const char **label_vals) -{ -#define BUF_SZ 32 - char buf[BUF_SZ]; - int err; - - prom_collector_t *self = prom_collector_new(COLLECTOR_NAME_PROCESS); - if (self == NULL) - return NULL; - - ppc_cdata_t *data = prom_malloc(sizeof(ppc_cdata_t)); - if (data == NULL) - return NULL; - - // init - memset(data, 0, sizeof(ppc_cdata_t)); - for (int i=0; i < FD_COUNT; i++) - data->fd[i] = -2; - prom_collector_data_set(self, data, &ppc_free_data); - - data->label_vals = label_vals; - data->pid = pid < 1 ? getpid() : pid; - sprintf(buf, "/proc/%d/fd", data->pid); - data->fd_dir = prom_strdup(buf); - - if (limits_path != NULL) { - if ((data->fd[FD_LIMITS] = open(limits_path, O_RDONLY, 0666)) == -1) { - PROM_WARN("Failed to open '%s'", limits_path); - goto fail; - } - } - if (stat_path == NULL) { -#ifdef __sun - #define STAT_FILE "/proc/%d/status" -#else - // asume Linux - #define STAT_FILE "/proc/%d/stat" -#endif - if ((err = snprintf(buf, BUF_SZ, STAT_FILE, data->pid)) < 0) { - PROM_WARN("Failed to open '%s'", buf); - goto fail; - } - stat_path = buf; - } else { - err = strlen(stat_path); - } - if ((data->fd[FD_STAT] = open(stat_path, O_RDONLY, 0666)) == -1) { - PROM_WARN("Failed to open '%s'", stat_path); - goto fail; - } -#undef STAT_FILE - -#ifdef __sun - if (err > (BUF_SZ - 7) || err < 0) { - PROM_WARN("stat_path '%s' - unexpected length (%d)", stat_path, err); - goto fail; - } - err -= 6; -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstringop-truncation" - strncpy(buf, stat_path, err); -#pragma GCC diagnostic pop - strcpy(buf + err, "psinfo"); - if ((data->fd[FD_PSINFO] = open(buf, O_RDONLY)) == -1) { - PROM_WARN("Failed to open '%s'", buf); - goto fail; - } - strcpy(buf + err, "usage"); - if ((data->fd[FD_USAGE] = open(buf, O_RDONLY)) == -1) { - PROM_WARN("Failed to open '%s'", buf); - goto fail; - } -#endif -#undef BUF_SZ - - if (ppc_limits_new(data->m, label_keys) == 0) - goto fail; - if (ppc_fds_new(data->m, label_keys) == 0) - goto fail; - if (ppc_stats_new(data->m, label_keys) == 0) - goto fail; - - err = 0; - for (int i = 0; i < PM_COUNT; i++) - err += prom_collector_add_metric(self, data->m[i]); - - prom_collector_set_collect_fn(self, &ppc_collect); - return self; - -fail: - for (int i = 0; i < PM_COUNT; i++) - prom_gauge_destroy((prom_gauge_t *) data->m[i]); - prom_collector_destroy(self); - return NULL; -} - -static prom_map_t * -ppc_collect(prom_collector_t *self) { - if (self == NULL) - return NULL; - - ppc_cdata_t *data = prom_collector_data_get(self); - if (data == NULL) - return NULL; - - ppc_fds_update(data->fd_dir, data->m, data->label_vals); - ppc_limits_update(data->fd, data->m, data->label_vals); - ppc_stats_update(data->fd, data->m, data->label_vals); - - return prom_collector_metrics_get(self); -} diff --git a/prom/src/prom_process_collector_t.h b/prom/src/prom_process_collector_t.h deleted file mode 100644 index 9872d3f..0000000 --- a/prom/src/prom_process_collector_t.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PROM_PROCESS_COLLECTOR_H -#define PROM_PROCESS_COLLECTOR_H - -typedef enum proc_metric_t { - PM_OPEN_FDS = 0, - PM_MAX_FDS, - PM_MINFLT, - PM_MAJFLT, -#ifdef __sun - PM_CPU_UTIL, - PM_MEM_UTIL, -#else // assume Linux - PM_CMINFLT, - PM_CMAJFLT, -#endif - PM_UTIME, - PM_STIME, - PM_TIME, - PM_CUTIME, - PM_CSTIME, - PM_CTIME, - PM_NUM_THREADS, - PM_STARTTIME, - PM_VSIZE, - PM_RSS, -#ifdef __sun - PM_VCTX, - PM_ICTX, -#else // assume Linux - PM_BLKIO, -#endif - PM_COUNT /* required to be last */ -} proc_metric_t; - -typedef enum fd_t { - FD_LIMITS = 0, - FD_STAT, -#ifdef __sun - FD_PSINFO, - FD_USAGE, -#endif - FD_COUNT /* required to be last */ -} fd_t; - - -#define cup(what, val) \ - prom_counter_reset(m[(what)], (val), lvals) ? 0 : 1 << (what) - -#define gup(what, val) \ - prom_gauge_set(m[(what)], (val), lvals) ? 0 : 1 << (what) - -#endif // PROM_PROCESS_COLLECTOR_H diff --git a/prom/src/prom_process_fds.c b/prom/src/prom_process_fds.c index 2181fc8..7ffcbc8 100644 --- a/prom/src/prom_process_fds.c +++ b/prom/src/prom_process_fds.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,50 +15,58 @@ */ #include <dirent.h> -#include <string.h> +#include <stdio.h> +#include <sys/types.h> +#include <unistd.h> // Public +#include "prom_alloc.h" #include "prom_gauge.h" // Private #include "prom_errors.h" #include "prom_log.h" -#include "prom_process_collector_t.h" +#include "prom_process_fds_t.h" -int -ppc_fds_new(prom_metric_t *m[], const char **label_keys) { - if (m == NULL) - return 0; - m[PM_OPEN_FDS] = prom_gauge_new("process_open_fds", - "Number of open file descriptors", 0, label_keys); - return m[PM_OPEN_FDS] == NULL ? 0 : 1 << PM_OPEN_FDS; -} - -static double -ppc_fds_count(const char *path) { - int count = 0; - struct dirent *de; - - if (path == NULL) - return NaN; +prom_gauge_t *prom_process_open_fds; - DIR *d = opendir(path); - if (d == NULL) { - PROM_WARN(PROM_STDIO_OPEN_DIR_ERROR " '%s'", path); - return NaN; - } +int prom_process_fds_count(const char *path) { + int count = 0; + int r = 0; + struct dirent *de; + DIR *d; + if (path) { + d = opendir(path); + if (d == NULL) { + PROM_LOG(PROM_STDIO_OPEN_DIR_ERROR); + return -1; + } + } else { + int pid = (int)getpid(); + char p[50]; + sprintf(p, "/proc/%d/fd", pid); + d = opendir(p); + if (d == NULL) { + PROM_LOG(PROM_STDIO_OPEN_DIR_ERROR); + return -1; + } + } - while ((de = readdir(d)) != NULL) { - if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0) - continue; - count++; - } - if (closedir(d)) - PROM_WARN(PROM_STDIO_CLOSE_DIR_ERROR " '%s'", path); - return count; + while ((de = readdir(d)) != NULL) { + if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0) { + continue; + } + count++; + } + r = closedir(d); + if (r) { + PROM_LOG(PROM_STDIO_CLOSE_DIR_ERROR); + return -1; + } + return count; } -int -ppc_fds_update(const char *path, prom_metric_t *m[], const char **lvals) { - return gup(PM_OPEN_FDS, ppc_fds_count(path)); +int prom_process_fds_init(void) { + prom_process_open_fds = prom_gauge_new("process_open_fds", "Number of open file descriptors.", 0, NULL); + return 0; } diff --git a/prom/src/prom_process_fds_i.h b/prom/src/prom_process_fds_i.h index 739a683..b62268a 100644 --- a/prom/src/prom_process_fds_i.h +++ b/prom/src/prom_process_fds_i.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +17,7 @@ #ifndef PROM_PROESS_FDS_I_INCLUDED #define PROM_PROESS_FDS_I_INCLUDED -#include "prom_metric.h" -int ppc_fds_new(prom_metric_t *m[], const char **label_keys); -int ppc_fds_update(const char *path, prom_metric_t *m[], const char **label_vals); +int prom_process_fds_count(const char *path); +int prom_process_fds_init(void); #endif // PROM_PROESS_FDS_I_INCLUDED diff --git a/prom/src/prom_process_fds_t.h b/prom/src/prom_process_fds_t.h new file mode 100644 index 0000000..d46daae --- /dev/null +++ b/prom/src/prom_process_fds_t.h @@ -0,0 +1,24 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "prom_gauge.h" + +#ifndef PROM_PROESS_FDS_T_H +#define PROM_PROESS_FDS_T_H + +extern prom_gauge_t *prom_process_open_fds; + +#endif // PROM_PROESS_FDS_T_H diff --git a/prom/src/prom_process_limits.c b/prom/src/prom_process_limits.c index 6823947..df83949 100644 --- a/prom/src/prom_process_limits.c +++ b/prom/src/prom_process_limits.c @@ -1,5 +1,5 @@ /** - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> + * Copyright 2019-2020 DigitalOcean Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,58 +13,433 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include <errno.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> #include <unistd.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <string.h> +// Public +#include "prom_alloc.h" #include "prom_gauge.h" -#include "prom_log.h" + +// Private +#include "prom_assert.h" +#include "prom_map_i.h" #include "prom_process_limits_i.h" -#include "prom_process_collector_t.h" +#include "prom_process_limits_t.h" +#include "prom_procfs_i.h" + +const char PROM_PROCESS_LIMITS_RDP_LETTERS[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; + +const char PROM_PROCESS_LIMITS_RDP_DIGITS[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + +const char *PROM_PROCESS_LIMITS_RDP_UNLIMITED = "unlimited"; + +typedef enum prom_process_limit_rdp_limit_type { + PROM_PROCESS_LIMITS_RDP_SOFT, + PROM_PROCESS_LIMITS_RDP_HARD +} prom_process_limit_rdp_limit_type_t; + +prom_gauge_t *prom_process_virtual_memory_max_bytes; +prom_gauge_t *prom_process_resident_memory_bytes; +prom_gauge_t *prom_process_max_fds; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// prom_process_limits_row_t + +prom_process_limits_row_t *prom_process_limits_row_new(const char *limit, const int soft, const int hard, + const char *units) { + prom_process_limits_row_t *self = (prom_process_limits_row_t *)prom_malloc(sizeof(prom_process_limits_row_t)); + + self->limit = prom_strdup(limit); + self->units = prom_strdup(units); + + self->soft = soft; + self->hard = hard; + + return self; +} + +int prom_process_limits_row_destroy(prom_process_limits_row_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + prom_free((void *)self->limit); + self->limit = NULL; + + prom_free((void *)self->units); + self->units = NULL; + + prom_free(self); + self = NULL; + return 0; +} + +prom_process_limits_current_row_t *prom_process_limits_current_row_new(void) { + prom_process_limits_current_row_t *self = + (prom_process_limits_current_row_t *)prom_malloc(sizeof(prom_process_limits_current_row_t)); + + self->limit = NULL; + self->soft = 0; + self->hard = 0; + self->units = NULL; + return self; +} + +int prom_process_limits_current_row_set_limit(prom_process_limits_current_row_t *self, char *limit) { + PROM_ASSERT(self != NULL); + self->limit = prom_strdup(limit); + return 0; +} + +int prom_process_limits_current_row_set_units(prom_process_limits_current_row_t *self, char *units) { + PROM_ASSERT(self != NULL); + self->units = prom_strdup(units); + return 0; +} + +int prom_process_limits_current_row_clear(prom_process_limits_current_row_t *self) { + PROM_ASSERT(self != NULL); + if (self->limit) { + prom_free((void *)self->limit); + self->limit = NULL; + } + if (self->units) { + prom_free((void *)self->units); + self->units = NULL; + } + self->soft = 0; + self->hard = 0; + return 0; +} + +int prom_process_limits_current_row_destroy(prom_process_limits_current_row_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + int r = 0; + + r = prom_process_limits_current_row_clear(self); + prom_free(self); + self = NULL; + return r; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// prom_process_limits_file_t + +prom_process_limits_file_t *prom_process_limits_file_new(const char *path) { + if (path) { + return prom_procfs_buf_new(path); + } else { + int pid = (int)getpid(); + char path[255]; + sprintf(path, "/proc/%d/limits", pid); + return prom_procfs_buf_new(path); + } +} + +int prom_process_limits_file_destroy(prom_process_limits_file_t *self) { + PROM_ASSERT(self != NULL); + int r = 0; + + if (self == NULL) return 0; + r = prom_procfs_buf_destroy(self); + self = NULL; + return r; +} + +static void prom_process_limits_file_free_map_item_fn(void *gen) { + prom_process_limits_row_t *row = (prom_process_limits_row_t *)gen; + prom_process_limits_row_destroy(row); + row = NULL; +} + +/** + * @brief Returns a map. Each key is a key in /proc/[pid]/limits. Each value is a pointer to a + * prom_process_limits_row_t. Returns NULL upon failure. + * + * EBNF + * + * limits_file = first_line , data_line , { data_line } ; + * first_line = character, { character } , "\n" ; + * character = " " | letter | digit ; + * letter = "A" | "B" | "C" | "D" | "E" | "F" | "G" + * | "H" | "I" | "J" | "K" | "L" | "M" | "N" + * | "O" | "P" | "Q" | "R" | "S" | "T" | "U" + * | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" + * | "c" | "d" | "e" | "f" | "g" | "h" | "i" + * | "j" | "k" | "l" | "m" | "n" | "o" | "p" + * | "q" | "r" | "s" | "t" | "u" | "v" | "w" + * | "x" | "y" | "z" ; + * digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; + * data_line = limit , space, space, { " " }, soft_limit, " ", " ", { " " }, hard_limit, " ", " ", { " " }, { units }, { + * space_char }, "\n" ; space_char = " " | "\t" ; limit = { word_and_space } , word ; word_and_space = word, " " ; word + * = letter, { letter } ; soft_limit = ( digit, { digit } ) | "unlimited" ; hard_limit = soft_limit ; units = word ; + */ +prom_map_t *prom_process_limits(prom_process_limits_file_t *f) { + prom_map_t *m = prom_map_new(); + if (m == NULL) return NULL; + int r = 0; + + r = prom_map_set_free_value_fn(m, &prom_process_limits_file_free_map_item_fn); + if (r) { + prom_map_destroy(m); + m = NULL; + return NULL; + } + + prom_process_limits_current_row_t *current_row = prom_process_limits_current_row_new(); + if (!prom_process_limits_rdp_file(f, m, current_row)) { + prom_process_limits_current_row_destroy(current_row); + current_row = NULL; + prom_map_destroy(m); + m = NULL; + return NULL; + } + r = prom_process_limits_current_row_destroy(current_row); + current_row = NULL; + if (r) return NULL; + return m; +} + +bool prom_process_limits_rdp_file(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + if (!prom_process_limits_rdp_first_line(f, map, current_row)) return false; + + while (f->index < f->size - 1) { + if (!prom_process_limits_rdp_data_line(f, map, current_row)) return false; + } + + return true; +} + +bool prom_process_limits_rdp_first_line(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + while (prom_process_limits_rdp_character(f, map, current_row)) { + } + if (f->buf[f->index] == '\n') { + f->index++; + return true; + } + return false; +} + +bool prom_process_limits_rdp_character(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + if (prom_process_limits_rdp_letter(f, map, current_row)) return true; + if (prom_process_limits_rdp_digit(f, map, current_row)) return true; + if (f->buf[f->index] == ' ' && f->buf[f->index] < f->size - 1) { + f->index++; + return true; + } + return false; +} + +bool prom_process_limits_rdp_letter(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + if (f->index >= f->size - 1) return false; + unsigned int size = sizeof(PROM_PROCESS_LIMITS_RDP_LETTERS); + for (int i = 0; i < size; i++) { + int letter = PROM_PROCESS_LIMITS_RDP_LETTERS[i]; + int in_buff = f->buf[f->index]; + if (letter == in_buff) { + f->index++; + return true; + } + } + return false; +} + +bool prom_process_limits_rdp_digit(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + if (f->index >= f->size - 1) return false; + unsigned int size = sizeof(PROM_PROCESS_LIMITS_RDP_DIGITS); + for (int i = 0; i < size; i++) { + int digit = PROM_PROCESS_LIMITS_RDP_DIGITS[i]; + int in_buff = f->buf[f->index]; + if (digit == in_buff) { + f->index++; + return true; + } + } + return false; +} + +bool prom_process_limits_rdp_data_line(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + // Process and parse data line, loading relevant data into the current_row + if (!prom_process_limits_rdp_limit(f, map, current_row)) return false; + prom_process_limits_rdp_next_token(f); + if (!prom_process_limits_rdp_soft_limit(f, map, current_row)) return false; + prom_process_limits_rdp_next_token(f); + if (!prom_process_limits_rdp_hard_limit(f, map, current_row)) return false; + prom_process_limits_rdp_next_token(f); + prom_process_limits_rdp_units(f, map, current_row); + + // Load data from the current row into the map + const char *limit = (const char *)current_row->limit; + int soft = current_row->soft; + int hard = current_row->hard; + const char *units = (const char *)current_row->units; + prom_process_limits_row_t *row = prom_process_limits_row_new(limit, soft, hard, units); + prom_map_set(map, limit, row); + prom_process_limits_current_row_clear(current_row); + + // Progress to the next token + prom_process_limits_rdp_next_token(f); + return true; +} + +/** + * @brief EBNF: space_char = " " | "\t" ; + */ +bool prom_process_limits_rdp_space_char(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + char c = f->buf[f->index]; + if (c == ' ' || c == '\t') { + f->index++; + return true; + } + return false; +} /** - * @brief Initializes each gauge metric found in prom_process_limits_t.h + * @brief EBNF: limit = { word_and_space } , word ; */ -int -ppc_limits_new(prom_metric_t *m[], const char **label_keys) { - if (m == NULL) - return 0; - m[PM_MAX_FDS] = prom_gauge_new("process_max_fds", - "Max. number of open file descriptors (soft limit)", 0, label_keys); - return m[PM_MAX_FDS] == NULL ? 0 : 1 << PM_MAX_FDS; -} - -static double -ppc_limits_get_maxfds(int fd) { - if (fd < 0) { - struct rlimit l; - getrlimit(RLIMIT_NOFILE, &l); - return l.rlim_cur == RLIM_INFINITY ? -1 : l.rlim_cur; - } - - char line[17*80]; - ssize_t slen; - char *p; - - if ((slen = pread(fd, line, sizeof(line) - 1, 0)) == -1) - return NaN; - line[slen] = '\0'; - - if ((p = strstr(line, "Max open files ")) == NULL) - return NaN; - p += 16; - while (*p != '\n' && p < (line + slen)) { - if (*p != ' ') - break; - p++; - } - if (*p == '\n' || *p == '\0') - return NaN; - return strncmp(p, "unlimited ", 11) ? strtoul(p, NULL, 10) : -1; -} - -int -ppc_limits_update(int fd[], prom_metric_t *m[], const char **lvals) { - return gup(PM_MAX_FDS, ppc_limits_get_maxfds(fd[FD_LIMITS])); +bool prom_process_limits_rdp_limit(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + size_t current_index = f->index; + while (prom_process_limits_rdp_word_and_space(f, map, current_row)) { + } + + if (prom_process_limits_rdp_word(f, map, current_row)) { + size_t size = f->index - current_index + 1; // Add one for \0 + char limit[size]; + for (int i = 0; i < size - 1; i++) { + limit[i] = f->buf[current_index + i]; + } + limit[size - 1] = '\0'; + prom_process_limits_current_row_set_limit(current_row, limit); + return true; + } + return false; +} + +/** + * @brief EBNF: word_and_space = letter, { letter }, " " ; + */ +bool prom_process_limits_rdp_word_and_space(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + size_t current_index = f->index; + if (prom_process_limits_rdp_word(f, map, current_row) && f->buf[f->index] == ' ') { + f->index++; + if (f->index + 1 < f->size && f->buf[f->index + 1] != ' ' && f->buf[f->index + 1] != '\t') { + return true; + } + } + f->index = current_index; + return false; +} + +bool prom_process_limits_rdp_word(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + size_t original_index = f->index; + while (prom_process_limits_rdp_letter(f, map, current_row)) { + } + return (f->index - original_index) > 0; +} + +static bool prom_process_limits_rdp_generic_limit(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row, + prom_process_limit_rdp_limit_type_t type) { + size_t current_index = f->index; + int value = 0; + if (prom_process_limits_rdp_match(f, PROM_PROCESS_LIMITS_RDP_UNLIMITED)) { + value = -1; + } else { + while (prom_process_limits_rdp_digit(f, map, current_row)) { + } + size_t num_digits = f->index - current_index + 1; + if (num_digits <= 0) return false; + + char buf[num_digits + 1]; + + for (size_t i = 0; i < num_digits - 1; i++) { + buf[i] = f->buf[current_index + i]; + } + buf[num_digits - 1] = '\0'; + value = atoi(buf); + f->index += num_digits; + } + + switch (type) { + case PROM_PROCESS_LIMITS_RDP_SOFT: + current_row->soft = value; + case PROM_PROCESS_LIMITS_RDP_HARD: + current_row->hard = value; + } + + return true; +} + +bool prom_process_limits_rdp_soft_limit(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + return prom_process_limits_rdp_generic_limit(f, map, current_row, PROM_PROCESS_LIMITS_RDP_SOFT); +} + +bool prom_process_limits_rdp_hard_limit(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + return prom_process_limits_rdp_generic_limit(f, map, current_row, PROM_PROCESS_LIMITS_RDP_HARD); +} + +bool prom_process_limits_rdp_units(prom_process_limits_file_t *f, prom_map_t *map, + prom_process_limits_current_row_t *current_row) { + size_t current_index = f->index; + if (prom_process_limits_rdp_word(f, map, current_row)) { + size_t num_chars = f->index - current_index + 1; + char buf[num_chars]; + for (size_t i = 0; i < num_chars - 1; i++) { + buf[i] = f->buf[current_index + i]; + } + buf[num_chars - 1] = '\0'; + prom_process_limits_current_row_set_units(current_row, buf); + return true; + } + return false; +} + +int prom_process_limits_rdp_next_token(prom_process_limits_file_t *f) { + while (f->buf[f->index] == ' ' || f->buf[f->index] == '\n' || f->buf[f->index] == '\t') { + f->index++; + } + return 0; +} + +bool prom_process_limits_rdp_match(prom_process_limits_file_t *f, const char *token) { + size_t current_index = f->index; + for (size_t i = 0; i < strlen(token); i++) { + if (f->buf[current_index + i] != token[i]) { + return false; + } + } + f->index += strlen(token); + return true; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * @brief Initializes each gauge metric found in prom_process_t.h + */ +int prom_process_limits_init(void) { + prom_process_max_fds = prom_gauge_new("process_max_fds", "Maximum number of open file descriptors.", 0, NULL); + + prom_process_virtual_memory_max_bytes = prom_gauge_new( + "process_virtual_memory_max_bytes", "Maximum amount of virtual memory available in bytes.", 0, NULL); + return 0; } diff --git a/prom/src/prom_process_limits_i.h b/prom/src/prom_process_limits_i.h index 37bc60e..5a11eff 100644 --- a/prom/src/prom_process_limits_i.h +++ b/prom/src/prom_process_limits_i.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +17,59 @@ #ifndef PROM_PROCESS_I_H #define PROM_PROCESS_I_H -#include "prom_metric.h" +#include <stdbool.h> -int ppc_limits_new(prom_metric_t *m[], const char **label_keys); -int ppc_limits_update(int fd[], prom_metric_t *m[], const char **label_vals); +#include "prom_map_t.h" +#include "prom_process_limits_t.h" + +/** + * @brief Initialize the process gauge metrics + */ +int prom_process_init(void); + +prom_process_limits_row_t *prom_process_limits_row_new(const char *limit, const int soft, const int hard, + const char *units); +int prom_process_limits_row_destroy(prom_process_limits_row_t *self); + +prom_process_limits_current_row_t *prom_process_limits_current_row_new(void); +int prom_process_limits_current_row_set_limit(prom_process_limits_current_row_t *self, char *limit); +int prom_process_limits_current_row_set_units(prom_process_limits_current_row_t *self, char *units); +int prom_process_limits_current_row_clear(prom_process_limits_current_row_t *self); +int prom_process_limits_current_row_destroy(prom_process_limits_current_row_t *self); + +prom_process_limits_file_t *prom_process_limits_file_new(const char *path); +int prom_process_limits_file_destroy(prom_process_limits_file_t *self); + +prom_map_t *prom_process_limits(prom_process_limits_file_t *f); +bool prom_process_limits_rdp_file(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_first_line(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_character(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_letter(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_digit(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_data_line(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_limit(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_word_and_space(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_word(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_soft_limit(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +; +bool prom_process_limits_rdp_hard_limit(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); +bool prom_process_limits_rdp_units(prom_process_limits_file_t *f, prom_map_t *data, + prom_process_limits_current_row_t *current_row); + +int prom_process_limits_rdp_next_token(prom_process_limits_file_t *f); +bool prom_process_limits_rdp_match(prom_process_limits_file_t *f, const char *token); + +int prom_process_limits_init(void); #endif // PROM_PROCESS_I_H diff --git a/prom/src/prom_process_limits_t.h b/prom/src/prom_process_limits_t.h new file mode 100644 index 0000000..272c7e5 --- /dev/null +++ b/prom/src/prom_process_limits_t.h @@ -0,0 +1,44 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROM_PROCESS_T_H +#define PROM_PROCESS_T_H + +#include "prom_gauge.h" +#include "prom_procfs_t.h" + +extern prom_gauge_t *prom_process_open_fds; +extern prom_gauge_t *prom_process_max_fds; +extern prom_gauge_t *prom_process_virtual_memory_max_bytes; +extern prom_gauge_t *prom_process_resident_memory_bytes; + +typedef struct prom_process_limits_row { + const char *limit; /**< Pointer to a string */ + int soft; /**< Soft value */ + int hard; /**< Hard value */ + const char *units; /**< Units */ +} prom_process_limits_row_t; + +typedef struct prom_process_limits_current_row { + char *limit; /**< Pointer to a string */ + int soft; /**< Soft value */ + int hard; /**< Hard value */ + char *units; /**< Units */ +} prom_process_limits_current_row_t; + +typedef prom_procfs_buf_t prom_process_limits_file_t; + +#endif // PROM_PROCESS_T_H diff --git a/prom/src/prom_process_stat.c b/prom/src/prom_process_stat.c index db95b50..438fdc1 100644 --- a/prom/src/prom_process_stat.c +++ b/prom/src/prom_process_stat.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,386 +15,176 @@ */ #include <stdio.h> -#include <time.h> -#include <unistd.h> #include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#ifdef __sun - #define _STRUCTURED_PROC 1 - #include <sys/procfs.h> - #include <sys/resource.h> -#else - // assume Linux - #include <sys/sysinfo.h> -#endif +#include <unistd.h> // Public #include "prom_alloc.h" -#include "prom_counter.h" -#include "prom_gauge.h" -#include "prom_log.h" // Private #include "prom_assert.h" -#include "prom_process_collector_t.h" #include "prom_process_stat_t.h" - -/** - * @brief Initializes each gauge metric - */ -int -ppc_stats_new(prom_metric_t *m[]) { - if (m == NULL) - return 0; - - // /proc/self/stat Field 10 - m[PM_MINFLT] = prom_counter_new("process_minor_pagefaults", - "Number of minor faults of the process " - "not caused a page load from disk", 0, NULL); - // /proc/self/stat Field 12 - m[PM_MAJFLT] = prom_counter_new("process_major_pagefaults", - "Number of major faults of the process " - "caused a page load from disk", 0, NULL); -#ifdef __sun - m[PM_CPU_UTIL] = prom_gauge_new("process_cpu_utilization_percent", - "Percent of recent cpu time used by all lwps", 0, NULL); - m[PM_MEM_UTIL] = prom_gauge_new("process_mem_utilization_percent", - "Percent of system memory used by process", 0, NULL); -#else // assume Linux - // /proc/self/stat Field 11 - m[PM_CMINFLT] = prom_counter_new("process_children_minor_pagefaults", - "Number of minor faults of the process waited-for children " - "not caused a page load from disk", 0, NULL); - // /proc/self/stat Field 13 - m[PM_CMAJFLT] = prom_counter_new("process_children_major_pagefaults", - "Number of major faults of the process's waited-for children " - "caused a page load from disk", 0, NULL); -#endif - - // /proc/self/stat Field 14 - m[PM_UTIME] = prom_counter_new("process_user_cpu_seconds", - "Total CPU time the process spent in user mode in seconds", 0, NULL); - // /proc/self/stat Field 15 - m[PM_STIME] = prom_counter_new("process_system_cpu_seconds", - "Total CPU time the process spent in kernel mode in seconds", 0, NULL); - // /proc/self/stat Field 14 + 15 - m[PM_TIME] = prom_counter_new("process_total_cpu_seconds", - "Total CPU time the process spent in user and kernel mode in seconds", - 0, NULL); - // /proc/self/stat Field 16 - m[PM_CUTIME] = prom_counter_new("process_children_user_cpu_seconds", - "Total CPU time the process's waited-for children spent in user mode " - "in seconds", 0, NULL); - // /proc/self/stat Field 17 - m[PM_CSTIME] = prom_counter_new("process_children_system_cpu_seconds", - "Total CPU time the process's waited-for children spent in kernel mode " - "in seconds", 0, NULL); - // /proc/self/stat Field 16 + 17 - m[PM_CTIME] = prom_counter_new("process_children_total_cpu_seconds", - "Total CPU time the process's waited-for children spent in user and " - "in kernel mode in seconds", 0, NULL); - - // /proc/self/stat Field 20 - m[PM_NUM_THREADS] = prom_gauge_new("process_threads_total", - "Number of threads in this process", 0, NULL); - - // now - /proc/uptime + /proc/self/stat Field 22 - m[PM_STARTTIME] = prom_counter_new("process_start_time_seconds", - "The time the process has been started in seconds elapsed since Epoch", - 0, NULL); - - // /proc/self/stat Field 23 - m[PM_VSIZE] = prom_gauge_new("process_virtual_memory_bytes", - "Virtual memory size in bytes", 0, NULL); - // /proc/self/stat Field 24 - m[PM_RSS] = prom_gauge_new("process_resident_memory_bytes", - "Resident set size of memory in bytes", 0, NULL); - -#ifdef __sun - m[PM_VCTX] = prom_counter_new("process_voluntary_ctxsw_total", - "Number of voluntary context switches", 0, NULL); - m[PM_ICTX] = prom_counter_new("process_involuntary_ctxsw_total", - "Number of involuntary context switches", 0, NULL); -#else // assume Linux - // /proc/self/stat Field 25 - m[PM_BLKIO] = prom_counter_new("process_delayacct_blkio_ticks", - "Aggregated block I/O delays, measured in clock ticks (centiseconds)", - 0, NULL); -#endif - - int res = 0; - for (int i = PM_MINFLT; i < PM_COUNT; i++) - if (m[i] != NULL) - res |= 1 << i; - return res; +#include "prom_procfs_i.h" + +prom_gauge_t *prom_process_cpu_seconds_total; +prom_gauge_t *prom_process_virtual_memory_bytes; +prom_gauge_t *prom_process_start_time_seconds; + +prom_process_stat_file_t *prom_process_stat_file_new(const char *path) { + if (path) { + return prom_procfs_buf_new(path); + } else { + int pid = (int)getpid(); + char path[50]; + sprintf(path, "/proc/%d/stat", pid); + return prom_procfs_buf_new(path); + } } -#ifdef __sun - -#define TIME_TO_DBL(x) (x).tv_sec + (x).tv_nsec * 1e-9 - -int -ppc_stats_update(int fd[], prom_metric_t *m[], const char **lvals) { - pstatus_t status; - psinfo_t psinfo; - prusage_t usage; +int prom_process_stat_file_destroy(prom_process_stat_file_t *self) { + PROM_ASSERT(self != NULL); + int r = 0; - int res = 0; - double a, b; - - if (fd[FD_STAT] < 0 - || (pread(fd[FD_STAT], &status, sizeof(pstatus_t), 0)) == -1) - { - perror("status"); - res |= gup(PM_NUM_THREADS, NaN); - res |= cup(PM_UTIME, NaN); - res |= cup(PM_STIME, NaN); - res |= cup(PM_TIME, NaN); - res |= cup(PM_CUTIME, NaN); - res |= cup(PM_CSTIME, NaN); - res |= cup(PM_CTIME, NaN); - } else { -#ifdef CREATE_TESTFILES - FILE *f = fopen("/tmp/status", "w+"); - fwrite(&status, sizeof(pstatus_t), 1, f); - fclose(f); -#endif - res |= gup(PM_NUM_THREADS, status.pr_nlwp + status.pr_nzomb); // (20) - a = TIME_TO_DBL(status.pr_utime); - b = TIME_TO_DBL(status.pr_stime); - res |= cup(PM_UTIME, a); // (14) - res |= cup(PM_STIME, b); // (15) - res |= cup(PM_TIME, a + b); - a = TIME_TO_DBL(status.pr_cutime); - b = TIME_TO_DBL(status.pr_cstime); - res |= cup(PM_CUTIME, a); // (16) - res |= cup(PM_CSTIME, b); // (17) - res |= cup(PM_CTIME, a + b); - } - - if (fd[FD_PSINFO] < 0 - || (pread(fd[FD_PSINFO], &psinfo, sizeof(psinfo_t), 0)) == -1) - { - perror("psinfo"); - res |= gup(PM_VSIZE, NaN); - res |= gup(PM_RSS, NaN); - res |= gup(PM_CPU_UTIL, NaN); - res |= gup(PM_MEM_UTIL, NaN); - res |= cup(PM_STARTTIME, NaN); - } else { -#ifdef CREATE_TESTFILES - FILE *f = fopen("/tmp/psinfo", "w+"); - fwrite(&status, sizeof(psinfo), 1, f); - fclose(f); -#endif - // num_threads = psinfo.pr_nlwp + psinfo.pr_nzomb; // (20) - res |= gup(PM_VSIZE, psinfo.pr_size << 10); // (23) - res |= gup(PM_RSS, psinfo.pr_rssize << 10); // (24) - res |= gup(PM_CPU_UTIL, 100.0 * psinfo.pr_pctcpu / 0x8000); - res |= gup(PM_MEM_UTIL, 100.0 * psinfo.pr_pctmem / 0x8000); - res |= cup(PM_STARTTIME, psinfo.pr_start.tv_sec); // (22) - } - if (fd[FD_USAGE] < 0 - || (pread(fd[FD_USAGE], &usage, sizeof(prusage_t), 0)) == -1) - { - perror("usage"); - res |= cup(PM_MINFLT, NaN); - res |= cup(PM_MAJFLT, NaN); - res |= cup(PM_VCTX, NaN); - res |= cup(PM_ICTX, NaN); - } else { -#ifdef CREATE_TESTFILES - FILE *f = fopen("/tmp/usage", "w+"); - fwrite(&status, sizeof(usage), 1, f); - fclose(f); -#endif - res |= cup(PM_MINFLT, usage.pr_minf); // (10) - res |= cup(PM_MAJFLT, usage.pr_majf); // (12) - res |= cup(PM_VCTX, usage.pr_vctx); - res |= cup(PM_ICTX, usage.pr_ictx); - } - return res; + r = prom_procfs_buf_destroy(self); + self = NULL; + return r; } -#else // assume linux - -static int -fill_stats(stats_t *stats, int fd) { - // 12 * 11 + 1 * 18 + 1 * 2 + 18 * 21 = 530 but nice,priority have < 5, so: - char line[512]; - char comm[18]; // the manpage says max 16 chars incl. '\0' + () - - static int PAGE_SZ = 0; - static unsigned long TPS = 0; - static unsigned long long last_starttime = 0; - static unsigned long long timestamp = 0; - - if (PAGE_SZ == 0) { - PAGE_SZ = sysconf(_SC_PAGE_SIZE); - TPS = sysconf(_SC_CLK_TCK); - } - - ssize_t len = pread(fd, line, sizeof(line) - 1, 0); - line[len] = '\0'; - - int n = sscanf((const char *) line, -"%d " // (1) pid %d -"%s " // (2) comm %s -"%c " // (3) state %c -"%d " // (4) ppid %d -"%d " // (5) pgrp %d -"%d " // (6) session %d -"%d " // (7) tty_nr %d -"%d " // (8) tpgid %d -"%u " // (9) flags %u -"%lu " // (10) minflt %lu -"%lu " // (11) cminflt %lu -"%lu " // (12) majflt %lu -"%lu " // (13) cmajflt %lu -"%lf " // (14) utime %lu -"%lf " // (15) stime %lu -"%lf " // (16) cutime %ld -"%lf " // (17) cstime %ld -"%ld " // (18) priority %ld -"%ld " // (19) nice %ld -"%ld " // (20) num_threads %ld -"%ld " // (21) itrealvalue %ld -"%llu " // (22) starttime %llu -"%lu " // (23) vsize %lu -"%ld " // (24) rss %ld -"%lu " // (25) rsslim %lu -"%lu " // (26) startcode %lu [PT] -"%lu " // (27) endcode %lu [PT] -"%lu " // (28) startstack %lu [PT] -"%lu " // (29) kstkesp %lu [PT] -"%lu " // (30) kstkeip %lu [PT] -"%lu " // (31) signal %lu -"%lu " // (32) blocked %lu -"%lu " // (33) sigignore %lu -"%lu " // (34) sigcatch %lu -"%lu " // (35) wchan %lu [PT] -"%lu " // (36) nswap %lu -"%lu " // (37) cnswap %lu -"%d " // (38) exit_signal %d (since Linux 2.1.22) -"%d " // (39) processor %d (since Linux 2.2.8) -"%u " // (40) rt_priority %u (since Linux 2.5.19) -"%u " // (41) policy %u (since Linux 2.5.19) -"%llu " // (42) delayacct_blkio_ticks %llu (since Linux 2.6.18) -"%lu " // (43) guest_time %lu (since Linux 2.6.24) -"%ld " // (44) cguest_time %ld (since Linux 2.6.24) -"%lu " // (45) start_data %lu (since Linux 3.3) [PT] -"%lu " // (46) end_data %lu (since Linux 3.3) [PT] -"%lu " // (47) start_brk %lu (since Linux 3.3) [PT] -"%lu " // (48) arg_start %lu (since Linux 3.5) [PT] -"%lu " // (49) arg_end %lu (since Linux 3.5) [PT] -"%lu " // (50) env_start %lu (since Linux 3.5) [PT] -"%lu " // (51) env_end %lu (since Linux 3.5) [PT] -"%d ", // (52) exit_code %d (since Linux 3.5) [PT] - - &stats->pid, // (1) - comm, // (2) - &stats->state, // (3) - &stats->ppid, // (4) - &stats->pgrp, // (5) - &stats->session, // (6) - &stats->tty_nr, // (7) - &stats->tpgid, // (8) - &stats->flags, // (9) - &stats->minflt, // (10) - &stats->cminflt, // (11) - &stats->majflt, // (12) - &stats->cmajflt, // (13) - &stats->utime, // (14) - &stats->stime, // (15) - &stats->cutime, // (16) - &stats->cstime, // (17) - &stats->priority, // (18) - &stats->nice, // (19) - &stats->num_threads, // (20) - &stats->itrealvalue, // (21) - &stats->starttime, // (22) - &stats->vsize, // (23) - &stats->rss, // (24) - &stats->rsslim, // (25) - &stats->startcode, // (26) - &stats->endcode, // (27) - &stats->startstack, // (28) - &stats->kstkesp, // (29) - &stats->kstkeip, // (30) - &stats->signal, // (31) - &stats->blocked, // (32) - &stats->sigignore, // (33) - &stats->sigcatch, // (34) - &stats->wchan, // (35) - &stats->nswap, // (36) - &stats->cnswap, // (37) - &stats->exit_signal, // (38) - &stats->processor, // (39) - &stats->rt_priority, // (40) - &stats->policy, // (41) - &stats->blkio, // (42) - &stats->guest_time, // (43) - &stats->cguest_time, // (44) - &stats->start_data, // (45) - &stats->end_data, // (46) - &stats->start_brk, // (47) - &stats->arg_start, // (48) - &stats->arg_end, // (49) - &stats->env_start, // (50) - &stats->env_end, // (51) - &stats->exit_code // (52) - ); - if (n < 42) { - PROM_WARN("Incomplete /proc/self/stat line: %s", line); - return 4; - } - - stats->utime /= TPS; - stats->stime /= TPS; - stats->cutime /= TPS; - stats->cstime /= TPS; - stats->rss *= PAGE_SZ; - - if (last_starttime != stats->starttime || timestamp == 0) { - // usually a constant value. However if this fn gets called - // for several other processes ... - struct sysinfo s_info; - time_t now = time(NULL); - long uptime = sysinfo(&s_info) ? now : s_info.uptime; - last_starttime = stats->starttime; - timestamp = now - uptime + (stats->starttime / TPS); - } - stats->starttime = timestamp; - return 0; +prom_process_stat_t *prom_process_stat_new(prom_process_stat_file_t *stat_f) { + prom_process_stat_t *self = (prom_process_stat_t *)prom_malloc(sizeof(prom_process_stat_t)); + self->comm = prom_malloc(128); + + sscanf((const char *)stat_f->buf, + "%d " // (1) pid %d + "%s " // (2) comm %s + "%c " // (3) state %c + "%d " // (4) ppid %d + "%d " // (5) pgrp %d + "%d " // (6) session %d + "%d " // (7) tty_nr %d + "%d " // (8) tpgid %d + "%u " // (9) flags %u + "%lu " // (10) minflt %lu + "%lu " // (11) cminflt %lu + "%lu " // (12) majflt %lu + "%lu " // (13) cmajflt %lu + "%lu " // (14) utime %lu + "%lu " // (15) stime %lu + "%ld " // (16) cutime %ld + "%ld " // (17) cstime %ld + "%ld " // (18) priority %ld + "%ld " // (19) nice %ld + "%ld " // (20) num_threads %ld + "%ld " // (21) itrealvalue %ld + "%llu " // (22) starttime %llu + "%lu " // (23) vsize %lu + "%ld " // (24) rss %ld + "%lu " // (25) rsslim %lu + "%lu " // (26) startcode %lu [PT] + "%lu " // (27) endcode %lu [PT] + "%lu " // (28) startstack %lu [PT] + "%lu " // (29) kstkesp %lu [PT] + "%lu " // (30) kstkeip %lu [PT] + "%lu " // (31) signal %lu + "%lu " // (32) blocked %lu + "%lu " // (33) sigignore %lu + "%lu " // (34) sigcatch %lu + "%lu " // (35) wchan %lu [PT] + "%lu " // (36) nswap %lu + "%lu " // (37) cnswap %lu + "%d " // (38) exit_signal %d (since Linux 2.1.22) + "%d " // (39) processor %d (since Linux 2.2.8) + "%u " // (40) rt_priority %u (since Linux 2.5.19) + "%u " // (41) policy %u (since Linux 2.5.19) + "%llu " // (42) delayacct_blkio_ticks %llu (since Linux 2.6.18) + "%lu " // (43) guest_time %lu (since Linux 2.6.24) + "%ld " // (44) cguest_time %ld (since Linux 2.6.24) + "%lu " // (45) start_data %lu (since Linux 3.3) [PT] + "%lu " // (46) end_data %lu (since Linux 3.3) [PT] + "%lu " // (47) start_brk %lu (since Linux 3.3) [PT] + "%lu " // (48) arg_start %lu (since Linux 3.5) [PT] + "%lu " // (49) arg_end %lu (since Linux 3.5) [PT] + "%lu " // (50) env_start %lu (since Linux 3.5) [PT] + "%lu " // (51) env_end %lu (since Linux 3.5) [PT] + "%d ", // (52) exit_code %d (since Linux 3.5) [PT] + &self->pid, // (1) pid %d + self->comm, // (2) comm %s + &self->state, // (3) state %c + &self->ppid, // (4) ppid %d + &self->pgrp, // (5) pgrp %d + &self->session, // (6) session %d + &self->tty_nr, // (7) tty_nr %d + &self->tpgid, // (8) tpgid %d + &self->flags, // (9) flags %u + &self->minflt, // (10) minflt %lu + &self->cminflt, // (11) cminflt %lu + &self->majflt, // (12) majflt %lu + &self->cmajflt, // (13) cmajflt %lu + &self->utime, // (14) utime %lu + &self->stime, // (15) stime %lu + &self->cutime, // (16) cutime %ld + &self->cstime, // (17) cstime %ld + &self->priority, // (18) priority %ld + &self->nice, // (19) nice %ld + &self->num_threads, // (20) num_threads %ld + &self->itrealvalue, // (21) itrealvalue %ld + &self->starttime, // (22) starttime %llu + &self->vsize, // (23) vsize %lu + &self->rss, // (24) rss %ld + &self->rsslim, // (25) rsslim %lu + &self->startcode, // (26) startcode %lu [PT] + &self->endcode, // (27) endcode %lu [PT] + &self->startstack, // (28) startstack %lu [PT] + &self->kstkesp, // (29) kstkesp %lu [PT] + &self->kstkeip, // (30) kstkeip %lu [PT] + &self->signal, // (31) signal %lu + &self->blocked, // (32) blocked %lu + &self->sigignore, // (33) sigignore %lu + &self->sigcatch, // (34) sigcatch %lu + &self->wchan, // (35) wchan %lu [PT] + &self->nswap, // (36) nswap %lu + &self->cnswap, // (37) cnswap %lu + &self->exit_signal, // (38) exit_signal %d (since Linux 2.1.22) + &self->processor, // (39) processor %d (since Linux 2.2.8) + &self->rt_priority, // (40) rt_priority %u (since Linux 2.5.19) + &self->policy, // (41) policy %u (since Linux 2.5.19) + &self->delayacct_blkio_ticks, // (42) delayacct_blkio_ticks %llu (since Linux 2.6.18) + &self->guest_time, // (43) guest_time %lu (since Linux 2.6.24) + &self->cguest_time, // (44) cguest_time %ld (since Linux 2.6.24) + &self->start_data, // (45) start_data %lu (since Linux 3.3) [PT] + &self->end_data, // (46) end_data %lu (since Linux 3.3) [PT] + &self->start_brk, // (47) start_brk %lu (since Linux 3.3) [PT] + &self->arg_start, // (48) arg_start %lu (since Linux 3.5) [PT] + &self->arg_end, // (49) arg_end %lu (since Linux 3.5) [PT] + &self->env_start, // (50) env_start %lu (since Linux 3.5) [PT] + &self->env_end, // (51) env_end %lu (since Linux 3.5) [PT] + &self->exit_code // (52) exit_code %d (since Linux 3.5) [PT] + ); + return self; } -int -ppc_stats_update(int fd[], prom_metric_t *m[], const char **lvals) { - int c = 1; - stats_t stats; - - if (fd != NULL && fd[FD_STAT] >= 0) - c = fill_stats(&stats, fd[FD_STAT]); - - int res = 0; - res |= cup(PM_MINFLT, c ? NaN : stats.minflt); - res |= cup(PM_MAJFLT, c ? NaN : stats.majflt); - res |= cup(PM_CMINFLT, c ? NaN : stats.cminflt); - res |= cup(PM_CMAJFLT, c ? NaN : stats.cmajflt); - res |= cup(PM_UTIME, c ? NaN : stats.utime); - res |= cup(PM_STIME, c ? NaN : stats.stime); - res |= cup(PM_TIME, c ? NaN : (stats.utime + stats.stime)); - res |= cup(PM_CUTIME, c ? NaN : stats.cutime); - res |= cup(PM_CSTIME, c ? NaN : stats.cstime); - res |= cup(PM_CTIME, c ? NaN : (stats.cutime + stats.cstime)); - res |= gup(PM_NUM_THREADS, c ? NaN : stats.num_threads); - res |= cup(PM_STARTTIME, c ? NaN : stats.starttime); - res |= gup(PM_VSIZE, c ? NaN : stats.vsize); - res |= gup(PM_RSS, c ? NaN : stats.rss); - res |= cup(PM_BLKIO, c ? NaN : stats.blkio); +int prom_process_stat_destroy(prom_process_stat_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + prom_free((void *)self->comm); + prom_free((void *)self); + self = NULL; + return 0; +} - return res; +/** + * @brief Initializes each gauge metric + */ +int prom_process_stats_init(void) { + // /proc/[pid]stat cutime + cstime / 100 + prom_process_cpu_seconds_total = + prom_gauge_new("process_cpu_seconds_total", "Total user and system CPU time spent in seconds.", 0, NULL); + + // /proc/[pid]/stat Field 23 + prom_process_virtual_memory_bytes = + prom_gauge_new("process_virtual_memory_bytes", "Virtual memory size in bytes.", 0, NULL); + + prom_process_start_time_seconds = + prom_gauge_new("process_start_time_seconds", "Start time of the process since unix epoch in seconds.", 0, NULL); + return 0; } -#endif diff --git a/prom/src/prom_process_stat_i.h b/prom/src/prom_process_stat_i.h index 8588c91..7f3b612 100644 --- a/prom/src/prom_process_stat_i.h +++ b/prom/src/prom_process_stat_i.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +17,12 @@ #ifndef PROM_PROCESS_STATS_I_H #define PROM_PROCESS_STATS_I_H -#include "prom_metric.h" +#include "prom_process_stat_t.h" -int ppc_stats_new(prom_metric_t *m[], const char **label_keys); -int ppc_stats_update(int fd[], prom_metric_t *m[], const char **label_vals); +prom_process_stat_file_t *prom_process_stat_file_new(const char *path); +int prom_process_stat_file_destroy(prom_process_stat_file_t *self); +prom_process_stat_t *prom_process_stat_new(prom_process_stat_file_t *stat_f); +int prom_process_stat_destroy(prom_process_stat_t *self); +int prom_process_stats_init(void); #endif // PROM_PROCESS_STATS_I_H diff --git a/prom/src/prom_process_stat_t.h b/prom/src/prom_process_stat_t.h index 709a751..3283609 100644 --- a/prom/src/prom_process_stat_t.h +++ b/prom/src/prom_process_stat_t.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,65 +17,71 @@ #ifndef PROM_PROCESS_STATS_T_H #define PROM_PROCESS_STATS_T_H -#ifdef __linux +#include "prom_gauge.h" +#include "prom_procfs_t.h" + +extern prom_gauge_t *prom_process_cpu_seconds_total; +extern prom_gauge_t *prom_process_virtual_memory_bytes; +extern prom_gauge_t *prom_process_start_time_seconds; + /** - * @brief Refer to man proc and search for /proc/self/stat + * @brief Refer to man proc and search for /proc/[pid]/stat */ -typedef struct stats { - // Linux type Expected final value - int pid; // (1) %d - char *comm; // (2) %s 16 byte + () - char state; // (3) %c - int ppid; // (4) %d - int pgrp; // (5) %d - int session; // (6) %d - int tty_nr; // (7) %d - int tpgid; // (8) %d - unsigned flags; // (9) %u - unsigned long minflt; // (10) %lu - unsigned long cminflt; // (11) %lu - unsigned long majflt; // (12) %lu - unsigned long cmajflt; // (13) %lu - double utime; // (14) %lu in seconds - double stime; // (15) %lu in seconds - double cutime; // (16) %ld in seconds - double cstime; // (17) %ld in seconds - long int priority; // (18) %ld - long int nice; // (19) %ld - long int num_threads; // (20) %ld - long int itrealvalue; // (21) %ld - unsigned long long starttime; // (22) %llu in seconds since Epoche - unsigned long vsize; // (23) %lu in bytes - long int rss; // (24) %ld in bytes - unsigned long rsslim; // (25) %lu - unsigned long startcode; // (26) %lu [PT] - unsigned long endcode; // (27) %lu [PT] - unsigned long startstack; // (28) %lu [PT] - unsigned long kstkesp; // (29) %lu [PT] - unsigned long kstkeip; // (30) %lu [PT] - unsigned long signal; // (31) %lu - unsigned long blocked; // (32) %lu - unsigned long sigignore; // (33) %lu - unsigned long sigcatch; // (34) %lu - unsigned long wchan; // (35) %lu [PT] - unsigned long nswap; // (36) %lu - unsigned long cnswap; // (37) %lu - int exit_signal; // (38) %d (since Linux 2.1.22) - int processor; // (39) %d (since Linux 2.2.8) - unsigned rt_priority; // (40) %u (since Linux 2.5.19) - unsigned policy; // (41) %u (since Linux 2.5.19) - unsigned long long blkio; // (42) %llu delayacct_blkio_ticks - unsigned long guest_time; // (43) %lu (since Linux 2.6.24) - long int cguest_time; // (44) %ld (since Linux 2.6.24) - unsigned long start_data; // (45) %lu (since Linux 3.3) [PT] - unsigned long end_data; // (46) %lu (since Linux 3.3) [PT] - unsigned long start_brk; // (47) %lu (since Linux 3.3) [PT] - unsigned long arg_start; // (48) %lu (since Linux 3.5) [PT] - unsigned long arg_end; // (49) %lu (since Linux 3.5) [PT] - unsigned long env_start; // (50) %lu (since Linux 3.5) [PT] - unsigned long env_end; // (51) %lu (since Linux 3.5) [PT] - int exit_code; // (52) %d (since Linux 3.5) [PT] -} stats_t; -#endif +typedef struct prom_process_stat { + int pid; // (1) pid %d + char *comm; // (2) comm %s + char state; // (3) state %c + int ppid; // (4) ppid %d + int pgrp; // (5) pgrp %d + int session; // (6) session %d + int tty_nr; // (7) tty_nr %d + int tpgid; // (8) tpgid %d + unsigned flags; // (9) flags %u + unsigned long minflt; // (10) minflt %lu + unsigned long cminflt; // (11) cminflt %lu + unsigned long majflt; // (12) majflt %lu + unsigned long cmajflt; // (13) cmajflt %lu + unsigned long utime; // (14) utime %lu + unsigned long stime; // (15) stime %lu + long int cutime; // (16) cutime %ld + long int cstime; // (17) cstime %ld + long int priority; // (18) priority %ld + long int nice; // (19) nice %ld + long int num_threads; // (20) num_threads %ld + long int itrealvalue; // (21) itrealvalue %ld + unsigned long long starttime; // (22) starttime %llu + unsigned long vsize; // (23) vsize %lu + long int rss; // (24) rss %ld + unsigned long rsslim; // (25) rsslim %lu + unsigned long startcode; // (26) startcode %lu [PT] + unsigned long endcode; // (27) endcode %lu [PT] + unsigned long startstack; // (28) startstack %lu [PT] + unsigned long kstkesp; // (29) kstkesp %lu [PT] + unsigned long kstkeip; // (30) kstkeip %lu [PT] + unsigned long signal; // (31) signal %lu + unsigned long blocked; // (32) blocked %lu + unsigned long sigignore; // (33) sigignore %lu + unsigned long sigcatch; // (34) sigcatch %lu + unsigned long wchan; // (35) wchan %lu [PT] + unsigned long nswap; // (36) nswap %lu + unsigned long cnswap; // (37) cnswap %lu + int exit_signal; // (38) exit_signal %d (since Linux 2.1.22) + int processor; // (39) processor %d (since Linux 2.2.8) + unsigned rt_priority; // (40) rt_priority %u (since Linux 2.5.19) + unsigned policy; // (41) policy %u (since Linux 2.5.19) + unsigned long long delayacct_blkio_ticks; // (42) delayacct_blkio_ticks + unsigned long guest_time; // (43) guest_time %lu (since Linux 2.6.24) + long int cguest_time; // (44) cguest_time %ld (since Linux 2.6.24) + unsigned long start_data; // (45) start_data %lu (since Linux 3.3) [PT] + unsigned long end_data; // (46) end_data %lu (since Linux 3.3) [PT] + unsigned long start_brk; // (47) start_brk %lu (since Linux 3.3) [PT] + unsigned long arg_start; // (48) arg_start %lu (since Linux 3.5) [PT] + unsigned long arg_end; // (49) arg_end %lu (since Linux 3.5) [PT] + unsigned long env_start; // (50) env_start %lu (since Linux 3.5) [PT] + unsigned long env_end; // (51) env_end %lu (since Linux 3.5) [PT] + int exit_code; // (52) exit_code %d (since Linux 3.5) [PT] +} prom_process_stat_t; + +typedef prom_procfs_buf_t prom_process_stat_file_t; #endif // PROM_PROCESS_STATS_T_H diff --git a/prom/src/prom_procfs.c b/prom/src/prom_procfs.c new file mode 100644 index 0000000..f9d686a --- /dev/null +++ b/prom/src/prom_procfs.c @@ -0,0 +1,99 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> + +// Public +#include "prom_alloc.h" + +// Private +#include "prom_assert.h" +#include "prom_log.h" +#include "prom_procfs_i.h" + +static int prom_procfs_ensure_buf_size(prom_procfs_buf_t *self) { + PROM_ASSERT(self != NULL); + if (self->allocated >= self->size + 1) return 0; + while (self->allocated < self->size + 1) self->allocated <<= 1; + self->buf = (char *)prom_realloc(self->buf, self->allocated); + return 0; +} + +prom_procfs_buf_t *prom_procfs_buf_new(const char *path) { + int r = 0; + + FILE *f = fopen(path, "r"); + char errbuf[100]; + + if (f == NULL) { + strerror_r(errno, errbuf, 100); + PROM_LOG(errbuf); + return NULL; + } + +#define PROM_PROCFS_BUF_NEW_HANDLE_F_CLOSE(f) \ + r = fclose(f); \ + if (r) { \ + strerror_r(errno, errbuf, 100); \ + PROM_LOG(errbuf); \ + } + + unsigned short int initial_size = 32; + prom_procfs_buf_t *self = prom_malloc(sizeof(prom_procfs_buf_t)); + self->buf = prom_malloc(initial_size); + self->size = 0; + self->index = 0; + self->allocated = initial_size; + + for (int current_char = getc(f), i = 0; current_char != EOF; current_char = getc(f), i++) { + r = prom_procfs_ensure_buf_size(self); + if (r) { + prom_procfs_buf_destroy(self); + self = NULL; + PROM_PROCFS_BUF_NEW_HANDLE_F_CLOSE(f); + return NULL; + } + self->buf[i] = current_char; + self->size++; + } + r = prom_procfs_ensure_buf_size(self); + if (r) { + prom_procfs_buf_destroy(self); + self = NULL; + PROM_PROCFS_BUF_NEW_HANDLE_F_CLOSE(f); + return NULL; + } + + self->buf[self->size] = '\0'; + self->size++; + + PROM_PROCFS_BUF_NEW_HANDLE_F_CLOSE(f); + if (r) return NULL; + return self; +} + +int prom_procfs_buf_destroy(prom_procfs_buf_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + prom_free(self->buf); + prom_free(self); + self = NULL; + return 0; +} diff --git a/prom/src/prom_procfs_i.h b/prom/src/prom_procfs_i.h new file mode 100644 index 0000000..53a4ddb --- /dev/null +++ b/prom/src/prom_procfs_i.h @@ -0,0 +1,26 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROM_PROCFS_I_H +#define PROM_PROCFS_I_H + +#include "prom_procfs_t.h" + +prom_procfs_buf_t *prom_procfs_buf_new(const char *path); + +int prom_procfs_buf_destroy(prom_procfs_buf_t *self); + +#endif // PROM_PROCFS_I_H diff --git a/prom/src/prom_procfs_t.h b/prom/src/prom_procfs_t.h new file mode 100644 index 0000000..7d8b525 --- /dev/null +++ b/prom/src/prom_procfs_t.h @@ -0,0 +1,27 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROM_PROCFS_T_H +#define PROM_PROCFS_T_H + +typedef struct prom_procfs_buf { + size_t allocated; + size_t size; + size_t index; + char *buf; +} prom_procfs_buf_t; + +#endif // PROM_PROCFS_T_H diff --git a/prom/src/prom_string_builder.c b/prom/src/prom_string_builder.c index 821115a..22a3c8c 100644 --- a/prom/src/prom_string_builder.c +++ b/prom/src/prom_string_builder.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,143 +21,133 @@ // Private #include "prom_assert.h" -#include "prom_string_builder.h" +#include "prom_string_builder_i.h" +#include "prom_string_builder_t.h" -// The initial capacity of the string builder. -#define PROM_STRING_BUILDER_INIT_SIZE 128 +// The initial size of a string created via prom_string_builder +#define PROM_STRING_BUILDER_INIT_SIZE 32 // prom_string_builder_init prototype declaration -static int psb_init(psb_t *self); +int prom_string_builder_init(prom_string_builder_t *self); -struct psb { - char *str; /**< the target string */ - size_t allocated; /**< the size allocated to the string in bytes */ - size_t len; /**< the length of str */ - size_t init_size; /**< the initialize size of space to allocate */ +struct prom_string_builder { + char *str; /**< the target string */ + size_t allocated; /**< the size allocated to the string in bytes */ + size_t len; /**< the length of str */ + size_t init_size; /**< the initialize size of space to allocate */ }; -psb_t * -psb_new(void) { - psb_t *self = (psb_t *) prom_malloc(sizeof(psb_t)); - if (self == NULL) - return NULL; - self->init_size = PROM_STRING_BUILDER_INIT_SIZE; - if (psb_init(self)) { - psb_destroy(self); - return NULL; - } - return self; -} +prom_string_builder_t *prom_string_builder_new(void) { + int r = 0; -static int -psb_init(psb_t *self) { - PROM_ASSERT(self != NULL); - self->str = (char *) prom_malloc(self->init_size); - if (self->str == NULL) - return 1; - *self->str = '\0'; - self->allocated = self->init_size; - self->len = 0; - return 0; -} + prom_string_builder_t *self = (prom_string_builder_t *)prom_malloc(sizeof(prom_string_builder_t)); + self->init_size = PROM_STRING_BUILDER_INIT_SIZE; + r = prom_string_builder_init(self); + if (r) { + prom_string_builder_destroy(self); + return NULL; + } -int -psb_clear(psb_t *self) { - PROM_ASSERT(self != NULL); - prom_free(self->str); - self->str = NULL; - return psb_init(self); + return self; } -int -psb_truncate(psb_t *self, size_t len) { - PROM_ASSERT(self != NULL); - if (len >= self->len) - return 0; - - self->len = len; - self->str[self->len] = '\0'; - return 0; +int prom_string_builder_init(prom_string_builder_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + self->str = (char *)prom_malloc(self->init_size); + *self->str = '\0'; + self->allocated = self->init_size; + self->len = 0; + return 0; } -int -psb_destroy(psb_t *self) { - if (self == NULL) - return 0; - prom_free(self->str); - self->str = NULL; - prom_free(self); - return 0; +int prom_string_builder_destroy(prom_string_builder_t *self) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 0; + prom_free(self->str); + self->str = NULL; + prom_free(self); + self = NULL; + return 0; } /** - * @brief PRIVATE Grows the size of the string given the val we want to add + * @brief API PRIVATE Grows the size of the string given the value we want to add * - * The method continuously shifts left until the new size is large enough to - * accommodate add_len. This private method is called in methods that need to - * add one or more characters to the underlying string. + * The method continuously shifts left until the new size is large enough to accommodate add_len. This private method + * is called in methods that need to add one or more characters to the underlying string. */ -static int -psb_ensure_space(psb_t *self, size_t add_len) { - PROM_ASSERT(self != NULL); - if (add_len == 0 || self->allocated >= self->len + add_len + 1) - return 0; - - size_t sz = self->allocated; - while (sz < self->len + add_len + 1) - sz <<= 1; - char *str = (char *) prom_realloc(self->str, sz); - if (str == NULL) - return 1; - self->str = str; - return 0; +static int prom_string_builder_ensure_space(prom_string_builder_t *self, size_t add_len) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (add_len == 0 || self->allocated >= self->len + add_len + 1) return 0; + while (self->allocated < self->len + add_len + 1) self->allocated <<= 1; + self->str = (char *)prom_realloc(self->str, self->allocated); + return 0; +} + +int prom_string_builder_add_str(prom_string_builder_t *self, const char *str) { + PROM_ASSERT(self != NULL); + int r = 0; + + if (self == NULL) return 1; + if (str == NULL || *str == '\0') return 0; + + size_t len = strlen(str); + r = prom_string_builder_ensure_space(self, len); + if (r) return r; + + memcpy(self->str + self->len, str, len); + self->len += len; + self->str[self->len] = '\0'; + return 0; } -int -psb_add_str(psb_t *self, const char *str) { - PROM_ASSERT(self != NULL); - if (str == NULL || *str == '\0') - return 0; +int prom_string_builder_add_char(prom_string_builder_t *self, char c) { + PROM_ASSERT(self != NULL); + int r = 0; - size_t len = strlen(str); - if (psb_ensure_space(self, len)) - return 1; + if (self == NULL) return 1; + r = prom_string_builder_ensure_space(self, 1); + if (r) return r; - memcpy(self->str + self->len, str, len); - self->len += len; - self->str[self->len] = '\0'; - return 0; + self->str[self->len] = c; + self->len++; + self->str[self->len] = '\0'; + return 0; } -int -psb_add_char(psb_t *self, char c) { - PROM_ASSERT(self != NULL); - if (psb_ensure_space(self, 1)) - return 1; +int prom_string_builder_truncate(prom_string_builder_t *self, size_t len) { + PROM_ASSERT(self != NULL); + if (self == NULL) return 1; + if (len >= self->len) return 0; + + self->len = len; + self->str[self->len] = '\0'; + return 0; +} - self->str[self->len] = c; - self->len++; - self->str[self->len] = '\0'; - return 0; +int prom_string_builder_clear(prom_string_builder_t *self) { + PROM_ASSERT(self != NULL); + prom_free(self->str); + self->str = NULL; + return prom_string_builder_init(self); } -size_t -psb_len(psb_t *self) { - PROM_ASSERT(self != NULL); - return self->len; +size_t prom_string_builder_len(prom_string_builder_t *self) { + PROM_ASSERT(self != NULL); + return self->len; } -char * -psb_dump(psb_t *self) { - PROM_ASSERT(self != NULL); - // +1 to accommodate \0 - char *out = (char *) prom_malloc((self->len + 1) * sizeof(char)); - memcpy(out, self->str, self->len + 1); - return out; +char *prom_string_builder_dump(prom_string_builder_t *self) { + PROM_ASSERT(self != NULL); + // +1 to accommodate \0 + char *out = (char *)prom_malloc((self->len + 1) * sizeof(char)); + memcpy(out, self->str, self->len + 1); + return out; } -char * -psb_str(psb_t *self) { - PROM_ASSERT(self != NULL); - return self->str; +char *prom_string_builder_str(prom_string_builder_t *self) { + PROM_ASSERT(self != NULL); + return self->str; } diff --git a/prom/src/prom_string_builder_i.h b/prom/src/prom_string_builder_i.h new file mode 100644 index 0000000..999f372 --- /dev/null +++ b/prom/src/prom_string_builder_i.h @@ -0,0 +1,78 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROM_STRING_BUILDER_I_H +#define PROM_STRING_BUILDER_I_H + +#include <stddef.h> + +#include "prom_string_builder_t.h" + +/** + * API PRIVATE + * @brief Constructor for prom_string_builder + */ +prom_string_builder_t *prom_string_builder_new(void); + +/** + * API PRIVATE + * @brief Destroys a prom_string_builder* + */ +int prom_string_builder_destroy(prom_string_builder_t *self); + +/** + * API PRIVATE + * @brief Adds a string + */ +int prom_string_builder_add_str(prom_string_builder_t *self, const char *str); + +/** + * API PRIVATE + * @brief Adds a char + */ +int prom_string_builder_add_char(prom_string_builder_t *self, char c); + +/** + * API PRIVATE + * @brief Clear the string + */ +int prom_string_builder_clear(prom_string_builder_t *self); + +/** + * API PRIVATE + * @brief Remove data from the end + */ +int prom_string_buillder_truncate(prom_string_builder_t *self, size_t len); + +/** + * API PRIVATE + * @brief Returns the length of the string + */ +size_t prom_string_builder_len(prom_string_builder_t *self); + +/** + * API PRIVATE + * @brief Returns a copy of the string. The returned string must be deallocated when no longer needed. + */ +char *prom_string_builder_dump(prom_string_builder_t *self); + +/** + * API PRIVATE + * @brief Getter for str member + */ +char *prom_string_builder_str(prom_string_builder_t *self); + +#endif // PROM_STRING_BUILDER_I_H diff --git a/prom/src/prom_string_builder_t.h b/prom/src/prom_string_builder_t.h new file mode 100644 index 0000000..3cf456a --- /dev/null +++ b/prom/src/prom_string_builder_t.h @@ -0,0 +1,26 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROM_STRING_BUILDER_T_H +#define PROM_STRING_BUILDER_T_H + +struct prom_string_builder; +/** + * @brief API PRIVATE A structure with functions responsible for building a string + */ +typedef struct prom_string_builder prom_string_builder_t; + +#endif // PROM_STRING_BUILDER_T_H diff --git a/prom/test/CMakeLists.txt b/prom/test/CMakeLists.txt index df33783..7939b7f 100644 --- a/prom/test/CMakeLists.txt +++ b/prom/test/CMakeLists.txt @@ -29,7 +29,7 @@ target_compile_options(Unity PUBLIC "-D UNITY_INCLUDE_DOUBLE") # promTest library exposes the headers in src for testing add_library(promTest STATIC) -target_compile_options(promTest PUBLIC "-g3" "-Wall" "-Wno-pragmas" "-DPROM_ASSERT_ENABLE" "-DPROM_LOG_ENABLE") +target_compile_options(promTest PUBLIC "-g3" "-Wall" "-DPROM_PROCESS_LIMITS_TEST_FILE_PATH=1" "-DPROM_ASSERT_ENABLE" "-DPROM_LOG_ENABLE") target_include_directories( promTest PUBLIC ${public_dir} ${private_dir} ${test_dir} @@ -62,7 +62,8 @@ foreach( prom_metric_sample_test prom_process_limits_test prom_string_builder_test - prom_log_test + prom_procfs_test + ) register_test(${t}) endforeach() diff --git a/prom/test/fixtures/psinfo b/prom/test/fixtures/psinfo Binary files differdeleted file mode 100644 index 0fe5249..0000000 --- a/prom/test/fixtures/psinfo +++ /dev/null diff --git a/prom/test/fixtures/stat b/prom/test/fixtures/stat index 11c66de..346d44e 100644 --- a/prom/test/fixtures/stat +++ b/prom/test/fixtures/stat @@ -1 +1 @@ -1 (bash) S 0 1 1 34816 410 4210944 1463 89550 0 7 3 4 165 193 20 0 1 0 29414985 19058688 885 18446744073709551615 94298705027072 94298706087992 140736141303504 0 0 0 65536 3670020 1266777851 0 0 0 17 0 0 0 0 0 0 94298708188560 94298708235620 94298741563392 140736141311847 140736141311857 140736141311857 140736141311982 0 +1 (bash) S 0 1 1 34816 410 4210944 1463 89550 0 7 3 4 165 193 20 0 1 0 29414985 19058688 885 18446744073709551615 94298705027072 94298706087992 140736141303504 0 0 0 65536 3670020 1266777851 0 0 0 17 0 0 0 0 0 0 94298708188560 94298708235620 94298741563392 140736141311847 140736141311857 140736141311857 140736141311982 0
\ No newline at end of file diff --git a/prom/test/fixtures/status b/prom/test/fixtures/status Binary files differdeleted file mode 100644 index 1653230..0000000 --- a/prom/test/fixtures/status +++ /dev/null diff --git a/prom/test/fixtures/usage b/prom/test/fixtures/usage Binary files differdeleted file mode 100644 index e9cf3de..0000000 --- a/prom/test/fixtures/usage +++ /dev/null diff --git a/prom/test/prom_collector_registry_test.c b/prom/test/prom_collector_registry_test.c index 6a71d9b..4d29f46 100644 --- a/prom/test/prom_collector_registry_test.c +++ b/prom/test/prom_collector_registry_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +14,7 @@ * limitations under the License. */ -#include <unistd.h> -#include <pthread.h> - #include "prom_test_helpers.h" -#include "prom_log.h" static void prom_registry_test_init(void); static void prom_registry_test_destroy(void); @@ -28,198 +23,109 @@ prom_counter_t *test_counter; prom_gauge_t *test_gauge; prom_histogram_t *test_histogram; -pthread_mutex_t fn_mutex = PTHREAD_MUTEX_INITIALIZER; - -void -setUp(void) { - pthread_mutex_lock(&fn_mutex); -} - -void -tearDown(void) { - PROM_COLLECTOR_REGISTRY = NULL; - pthread_mutex_unlock(&fn_mutex); -} - -void -test_large_registry(void) { - pcr_default_init(); - for (int i = 0; i < 1000; i++) { - char metric[6]; - sprintf(metric, "%d", i); - pcr_must_register_metric(prom_counter_new(metric, metric, 0, NULL)); - } - prom_registry_test_destroy(); +void test_large_registry(void) { + prom_collector_registry_default_init(); + for (int i = 0; i < 1000; i++) { + char metric[6]; + sprintf(metric, "%d", i); + prom_collector_registry_must_register_metric(prom_counter_new(metric, metric, 0, NULL)); + } + prom_registry_test_destroy(); } -void -test_pcr_must_register(void) { - prom_registry_test_init(); - const char *labels[] = {"foo"}; +void test_prom_collector_registry_must_register(void) { + prom_registry_test_init(); + int r = 0; - if (prom_counter_inc(test_counter, labels)) - TEST_FAIL(); - if (prom_gauge_add(test_gauge, 2.0, labels)) - TEST_FAIL(); + const char *labels[] = {"foo"}; + r = prom_counter_inc(test_counter, labels); + if (r) TEST_FAIL(); + r = prom_gauge_add(test_gauge, 2.0, labels); + if (r) TEST_FAIL(); - pms_t *test_sample_a = pms_from_labels(test_counter, labels); - pms_t *test_sample_b = pms_from_labels(test_gauge, labels); + prom_metric_sample_t *test_sample_a = prom_metric_sample_from_labels(test_counter, labels); + prom_metric_sample_t *test_sample_b = prom_metric_sample_from_labels(test_gauge, labels); - TEST_ASSERT_EQUAL_DOUBLE(1.0, test_sample_a->r_value); - TEST_ASSERT_EQUAL_DOUBLE(2.0, test_sample_b->r_value); - prom_registry_test_destroy(); + TEST_ASSERT_EQUAL_DOUBLE(1.0, test_sample_a->r_value); + TEST_ASSERT_EQUAL_DOUBLE(2.0, test_sample_b->r_value); + prom_registry_test_destroy(); } -void -test_pcr_bridge(void) { - prom_registry_test_init(); - if (test_histogram == NULL) - TEST_FAIL_MESSAGE("histogram failed to initialize"); - - const char *labels[] = {"foo"}; - prom_counter_inc(test_counter, labels); - prom_gauge_set(test_gauge, 2.0, labels); - if (prom_histogram_observe(test_histogram, 3.0, NULL)) - TEST_FAIL(); - if (prom_histogram_observe(test_histogram, 7.0, NULL)) - TEST_FAIL(); - - const char *result = pcr_bridge(PROM_COLLECTOR_REGISTRY); - - const char *expected[] = { - "# HELP test_counter counter under test", - "# TYPE test_counter counter", - "test_counter{label=\"foo\"}", - "# HELP test_gauge gauge under test", - "# TYPE test_gauge gauge", - "test_gauge{label=\"foo\"}", - "# HELP test_histogram histogram under test", - "# TYPE test_histogram histogram", - "test_histogram_bucket{le=\"5.0\"}", - "test_histogram_bucket{le=\"10.0\"}", - "test_histogram_bucket{le=\"+Inf\"}", - "test_histogram_count", - "test_histogram_sum", - "# HELP process_max_fds Max. number of open file descriptors " - "(soft limit)", - "# TYPE process_max_fds gauge", - "process_max_fds", - }; - - fprintf(stderr, "%s\n", result); - for (int i = 0; i < 16; i++) { - TEST_ASSERT_NOT_NULL_MESSAGE(strstr(result, expected[i]), expected[i]); - } - - free((char *)result); - - PROM_COLLECTOR_REGISTRY->features |= PROM_COMPACT; - result = pcr_bridge(PROM_COLLECTOR_REGISTRY); - TEST_ASSERT_NULL_MESSAGE(strstr(result, "# HELP"),"dump contains '# HELP'"); - TEST_ASSERT_NULL_MESSAGE(strstr(result, "# TYPE"),"dump contains '# TYPE'"); - - prom_registry_test_destroy(); +void test_prom_collector_registry_bridge(void) { + prom_registry_test_init(); + int r = 0; + + if (test_histogram == NULL) TEST_FAIL_MESSAGE("histogram failed to initialize"); + + const char *labels[] = {"foo"}; + prom_counter_inc(test_counter, labels); + prom_gauge_set(test_gauge, 2.0, labels); + r = prom_histogram_observe(test_histogram, 3.0, NULL); + if (r) TEST_FAIL(); + r = prom_histogram_observe(test_histogram, 7.0, NULL); + if (r) TEST_FAIL(); + + const char *result = prom_collector_registry_bridge(PROM_COLLECTOR_REGISTRY_DEFAULT); + + const char *expected[] = { + "# HELP test_counter counter under test", + "# TYPE test_counter counter", + "test_counter{label=\"foo\"}", + "HELP test_gauge gauge under test", + "# TYPE test_gauge gauge", + "test_gauge{label=\"foo\"}", + "# HELP test_histogram histogram under test", + "# TYPE test_histogram histogram\ntest_histogram{le=\"5.0\"}", + "test_histogram{le=\"10.0\"}", + "test_histogram{le=\"+Inf\"}", + "test_histogram_count", + "test_histogram_sum", + "# HELP process_max_fds Maximum number of open file descriptors.", + "# TYPE process_max_fds gauge", + "process_max_fds", + "# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.", + "# TYPE process_virtual_memory_max_bytes"}; + + for (int i = 0; i < 17; i++) { + TEST_ASSERT_NOT_NULL(strstr(result, expected[i])); + } + + free((char *)result); + result = NULL; + + prom_registry_test_destroy(); } -void -test_pcr_default_init(void) { - TEST_ASSERT_EQUAL_INT_MESSAGE(0, pcr_default_init(), - "default_init() failed"); - pcr_t *pr = PROM_COLLECTOR_REGISTRY; - TEST_ASSERT_NOT_NULL_MESSAGE(pr, "PROM_COLLECTOR_REGISTRY not set"); - TEST_ASSERT_EQUAL_INT_MESSAGE(PROM_PROCESS | PROM_SCRAPETIME, pr->features, - "Unexpected pr->features value"); - TEST_ASSERT_EQUAL_STRING_MESSAGE(pr->mprefix, METRIC_LABEL_SCRAPE "_", - "pr->mprefix == NULL"); - TEST_ASSERT_NOT_NULL_MESSAGE(pr->scrape_duration, - "pr->scrape_duration == NULL"); - TEST_ASSERT_NOT_NULL_MESSAGE(pcr_get(pr, COLLECTOR_NAME_DEFAULT), - "default collector not found"); - TEST_ASSERT_NOT_NULL_MESSAGE(pcr_get(pr, COLLECTOR_NAME_PROCESS), - "process collector not found"); - pcr_destroy(pr); - PROM_COLLECTOR_REGISTRY = NULL; - - - TEST_ASSERT_EQUAL_INT_MESSAGE(0, pcr_init(PROM_NONE|PROM_COMPACT, NULL), - "default_init() failed"); - pr = PROM_COLLECTOR_REGISTRY; - TEST_ASSERT_NOT_NULL_MESSAGE(pr, "PROM_COLLECTOR_REGISTRY not set"); - TEST_ASSERT_EQUAL_INT_MESSAGE(PROM_COMPACT, pr->features, - "Unexpected pr->features value"); - TEST_ASSERT_NULL_MESSAGE(pr->mprefix, "pr->mprefix"); - TEST_ASSERT_NULL_MESSAGE(pr->scrape_duration, - "pr->scrape_duration != NULL"); - TEST_ASSERT_NOT_NULL_MESSAGE(pcr_get(pr, COLLECTOR_NAME_DEFAULT), - "default collector not found"); - TEST_ASSERT_NULL_MESSAGE(pcr_get(pr, COLLECTOR_NAME_PROCESS), - "process collector found"); - pcr_destroy(pr); - PROM_COLLECTOR_REGISTRY = NULL; - - - TEST_ASSERT_EQUAL_INT_MESSAGE(0, pcr_init(PROM_SCRAPETIME_ALL, ""), - "default_init() failed"); - pr = PROM_COLLECTOR_REGISTRY; - TEST_ASSERT_NOT_NULL_MESSAGE(pr, "PROM_COLLECTOR_REGISTRY not set"); - TEST_ASSERT_EQUAL_INT_MESSAGE(PROM_SCRAPETIME | PROM_SCRAPETIME_ALL, - pr->features, "Unexpected pr->features value"); - TEST_ASSERT_NULL_MESSAGE(pr->mprefix, "pr->mprefix"); - TEST_ASSERT_NOT_NULL_MESSAGE(pr->scrape_duration, - "pr->scrape_duration == NULL"); - TEST_ASSERT_NOT_NULL_MESSAGE(pcr_get(pr, COLLECTOR_NAME_DEFAULT), - "default collector not found"); - TEST_ASSERT_NULL_MESSAGE(pcr_get(pr, COLLECTOR_NAME_PROCESS), - "process collector found"); - pcr_destroy(pr); - PROM_COLLECTOR_REGISTRY = NULL; -} +void test_prom_collector_registry_validate_metric_name(void) { + prom_registry_test_init(); -void -test_pcr_check_name(void) { - prom_registry_test_init(); - - TEST_ASSERT_EQUAL_INT(0, pcr_validate_metric_name(PROM_COLLECTOR_REGISTRY, - "this_is_a_name09")); - TEST_ASSERT_EQUAL_INT(0, pcr_check_name("this_is_a_name09", 0)); - TEST_ASSERT_EQUAL_INT(1,pcr_check_name("this_is_@_name09", 0) != 0 ? 1 : 0); - TEST_ASSERT_EQUAL_INT(0, pcr_check_name("this_is_a_name09", 1)); - TEST_ASSERT_EQUAL_INT(1,pcr_check_name("this_is_:_name09", 1) != 0 ? 1 : 0); - prom_registry_test_destroy(); + TEST_ASSERT_EQUAL_INT( + 0, prom_collector_registry_validate_metric_name(PROM_COLLECTOR_REGISTRY_DEFAULT, "this_is_a_name09")); + prom_registry_test_destroy(); } -static void -prom_registry_test_init(void) { - if (pcr_init(PROM_PROCESS | PROM_SCRAPETIME, NULL)) { - PROM_WARN("prom collector registry '%s' init() failed.", - COLLECTOR_NAME_DEFAULT); - } - const char *label[] = { "label" }; - test_counter = pcr_must_register_metric(prom_counter_new("test_counter", - "counter under test", 1, label)); - - test_gauge = pcr_must_register_metric(prom_gauge_new("test_gauge", - "gauge under test", 1, label)); - - test_histogram = - pcr_must_register_metric(prom_histogram_new("test_histogram", - "histogram under test", phb_linear(5.0, 5.0, 2), 0, NULL)); - +void prom_registry_test_init(void) { + prom_collector_registry_default_init(); + const char *label[] = {"label"}; + test_counter = + prom_collector_registry_must_register_metric(prom_counter_new("test_counter", "counter under test", 1, label)); + test_gauge = prom_collector_registry_must_register_metric(prom_gauge_new("test_gauge", "gauge under test", 1, label)); + test_histogram = prom_collector_registry_must_register_metric(prom_histogram_new( + "test_histogram", "histogram under test", prom_histogram_buckets_linear(5.0, 5.0, 2), 0, NULL)); } -static void -prom_registry_test_destroy(void) { - pcr_destroy(PROM_COLLECTOR_REGISTRY); - PROM_COLLECTOR_REGISTRY = NULL; +static void prom_registry_test_destroy(void) { + int r = 0; + r = prom_collector_registry_destroy(PROM_COLLECTOR_REGISTRY_DEFAULT); + PROM_COLLECTOR_REGISTRY_DEFAULT = NULL; + if (r) TEST_FAIL_MESSAGE("failed to destroy PROM_COLLECTOR_REGISTRY_DEFAULT"); } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_pcr_must_register); - RUN_TEST(test_pcr_default_init); - RUN_TEST(test_pcr_bridge); - RUN_TEST(test_pcr_check_name); - RUN_TEST(test_large_registry); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + // RUN_TEST(test_prom_collector_registry_must_register); + RUN_TEST(test_prom_collector_registry_bridge); + // RUN_TEST(test_prom_collector_registry_validate_metric_name); + // RUN_TEST(test_large_registry); + return UNITY_END(); } diff --git a/prom/test/prom_collector_test.c b/prom/test/prom_collector_test.c index 4c2188e..71aebde 100644 --- a/prom/test/prom_collector_test.c +++ b/prom/test/prom_collector_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,43 +15,29 @@ */ #include "prom_test_helpers.h" -#include "prom_process_collector_t.h" -void -test_prom_collector(void) { - prom_collector_t *c = prom_collector_new("test"); - TEST_ASSERT_NOT_NULL(c); - prom_counter_t *counter = - prom_counter_new("test_counter", "counter under test", 0, NULL); - prom_collector_add_metric(c, counter); - prom_map_t *m = c->collect_fn(c); - TEST_ASSERT_EQUAL_INT(1, prom_map_size(m)); - prom_collector_destroy(c); +void test_prom_collector(void) { + prom_collector_t *collector = prom_collector_new("test"); + prom_counter_t *counter = prom_counter_new("test_counter", "counter under test", 0, NULL); + prom_collector_add_metric(collector, counter); + prom_map_t *m = collector->collect_fn(collector); + TEST_ASSERT_EQUAL_INT(1, prom_map_size(m)); + prom_collector_destroy(collector); + collector = NULL; } -void -test_prom_process_collector(void) { - prom_collector_t *c = -#ifdef __sun - ppc_new("../test/fixtures/limits","../test/fixtures/status",0,NULL,NULL); -#else // assume Linux - ppc_new("../test/fixtures/limits","../test/fixtures/stat",0,NULL,NULL); -#endif - TEST_ASSERT_NOT_NULL(c); - TEST_ASSERT_NOT_NULL(c->data); - TEST_ASSERT_NOT_NULL(c->free_data_fn); - prom_map_t *m = c->collect_fn(c); - TEST_ASSERT_EQUAL_INT_MESSAGE(PM_COUNT, prom_map_size(m), - "number of metrics"); - prom_collector_destroy(c); - TEST_ASSERT_NULL(c->free_data_fn); - TEST_ASSERT_NULL(c->data); +void test_prom_process_collector(void) { + prom_collector_t *collector = + prom_collector_process_new("/code/prom/test/fixtures/limits", "/code/prom/test/fixtures/stat"); + prom_map_t *m = collector->collect_fn(collector); + TEST_ASSERT_EQUAL_INT(6, prom_map_size(m)); + prom_collector_destroy(collector); + collector = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_prom_collector); - RUN_TEST(test_prom_process_collector); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_collector); + RUN_TEST(test_prom_process_collector); + return UNITY_END(); } diff --git a/prom/test/prom_counter_test.c b/prom/test/prom_counter_test.c index 93ce0af..d58eea4 100644 --- a/prom/test/prom_counter_test.c +++ b/prom/test/prom_counter_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,66 +21,40 @@ const char *sample_labels_a[] = {"f", "b"}; const char *sample_labels_b[] = {"o", "r"}; -void -test_counter_inc(void) { - prom_counter_t *c = prom_counter_new("test_counter", "counter under test", - 2, (const char *[]) {"foo", "bar"}); - TEST_ASSERT(c); +void test_counter_inc(void) { + prom_counter_t *c = prom_counter_new("test_counter", "counter under test", 2, (const char *[]){"foo", "bar"}); + TEST_ASSERT(c); - prom_counter_inc(c, sample_labels_a); - pms_t *sample = pms_from_labels(c, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(1.0, sample->r_value); + prom_counter_inc(c, sample_labels_a); - sample = pms_from_labels(c, sample_labels_b); - TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); + prom_metric_sample_t *sample = prom_metric_sample_from_labels(c, sample_labels_a); + TEST_ASSERT_EQUAL_DOUBLE(1.0, sample->r_value); - prom_counter_destroy(c); -} - -void -test_counter_add(void) { - prom_counter_t *c = prom_counter_new("test_counter", "counter under test", - 2, (const char *[]){"foo", "bar"}); - TEST_ASSERT(c); - - prom_counter_add(c, 100000000.1, sample_labels_a); - pms_t *sample = pms_from_labels(c, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(100000000.1, sample->r_value); + sample = prom_metric_sample_from_labels(c, sample_labels_b); + TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); - sample = pms_from_labels(c, sample_labels_b); - TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); - - prom_counter_destroy(c); + prom_counter_destroy(c); + c = NULL; } -void -test_counter_reset(void) { - prom_counter_t *g = prom_counter_new("test_counter", "counter under test", - 2, (const char *[]) {"foo", "bar"}); - TEST_ASSERT(g); - - prom_counter_reset(g, 100000000.1, sample_labels_a); - pms_t *sample = pms_from_labels(g, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(100000000.1, sample->r_value); - - sample = pms_from_labels(g, sample_labels_b); - TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); +void test_counter_add(void) { + prom_counter_t *c = prom_counter_new("test_counter", "counter under test", 2, (const char *[]){"foo", "bar"}); + TEST_ASSERT(c); - prom_counter_reset(g, 1, sample_labels_a); - sample = pms_from_labels(g, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(1, sample->r_value); + prom_counter_add(c, 100000000.1, sample_labels_a); + prom_metric_sample_t *sample = prom_metric_sample_from_labels(c, sample_labels_a); + TEST_ASSERT_EQUAL_DOUBLE(100000000.1, sample->r_value); - TEST_ASSERT_TRUE_MESSAGE(prom_counter_reset(g, -1, sample_labels_a) > 0, - "prom_counter_reset() should not allow negative values"); + sample = prom_metric_sample_from_labels(c, sample_labels_b); + TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); - prom_counter_destroy(g); + prom_counter_destroy(c); + c = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_counter_inc); - RUN_TEST(test_counter_add); - RUN_TEST(test_counter_reset); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_counter_inc); + RUN_TEST(test_counter_add); + return UNITY_END(); } diff --git a/prom/test/prom_gauge_test.c b/prom/test/prom_gauge_test.c index 4b18237..c3ea35b 100644 --- a/prom/test/prom_gauge_test.c +++ b/prom/test/prom_gauge_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,93 +19,93 @@ const char *sample_labels_a[] = {"f", "b"}; const char *sample_labels_b[] = {"o", "r"}; -void -test_gauge_inc(void) { - prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", - 2, (const char *[]) {"foo", "bar"}); - TEST_ASSERT(g); +void test_gauge_inc(void) { + prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", 2, (const char *[]){"foo", "bar"}); + TEST_ASSERT(g); - prom_gauge_inc(g, sample_labels_a); - pms_t *sample = pms_from_labels(g, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(1.0, sample->r_value); + prom_gauge_inc(g, sample_labels_a); - sample = pms_from_labels(g, sample_labels_b); - TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); + prom_metric_sample_t *sample = prom_metric_sample_from_labels(g, sample_labels_a); - prom_gauge_destroy(g); + TEST_ASSERT_EQUAL_DOUBLE(1.0, sample->r_value); + + sample = prom_metric_sample_from_labels(g, sample_labels_b); + TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); + + prom_gauge_destroy(g); + g = NULL; } -void -test_gauge_dec(void) { - prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", - 2, (const char *[]) {"foo", "bar"}); - TEST_ASSERT(g); +void test_gauge_dec(void) { + prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", 2, (const char *[]){"foo", "bar"}); + TEST_ASSERT(g); + + prom_gauge_dec(g, sample_labels_a); - prom_gauge_dec(g, sample_labels_a); - pms_t *sample = pms_from_labels(g, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(-1.0, sample->r_value); + prom_metric_sample_t *sample = prom_metric_sample_from_labels(g, sample_labels_a); + TEST_ASSERT_EQUAL_DOUBLE(-1.0, sample->r_value); - sample = pms_from_labels(g, sample_labels_b); - TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); + sample = prom_metric_sample_from_labels(g, sample_labels_b); + TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); - prom_gauge_destroy(g); + prom_gauge_destroy(g); + g = NULL; } -void -test_gauge_add(void) { - prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", - 2, (const char *[]) {"foo", "bar"}); - TEST_ASSERT(g); +void test_gauge_add(void) { + prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", 2, (const char *[]){"foo", "bar"}); + TEST_ASSERT(g); - prom_gauge_add(g, 100000000.1, sample_labels_a); - pms_t *sample = pms_from_labels(g, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(100000000.1, sample->r_value); + prom_gauge_add(g, 100000000.1, sample_labels_a); - sample = pms_from_labels(g, sample_labels_b); - TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); + prom_metric_sample_t *sample = prom_metric_sample_from_labels(g, sample_labels_a); + TEST_ASSERT_EQUAL_DOUBLE(100000000.1, sample->r_value); - prom_gauge_destroy(g); + sample = prom_metric_sample_from_labels(g, sample_labels_b); + TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); + + prom_gauge_destroy(g); + g = NULL; } -void -test_gauge_sub(void) { - prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", - 2, (const char *[]) {"foo", "bar"}); - TEST_ASSERT(g); +void test_gauge_sub(void) { + prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", 2, (const char *[]){"foo", "bar"}); + TEST_ASSERT(g); + + prom_gauge_sub(g, 100000000.1, sample_labels_a); - prom_gauge_sub(g, 100000000.1, sample_labels_a); - pms_t *sample = pms_from_labels(g, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(-100000000.1, sample->r_value); + prom_metric_sample_t *sample = prom_metric_sample_from_labels(g, sample_labels_a); + TEST_ASSERT_EQUAL_DOUBLE(-100000000.1, sample->r_value); - sample = pms_from_labels(g, sample_labels_b); - TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); + sample = prom_metric_sample_from_labels(g, sample_labels_b); + TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); - prom_gauge_destroy(g); + prom_gauge_destroy(g); + g = NULL; } -void -test_gauge_set(void) { - prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", - 2, (const char *[]) {"foo", "bar"}); - TEST_ASSERT(g); +void test_gauge_set(void) { + prom_gauge_t *g = prom_gauge_new("test_gauge", "gauge under test", 2, (const char *[]){"foo", "bar"}); + TEST_ASSERT(g); + + prom_gauge_set(g, 100000000.1, sample_labels_a); - prom_gauge_set(g, 100000000.1, sample_labels_a); - pms_t *sample = pms_from_labels(g, sample_labels_a); - TEST_ASSERT_EQUAL_DOUBLE(100000000.1, sample->r_value); + prom_metric_sample_t *sample = prom_metric_sample_from_labels(g, sample_labels_a); + TEST_ASSERT_EQUAL_DOUBLE(100000000.1, sample->r_value); - sample = pms_from_labels(g, sample_labels_b); - TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); + sample = prom_metric_sample_from_labels(g, sample_labels_b); + TEST_ASSERT_EQUAL_DOUBLE(0.0, sample->r_value); - prom_gauge_destroy(g); + prom_gauge_destroy(g); + g = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_gauge_inc); - RUN_TEST(test_gauge_dec); - RUN_TEST(test_gauge_add); - RUN_TEST(test_gauge_sub); - RUN_TEST(test_gauge_set); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_gauge_inc); + RUN_TEST(test_gauge_dec); + RUN_TEST(test_gauge_add); + RUN_TEST(test_gauge_sub); + RUN_TEST(test_gauge_set); + return UNITY_END(); } diff --git a/prom/test/prom_histogram_buckets_test.c b/prom/test/prom_histogram_buckets_test.c index 0ef16f8..fca30fa 100644 --- a/prom/test/prom_histogram_buckets_test.c +++ b/prom/test/prom_histogram_buckets_test.c @@ -1,7 +1,6 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,43 +17,39 @@ #include "prom_test_helpers.h" -void -test_phb_new(void) { - phb_t *result = phb_new(3, 1.0, 2.0, 3.0); - TEST_ASSERT_EQUAL_DOUBLE(1.0, result->upper_bound[0]); - TEST_ASSERT_EQUAL_DOUBLE(2.0, result->upper_bound[1]); - TEST_ASSERT_EQUAL_DOUBLE(3.0, result->upper_bound[2]); - TEST_ASSERT_EQUAL_INT(3, phb_count(result)); - phb_destroy(result); - result = NULL; +void test_prom_histogram_buckets_new(void) { + prom_histogram_buckets_t *result = prom_histogram_buckets_new(3, 1.0, 2.0, 3.0); + TEST_ASSERT_EQUAL_DOUBLE(1.0, result->upper_bounds[0]); + TEST_ASSERT_EQUAL_DOUBLE(2.0, result->upper_bounds[1]); + TEST_ASSERT_EQUAL_DOUBLE(3.0, result->upper_bounds[2]); + TEST_ASSERT_EQUAL_INT(3, prom_histogram_buckets_count(result)); + prom_histogram_buckets_destroy(result); + result = NULL; } -void -test_phb_linear(void) { - phb_t *result = phb_linear(0.0, 1.5, 3); - TEST_ASSERT_EQUAL_DOUBLE(0.0, result->upper_bound[0]); - TEST_ASSERT_EQUAL_DOUBLE(1.5, result->upper_bound[1]); - TEST_ASSERT_EQUAL_DOUBLE(3.0, result->upper_bound[2]); - TEST_ASSERT_EQUAL_INT(3, phb_count(result)); - phb_destroy(result); - result = NULL; +void test_prom_histogram_buckets_linear(void) { + prom_histogram_buckets_t *result = prom_histogram_buckets_linear(0.0, 1.5, 3); + TEST_ASSERT_EQUAL_DOUBLE(0.0, result->upper_bounds[0]); + TEST_ASSERT_EQUAL_DOUBLE(1.5, result->upper_bounds[1]); + TEST_ASSERT_EQUAL_DOUBLE(3.0, result->upper_bounds[2]); + TEST_ASSERT_EQUAL_INT(3, prom_histogram_buckets_count(result)); + prom_histogram_buckets_destroy(result); + result = NULL; } -void -test_phb_expontential(void) { - phb_t *result = phb_exponential(1, 2, 3); - TEST_ASSERT_EQUAL_DOUBLE(1.0, result->upper_bound[0]); - TEST_ASSERT_EQUAL_DOUBLE(2.0, result->upper_bound[1]); - TEST_ASSERT_EQUAL_DOUBLE(4.0, result->upper_bound[2]); - TEST_ASSERT_EQUAL_INT(3, phb_count(result)); - phb_destroy(result); +void test_prom_histogram_buckets_expontential(void) { + prom_histogram_buckets_t *result = prom_histogram_buckets_exponential(1, 2, 3); + TEST_ASSERT_EQUAL_DOUBLE(1.0, result->upper_bounds[0]); + TEST_ASSERT_EQUAL_DOUBLE(2.0, result->upper_bounds[1]); + TEST_ASSERT_EQUAL_DOUBLE(4.0, result->upper_bounds[2]); + TEST_ASSERT_EQUAL_INT(3, prom_histogram_buckets_count(result)); + prom_histogram_buckets_destroy(result); } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_phb_new); - RUN_TEST(test_phb_linear); - RUN_TEST(test_phb_expontential); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_histogram_buckets_new); + RUN_TEST(test_prom_histogram_buckets_linear); + RUN_TEST(test_prom_histogram_buckets_expontential); + return UNITY_END(); } diff --git a/prom/test/prom_histogram_test.c b/prom/test/prom_histogram_test.c index cc384ca..087ee4c 100644 --- a/prom/test/prom_histogram_test.c +++ b/prom/test/prom_histogram_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,65 +16,65 @@ #include "prom_test_helpers.h" -void -test_prom_histogram(void) { - phb_t *bucket = phb_linear(5.0, 5.0, 3); - prom_histogram_t *h = prom_histogram_new("test_histogram", - "histogram under test", bucket, 0, NULL); +void test_prom_histogram(void) { + prom_histogram_t *h = + prom_histogram_new("test_histogram", "histogram under test", prom_histogram_buckets_linear(5.0, 5.0, 3), 0, NULL); - prom_histogram_observe(h, 1.0, NULL); - prom_histogram_observe(h, 7.0, NULL); - prom_histogram_observe(h, 11.0, NULL); - prom_histogram_observe(h, 22.0, NULL); + prom_histogram_observe(h, 1.0, NULL); + prom_histogram_observe(h, 7.0, NULL); + prom_histogram_observe(h, 11.0, NULL); + prom_histogram_observe(h, 22.0, NULL); - pms_histogram_t *h_sample = pms_histogram_from_labels(h, NULL); + prom_metric_sample_histogram_t *h_sample = prom_metric_sample_histogram_from_labels(h, NULL); - // Test counter for each bucket - const char *bucket_key = bucket->key[0]; - const char *l_value = prom_map_get(h_sample->l_values, bucket_key); - pms_t *sample = (pms_t *) prom_map_get(h_sample->samples, l_value); - TEST_ASSERT_EQUAL_STRING("test_histogram_bucket{le=\"5.0\"}", sample->l_value); - TEST_ASSERT_EQUAL_DOUBLE(1.0, sample->r_value); - bucket_key = NULL; + // Test counter for each bucket + char *bucket_key = prom_metric_sample_histogram_bucket_to_str(5.0); + const char *l_value = prom_map_get(h_sample->l_values, bucket_key); + prom_metric_sample_t *sample = (prom_metric_sample_t *)prom_map_get(h_sample->samples, l_value); + TEST_ASSERT_EQUAL_STRING("test_histogram{le=\"5.0\"}", sample->l_value); + TEST_ASSERT_EQUAL_DOUBLE(1.0, sample->r_value); + free((char *)bucket_key); + bucket_key = NULL; - bucket_key = bucket->key[1]; - l_value = prom_map_get(h_sample->l_values, bucket_key); - sample = (pms_t *) prom_map_get(h_sample->samples, l_value); - TEST_ASSERT_EQUAL_STRING("test_histogram_bucket{le=\"10.0\"}", sample->l_value); - TEST_ASSERT_EQUAL_DOUBLE(2.0, sample->r_value); - bucket_key = NULL; + bucket_key = prom_metric_sample_histogram_bucket_to_str(10.0); + l_value = prom_map_get(h_sample->l_values, bucket_key); + sample = (prom_metric_sample_t *)prom_map_get(h_sample->samples, l_value); + TEST_ASSERT_EQUAL_STRING("test_histogram{le=\"10.0\"}", sample->l_value); + TEST_ASSERT_EQUAL_DOUBLE(2.0, sample->r_value); + free((char *)bucket_key); + bucket_key = NULL; - bucket_key = bucket->key[2]; - l_value = prom_map_get(h_sample->l_values, bucket_key); - sample = (pms_t *) prom_map_get(h_sample->samples, l_value); - TEST_ASSERT_EQUAL_STRING("test_histogram_bucket{le=\"15.0\"}", sample->l_value); - TEST_ASSERT_EQUAL_DOUBLE(3.0, sample->r_value); - bucket_key = NULL; + bucket_key = prom_metric_sample_histogram_bucket_to_str(15.0); + l_value = prom_map_get(h_sample->l_values, bucket_key); + sample = (prom_metric_sample_t *)prom_map_get(h_sample->samples, l_value); + TEST_ASSERT_EQUAL_STRING("test_histogram{le=\"15.0\"}", sample->l_value); + TEST_ASSERT_EQUAL_DOUBLE(3.0, sample->r_value); + free((char *)bucket_key); + bucket_key = NULL; - l_value = prom_map_get(h_sample->l_values, "+Inf"); - sample = (pms_t *) prom_map_get(h_sample->samples, l_value); - TEST_ASSERT_EQUAL_STRING("test_histogram_bucket{le=\"+Inf\"}", sample->l_value); - TEST_ASSERT_EQUAL_DOUBLE(4.0, sample->r_value); + l_value = prom_map_get(h_sample->l_values, "+Inf"); + sample = (prom_metric_sample_t *)prom_map_get(h_sample->samples, l_value); + TEST_ASSERT_EQUAL_STRING("test_histogram{le=\"+Inf\"}", sample->l_value); + TEST_ASSERT_EQUAL_DOUBLE(4.0, sample->r_value); - // Test total count. Should equal value ini +Inf - l_value = prom_map_get(h_sample->l_values, "count"); - pms_t *sample_count = (pms_t *) prom_map_get(h_sample->samples, l_value); - TEST_ASSERT_EQUAL_STRING("test_histogram_count", sample_count->l_value); - TEST_ASSERT_EQUAL_DOUBLE(4.0, sample_count->r_value); + // Test total count. Should equal value ini +Inf + l_value = prom_map_get(h_sample->l_values, "count"); + prom_metric_sample_t *sample_count = (prom_metric_sample_t *)prom_map_get(h_sample->samples, l_value); + TEST_ASSERT_EQUAL_STRING("test_histogram_count", sample_count->l_value); + TEST_ASSERT_EQUAL_DOUBLE(4.0, sample_count->r_value); - // Test sum - l_value = prom_map_get(h_sample->l_values, "sum"); - sample = (pms_t *) prom_map_get(h_sample->samples, l_value); - TEST_ASSERT_EQUAL_STRING("test_histogram_sum", sample->l_value); - TEST_ASSERT_EQUAL_DOUBLE(41.0, sample->r_value); + // Test sum + l_value = prom_map_get(h_sample->l_values, "sum"); + sample = (prom_metric_sample_t *)prom_map_get(h_sample->samples, l_value); + TEST_ASSERT_EQUAL_STRING("test_histogram_sum", sample->l_value); + TEST_ASSERT_EQUAL_DOUBLE(41.0, sample->r_value); - prom_histogram_destroy(h); - h = NULL; + prom_histogram_destroy(h); + h = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_prom_histogram); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_histogram); + return UNITY_END(); } diff --git a/prom/test/prom_linked_list_test.c b/prom/test/prom_linked_list_test.c index bffa37d..c3f8af2 100644 --- a/prom/test/prom_linked_list_test.c +++ b/prom/test/prom_linked_list_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,90 +16,89 @@ #include "prom_test_helpers.h" -void -test_pll_append(void) { - pll_t *l = pll_new(); - TEST_ASSERT(l); - pll_set_free_fn(l, pll_no_op_free); - - char *one = "one"; - char *two = "two"; - char *three = "three"; - - pll_append(l, one); - pll_append(l, two); - pll_append(l, three); - - pll_node_t *current_node = l->head; - char *current_str = (char *) current_node->item; - TEST_ASSERT_EQUAL_STRING("one", current_str); - current_node = current_node->next; - current_str = current_node->item; - TEST_ASSERT_EQUAL_STRING("two", current_str); - current_node = current_node->next; - current_str = current_node->item; - TEST_ASSERT_EQUAL_STRING("three", current_str); - - pll_destroy(l); +void test_prom_linked_list_append(void) { + prom_linked_list_t *l = prom_linked_list_new(); + TEST_ASSERT(l); + prom_linked_list_set_free_fn(l, prom_linked_list_no_op_free); + + char *one = "one"; + char *two = "two"; + char *three = "three"; + + prom_linked_list_append(l, one); + prom_linked_list_append(l, two); + prom_linked_list_append(l, three); + + prom_linked_list_node_t *current_node = l->head; + char *current_str = (char *)current_node->item; + TEST_ASSERT_EQUAL_STRING("one", current_str); + current_node = current_node->next; + current_str = current_node->item; + TEST_ASSERT_EQUAL_STRING("two", current_str); + current_node = current_node->next; + current_str = current_node->item; + TEST_ASSERT_EQUAL_STRING("three", current_str); + + prom_linked_list_destroy(l); + l = NULL; } -void -test_pll_push(void) { - pll_t *l = pll_new(); - TEST_ASSERT(l); - pll_set_free_fn(l, pll_no_op_free); - - char *one = "one"; - char *two = "two"; - char *three = "three"; - - pll_push(l, one); - pll_push(l, two); - pll_push(l, three); - - pll_node_t *current_node = l->head; - char *current_str = (char *) current_node->item; - TEST_ASSERT_EQUAL_STRING("three", current_str); - current_node = current_node->next; - current_str = current_node->item; - TEST_ASSERT_EQUAL_STRING("two", current_str); - current_node = current_node->next; - current_str = current_node->item; - TEST_ASSERT_EQUAL_STRING("one", current_str); - - pll_destroy(l); +void test_prom_linked_list_push(void) { + prom_linked_list_t *l = prom_linked_list_new(); + TEST_ASSERT(l); + prom_linked_list_set_free_fn(l, prom_linked_list_no_op_free); + + char *one = "one"; + char *two = "two"; + char *three = "three"; + + prom_linked_list_push(l, one); + prom_linked_list_push(l, two); + prom_linked_list_push(l, three); + + prom_linked_list_node_t *current_node = l->head; + char *current_str = (char *)current_node->item; + TEST_ASSERT_EQUAL_STRING("three", current_str); + current_node = current_node->next; + current_str = current_node->item; + TEST_ASSERT_EQUAL_STRING("two", current_str); + current_node = current_node->next; + current_str = current_node->item; + TEST_ASSERT_EQUAL_STRING("one", current_str); + + prom_linked_list_destroy(l); + l = NULL; } -void -test_pll_remove(void) { - auto pll_compare_t compare_fn(void *item_a, void *item_b) { - const char *str_a = (const char *) item_a; - const char *str_b = (const char *) item_b; - return strcmp(str_a, str_b); - } - - pll_t *list = pll_new(); - pll_set_free_fn(list, pll_no_op_free); - pll_set_compare_fn(list, compare_fn); - - pll_append(list, "node_a"); - pll_append(list, "node_b"); - pll_append(list, "node_c"); - - pll_remove(list, "node_b"); - const char *result_a = list->head->item; - TEST_ASSERT_EQUAL_STRING("node_a", result_a); - const char *result_c = list->head->next->item; - TEST_ASSERT_EQUAL_STRING("node_c", result_c); - - pll_destroy(list); +void test_prom_linked_list_remove(void) { + auto prom_linked_list_compare_t compare_fn(void *item_a, void *item_b) { + const char *str_a = (const char *)item_a; + const char *str_b = (const char *)item_b; + return strcmp(str_a, str_b); + } + + prom_linked_list_t *list = prom_linked_list_new(); + prom_linked_list_set_free_fn(list, prom_linked_list_no_op_free); + prom_linked_list_set_compare_fn(list, compare_fn); + + prom_linked_list_append(list, "node_a"); + prom_linked_list_append(list, "node_b"); + prom_linked_list_append(list, "node_c"); + + prom_linked_list_remove(list, "node_b"); + const char *result_a = list->head->item; + TEST_ASSERT_EQUAL_STRING("node_a", result_a); + const char *result_c = list->head->next->item; + TEST_ASSERT_EQUAL_STRING("node_c", result_c); + + prom_linked_list_destroy(list); + list = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_pll_append); - RUN_TEST(test_pll_push); - RUN_TEST(test_pll_remove); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_linked_list_append); + RUN_TEST(test_prom_linked_list_push); + RUN_TEST(test_prom_linked_list_remove); + return UNITY_END(); } diff --git a/prom/test/prom_log_test.c b/prom/test/prom_log_test.c deleted file mode 100644 index 75b88ee..0000000 --- a/prom/test/prom_log_test.c +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include <unistd.h> - -#include "prom_test_helpers.h" -#include "prom_log.h" - -// modifies "global" var, so prevent running these tests concurrently. -pthread_mutex_t fn_mutex = PTHREAD_MUTEX_INITIALIZER; - -void -setUp(void) { - pthread_mutex_lock(&fn_mutex); -} - -void -tearDown(void) { - pthread_mutex_unlock(&fn_mutex); -} - - -void -test_prom_loglevels(void) { - char buf[8]; - PROM_LOG_LEVEL a, b = PLL_NONE, c; - FILE *zero = prom_log_use(NULL); - TEST_ASSERT_NULL_MESSAGE(zero, "Initial stream != NULL"); - a = prom_log_level(PLL_NONE); - TEST_ASSERT_TRUE_MESSAGE(a == b, "Initial level != PLL_NONE"); - PROM_INFO("Testing levels %s", "..."); - a = prom_log_level(PLL_NONE); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_INFO, "First time level != PLL_INFO"); - c = prom_log_level(PLL_WARN); - TEST_ASSERT_TRUE_MESSAGE(c == PLL_INFO, "Returned log level != PLL_INFO"); - a = prom_log_level(PLL_NONE); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_WARN, "log level != PLL_WARN"); - a = prom_log_level(PLL_INFO); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_WARN, "old log level != PLL_WARN"); - - a = prom_log_level_parse("DEBUG"); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_DBG, "parse != PLL_DEBUG"); - sprintf(buf, "%u", PLL_DBG); - a = prom_log_level_parse(buf); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_DBG, "parse != PLL_DEBUG"); - - a = prom_log_level_parse("INFO"); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_INFO, "parse != PLL_INFO"); - sprintf(buf, "%u", PLL_INFO); - a = prom_log_level_parse(buf); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_INFO, "parse != PLL_INFO"); - - a = prom_log_level_parse("WARN"); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_WARN, "parse != PLL_WARN"); - sprintf(buf, "%u", PLL_WARN); - a = prom_log_level_parse(buf); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_WARN, "parse != PLL_WARN"); - - a = prom_log_level_parse("ERROR"); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_ERR, "parse != PLL_ERROR"); - sprintf(buf, "%u", PLL_ERR); - a = prom_log_level_parse(buf); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_ERR, "parse != PLL_ERROR"); - - a = prom_log_level_parse("FATAL"); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_FATAL, "parse != PLL_FATAL"); - sprintf(buf, "%u", PLL_FATAL); - a = prom_log_level_parse(buf); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_FATAL, "parse != PLL_FATAL"); - - a = prom_log_level_parse(NULL); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_NONE, "parse != PLL_NONE"); - a = prom_log_level_parse("xxx"); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_NONE, "parse != PLL_NONE"); - sprintf(buf, "%u", PLL_COUNT + 1); - a = prom_log_level_parse(buf); - TEST_ASSERT_TRUE_MESSAGE(a == PLL_NONE, "parse != PLL_NONE"); -} - -#define TEST_MSG "Logging to stream" -void -test_prom_logstream(void) { - FILE *f, *fold; - int fd = -1, a, b; - char *template = strdup("/tmp/promLogXXXXXX"), pc[128], *p; - - prom_log_level(PLL_INFO); - PROM_INFO("Testing streams %s", "..."); - f = prom_log_use(NULL); - TEST_ASSERT_NULL_MESSAGE(f, "NULL arg should cause NULL result"); - fd = mkstemp(template); - TEST_ASSERT_TRUE_MESSAGE(fd != -1, "Failed to create temp file"); - f = fdopen(fd, "a"); - TEST_ASSERT_NOT_NULL_MESSAGE(f, "Failed to open tempfile"); - fold = prom_log_use(f); - a = fileno(stderr); - b = fileno(fold); - TEST_ASSERT_TRUE_MESSAGE(a == b, "Default log stream != stderr"); - fclose(f); - fprintf (stderr, "tempfile = '%s'\n", template); - PROM_INFO(TEST_MSG, ""); - f = fopen(template, "r"); - TEST_ASSERT_NOT_NULL_MESSAGE(f, "Unable to open tempfile"); - p = fgets(pc, sizeof(pc), f); - TEST_ASSERT_NOT_NULL_MESSAGE(p, "Reading tempfile failed"); - TEST_ASSERT_TRUE_MESSAGE(strncmp(TEST_MSG, - pc + strlen(pc) - strlen(TEST_MSG) - 1, strlen(TEST_MSG)) == 0, - "Msg not logged to tmpfile"); - unlink(template); -} - -int -main(int argc, const char **argv) { - putenv("PROM_LOG_LEVEL="); - UNITY_BEGIN(); - RUN_TEST(test_prom_loglevels); - RUN_TEST(test_prom_logstream); - return UNITY_END(); -} diff --git a/prom/test/prom_map_test.c b/prom/test/prom_map_test.c index 4e441ce..71649ea 100644 --- a/prom/test/prom_map_test.c +++ b/prom/test/prom_map_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,81 +16,80 @@ #include "prom_test_helpers.h" -void -test_prom_map(void) { - prom_map_t *map = prom_map_new(); - prom_map_set(map, "foo", "bar"); - prom_map_set(map, "bing", "bang"); - TEST_ASSERT_EQUAL_STRING("bar", (const char *) prom_map_get(map, "foo")); - TEST_ASSERT_EQUAL_STRING("bang", (const char *) prom_map_get(map, "bing")); - TEST_ASSERT_NULL(prom_map_get(map, "nope")); - TEST_ASSERT_EQUAL_INT(2, prom_map_size(map)); +void test_prom_map(void) { + prom_map_t *map = prom_map_new(); + prom_map_set(map, "foo", "bar"); + prom_map_set(map, "bing", "bang"); + TEST_ASSERT_EQUAL_STRING("bar", (const char *)prom_map_get(map, "foo")); + TEST_ASSERT_EQUAL_STRING("bang", (const char *)prom_map_get(map, "bing")); + TEST_ASSERT_NULL(prom_map_get(map, "nope")); + TEST_ASSERT_EQUAL_INT(2, prom_map_size(map)); - for (pll_node_t *current_node = map->keys->head; current_node != NULL; - current_node = current_node->next) - { - const char *key = (const char *) current_node->item; - const char *expected; - if (strcmp(key, "foo") == 0) { - expected = "bar"; - } else if (strcmp(key, "bing") == 0) { - expected = "bang"; - } else { - expected = ""; - } - const char *result = prom_map_get(map, key); - TEST_ASSERT_EQUAL_STRING(expected, result); - } + for (prom_linked_list_node_t *current_node = map->keys->head; current_node != NULL; + current_node = current_node->next) { + const char *key = (const char *)current_node->item; - prom_map_destroy(map); + const char *expected; + if (strcmp(key, "foo") == 0) { + expected = "bar"; + } else if (strcmp(key, "bing") == 0) { + expected = "bang"; + } + + const char *result = prom_map_get(map, key); + + TEST_ASSERT_EQUAL_STRING(expected, result); + } + + prom_map_destroy(map); + map = NULL; } -void -test_prom_map_when_large(void) { - prom_map_t *map = prom_map_new(); - prom_map_set_free_value_fn(map, free); +void test_prom_map_when_large(void) { + prom_map_t *map = prom_map_new(); + prom_map_set_free_value_fn(map, free); - // Ensure each inserted key and value are present - for (int i = 1; i <= 10000; i++) { - char buf[6]; - sprintf(buf, "%d", i); - const char *k = (const char *) buf; - int *set = malloc(sizeof(int)); - *set = i; - prom_map_set(map, k, (void *) set); - TEST_ASSERT_EQUAL_INT(i, *((int *) prom_map_get(map, k))); - } + // Ensure each inserted key and value are present + for (int i = 1; i <= 10000; i++) { + char buf[4]; + sprintf(buf, "%d", i); + const char *k = (const char *)buf; + int *set = malloc(sizeof(int)); + *set = i; + prom_map_set(map, k, (void *)set); + TEST_ASSERT_EQUAL_INT(i, *((int *)prom_map_get(map, k))); + } - // Update one of the keys - int *at_50 = malloc(sizeof(int)); - *at_50 = 5000; - prom_map_set(map, "50", (void *) at_50); - TEST_ASSERT_EQUAL_INT(5000, *((int *) prom_map_get(map, "50"))); + // Update one of the keys + int *at_50 = malloc(sizeof(int)); + *at_50 = 5000; + prom_map_set(map, "50", (void *)at_50); + TEST_ASSERT_EQUAL_INT(5000, *((int *)prom_map_get(map, "50"))); - // Ensure each key and value is correct - for (int i = 1; i <= 10000; i++) { - char buf[6]; - sprintf(buf, "%d", i); - const char *k = (const char *)buf; - int actual = *((int *)prom_map_get(map, k)); - if (i == 50) { - TEST_ASSERT_EQUAL_INT(5000, actual); - } else { - TEST_ASSERT_EQUAL_INT(i, actual); - } - } + // Ensure each key and value is correct + for (int i = 1; i <= 10000; i++) { + char buf[5]; + sprintf(buf, "%d", i); + const char *k = (const char *)buf; + int actual = *((int *)prom_map_get(map, k)); + if (i == 50) { + TEST_ASSERT_EQUAL_INT(5000, actual); + } else { + TEST_ASSERT_EQUAL_INT(i, actual); + } + } - // Ensure the size and max_size are correct - TEST_ASSERT_EQUAL_INT(10000, map->size); - TEST_ASSERT_EQUAL_INT(32768, map->max_size); + // Ensure the size and max_size are correct + TEST_ASSERT_EQUAL_INT(10000, map->size); + TEST_ASSERT_EQUAL_INT(32768, map->max_size); - prom_map_destroy(map); + prom_map_destroy(map); + map = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_prom_map); - RUN_TEST(test_prom_map_when_large); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_map); + RUN_TEST(test_prom_map_when_large); + return UNITY_END(); } diff --git a/prom/test/prom_metric_formatter_test.c b/prom/test/prom_metric_formatter_test.c index a16b63f..9c30f0c 100644 --- a/prom/test/prom_metric_formatter_test.c +++ b/prom/test/prom_metric_formatter_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,134 +15,123 @@ */ #include "prom_test_helpers.h" -#include "prom_collector_registry_i.h" - -void -test_pmf_load_l_value(void) { - pmf_t *mf = pmf_new(); - const char *keys[] = {"foo", "bar", "bing"}; - const char *values[] = {"one", "two", "three"}; - pmf_load_l_value(mf, "test", NULL, 3, keys, values); - char *actual = pmf_dump(mf); - char *expected = "test{foo=\"one\",bar=\"two\",bing=\"three\"}"; - TEST_ASSERT_NOT_NULL(strstr(actual, expected)); - - free(actual); - actual = NULL; - pmf_destroy(mf); - mf = NULL; + +void test_prom_metric_formatter_load_l_value(void) { + prom_metric_formatter_t *mf = prom_metric_formatter_new(); + const char *keys[] = {"foo", "bar", "bing"}; + const char *values[] = {"one", "two", "three"}; + prom_metric_formatter_load_l_value(mf, "test", NULL, 3, keys, values); + char *actual = prom_metric_formatter_dump(mf); + char *expected = "test{foo=\"one\",bar=\"two\",bing=\"three\"}"; + TEST_ASSERT_NOT_NULL(strstr(actual, expected)); + + free(actual); + actual = NULL; + prom_metric_formatter_destroy(mf); + mf = NULL; } -void -test_pmf_load_sample(void) { - pmf_t *mf = pmf_new(); - const char *l_value = "test{foo=\"one\",bar=\"two\",bing=\"three\"}"; - pms_t *sample = pms_new(PROM_COUNTER, l_value, 22.2); - pmf_load_sample(mf, sample, NULL); - char *actual = pmf_dump(mf); - char *expected = "test{foo=\"one\",bar=\"two\",bing=\"three\"}"; - TEST_ASSERT_NOT_NULL(strstr(actual, expected)); - - free(actual); - actual = NULL; - pms_destroy(sample); - pmf_destroy(mf); - mf = NULL; +void test_prom_metric_formatter_load_sample(void) { + prom_metric_formatter_t *mf = prom_metric_formatter_new(); + const char *l_value = "test{foo=\"one\",bar=\"two\",bing=\"three\"}"; + prom_metric_sample_t *sample = prom_metric_sample_new(PROM_COUNTER, l_value, 22.2); + prom_metric_formatter_load_sample(mf, sample); + char *actual = prom_metric_formatter_dump(mf); + char *expected = "test{foo=\"one\",bar=\"two\",bing=\"three\"}"; + TEST_ASSERT_NOT_NULL(strstr(actual, expected)); + + free(actual); + actual = NULL; + prom_metric_sample_destroy(sample); + prom_metric_formatter_destroy(mf); + mf = NULL; } -void -test_pmf_load_metric(void) { - pmf_t *mf = pmf_new(); - const char *counter_keys[] = {"foo", "bar"}; - const char *sample_a[] = {"f", "b"}; - const char *sample_b[] = {"o", "r"}; - prom_metric_t *m = prom_metric_new(PROM_COUNTER, "test_counter", - "counter under test", 2, counter_keys); - pms_t *s_a = pms_from_labels(m, sample_a); - pms_add(s_a, 2.3); - pms_t *s_b = pms_from_labels(m, sample_b); - pms_add(s_b, 4.6); - pmf_load_metric(mf, m, "", false); - const char *result = pmf_dump(mf); - - char *substr = "# HELP test_counter counter under test\n" - "# TYPE test_counter counter\ntest_counter{foo=\"f\",bar=\"b\"}"; - - TEST_ASSERT_NOT_NULL(strstr(result, substr)); - - substr = "\ntest_counter{foo=\"o\",bar=\"r\"}"; - TEST_ASSERT_NOT_NULL(strstr(result, substr)); - - free((char *)result); - result = NULL; - prom_metric_destroy(m); - m = NULL; - pmf_destroy(mf); - mf = NULL; +void test_prom_metric_formatter_load_metric(void) { + prom_metric_formatter_t *mf = prom_metric_formatter_new(); + const char *counter_keys[] = {"foo", "bar"}; + const char *sample_a[] = {"f", "b"}; + const char *sample_b[] = {"o", "r"}; + prom_metric_t *m = prom_metric_new(PROM_COUNTER, "test_counter", "counter under test", 2, counter_keys); + prom_metric_sample_t *s_a = prom_metric_sample_from_labels(m, sample_a); + prom_metric_sample_add(s_a, 2.3); + prom_metric_sample_t *s_b = prom_metric_sample_from_labels(m, sample_b); + prom_metric_sample_add(s_b, 4.6); + prom_metric_formatter_load_metric(mf, m); + const char *result = prom_metric_formatter_dump(mf); + + char *substr = + "# HELP test_counter counter under test\n# TYPE test_counter counter\ntest_counter{foo=\"f\",bar=\"b\"}"; + + TEST_ASSERT_NOT_NULL(strstr(result, substr)); + + substr = "\ntest_counter{foo=\"o\",bar=\"r\"}"; + TEST_ASSERT_NOT_NULL(strstr(result, substr)); + + free((char *)result); + result = NULL; + prom_metric_destroy(m); + m = NULL; + prom_metric_formatter_destroy(mf); + mf = NULL; } -void -test_pmf_load_metrics(void) { - pmf_t *mf = pmf_new(); - const char *counter_keys[] = {}; - pcr_init(PROM_NONE, ""); - pcr_enable_custom_process_metrics(PROM_COLLECTOR_REGISTRY, -#ifdef __sun - "../test/fixtures/limits", "../test/fixtures/status" -#else // assume Linux - "../test/fixtures/limits", "../test/fixtures/stat" -#endif - ); - prom_metric_t *m_a = prom_metric_new(PROM_COUNTER, "test_counter_a", - "counter under test", 0, counter_keys); - prom_metric_t *m_b = prom_metric_new(PROM_COUNTER, "test_counter_b", - "counter under test", 0, counter_keys); - pms_t *s_a = pms_from_labels(m_a, counter_keys); - pms_add(s_a, 2.3); - pms_t *s_b = pms_from_labels(m_b, counter_keys); - pms_add(s_b, 4.6); - pcr_register_metric(m_a); - pcr_register_metric(m_b); - pmf_load_metrics(mf, PROM_COLLECTOR_REGISTRY->collectors, - NULL, "", false); - - const char *result = pmf_dump(mf); - const char *expected[] = { - // from "default" collector - "# HELP test_counter_a counter under test", - "# TYPE test_counter_a counter", - "test_counter_a", - "# HELP test_counter_b counter under test", - "# TYPE test_counter_b counter", - "test_counter_b", - // from "process" collector - "# HELP process_max_fds Max. number of open file descriptors " - "(soft limit)", - "# TYPE process_max_fds gauge", - "process_max_fds 1048576", - }; - - for (int i = 0; i < 9; i++) { - TEST_ASSERT_NOT_NULL_MESSAGE(strstr(result, expected[i]), expected[i]); - } - - free((char *) result); - result = NULL; - - if (pmf_destroy(mf)) - TEST_FAIL_MESSAGE("Failed to destroy metric formatter"); - mf = NULL; - if (pcr_destroy(PROM_COLLECTOR_REGISTRY)) - TEST_FAIL_MESSAGE("Failed to destroy default collector registry"); - PROM_COLLECTOR_REGISTRY = NULL; +void test_prom_metric_formatter_load_metrics(void) { + int r = 0; + + prom_metric_formatter_t *mf = prom_metric_formatter_new(); + const char *counter_keys[] = {}; + prom_collector_registry_default_init(); + prom_metric_t *m_a = prom_metric_new(PROM_COUNTER, "test_counter_a", "counter under test", 0, counter_keys); + prom_metric_t *m_b = prom_metric_new(PROM_COUNTER, "test_counter_b", "counter under test", 0, counter_keys); + prom_metric_sample_t *s_a = prom_metric_sample_from_labels(m_a, counter_keys); + prom_metric_sample_add(s_a, 2.3); + prom_metric_sample_t *s_b = prom_metric_sample_from_labels(m_b, counter_keys); + prom_metric_sample_add(s_b, 4.6); + prom_collector_registry_register_metric(m_a); + prom_collector_registry_register_metric(m_b); + + prom_metric_formatter_load_metrics(mf, PROM_COLLECTOR_REGISTRY_DEFAULT->collectors); + + const char *result = prom_metric_formatter_dump(mf); + const char *expected[] = { + "# HELP test_counter_a counter under test", + "# TYPE test_counter_a counter", + "test_counter_a", + "# HELP test_counter_b counter under test", + "# TYPE test_counter_b counter", + "test_counter_b", + "# HELP process_max_fds Maximum number of open file descriptors.", + "# TYPE process_max_fds gauge", + "process_max_fds 1048576", + "# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.", + "# TYPE process_virtual_memory_max_bytes gauge", + "process_virtual_memory_max_bytes -1"}; + + for (int i = 0; i < 12; i++) { + TEST_ASSERT_NOT_NULL(strstr(result, expected[i])); + } + + free((char *)result); + result = NULL; + + r = prom_metric_formatter_destroy(mf); + if (r) { + TEST_FAIL_MESSAGE("Failed to destroy metric formatter"); + } + mf = NULL; + r = prom_collector_registry_destroy(PROM_COLLECTOR_REGISTRY_DEFAULT); + if (r) { + TEST_FAIL_MESSAGE("Failed to destroy default collector registry"); + } + PROM_COLLECTOR_REGISTRY_DEFAULT = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_pmf_load_l_value); - RUN_TEST(test_pmf_load_sample); - RUN_TEST(test_pmf_load_metric); - RUN_TEST(test_pmf_load_metrics); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_metric_formatter_load_l_value); + RUN_TEST(test_prom_metric_formatter_load_sample); + RUN_TEST(test_prom_metric_formatter_load_metric); + RUN_TEST(test_prom_metric_formatter_load_metrics); + return UNITY_END(); } diff --git a/prom/test/prom_metric_sample_test.c b/prom/test/prom_metric_sample_test.c index 5503c2d..d7dd013 100644 --- a/prom/test/prom_metric_sample_test.c +++ b/prom/test/prom_metric_sample_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,56 +18,55 @@ const char *l_value = "test{foo=\"bar\"}"; -void -test_pms_add(void) { - pms_t *s = pms_new(PROM_COUNTER, l_value, 0.0); - TEST_ASSERT(s); +void test_prom_metric_sample_add(void) { + prom_metric_sample_t *s = prom_metric_sample_new(PROM_COUNTER, l_value, 0.0); + TEST_ASSERT(s); - pms_add(s, 2.6); - TEST_ASSERT_EQUAL_DOUBLE(2.6, s->r_value); + prom_metric_sample_add(s, 2.6); + TEST_ASSERT_EQUAL_DOUBLE(2.6, s->r_value); - pms_add(s, 29.9); - TEST_ASSERT_EQUAL_DOUBLE(32.5, s->r_value); + prom_metric_sample_add(s, 29.9); + TEST_ASSERT_EQUAL_DOUBLE(32.5, s->r_value); - pms_add(s, 1000001.125); - TEST_ASSERT_EQUAL_DOUBLE(1000033.625, s->r_value); + prom_metric_sample_add(s, 1000001.125); + TEST_ASSERT_EQUAL_DOUBLE(1000033.625, s->r_value); - pms_destroy(s); + prom_metric_sample_destroy(s); + s = NULL; } -void -test_pms_sub(void) { - pms_t *s = pms_new(PROM_GAUGE, l_value, 100.1145321); - TEST_ASSERT(s); +void test_prom_metric_sample_sub(void) { + prom_metric_sample_t *s = prom_metric_sample_new(PROM_GAUGE, l_value, 100.1145321); + TEST_ASSERT(s); - pms_sub(s, 99.91); - TEST_ASSERT_EQUAL_DOUBLE(0.20453210000000865, s->r_value); + prom_metric_sample_sub(s, 99.91); + TEST_ASSERT_EQUAL_DOUBLE(0.20453210000000865, s->r_value); - pms_sub(s, 0.20453210000000865); - TEST_ASSERT_EQUAL_DOUBLE(0.0, s->r_value); + prom_metric_sample_sub(s, 0.20453210000000865); + TEST_ASSERT_EQUAL_DOUBLE(0.0, s->r_value); - pms_destroy(s); + prom_metric_sample_destroy(s); + s = NULL; } -void -test_prom_metric_set(void) { - pms_t *s = pms_new(PROM_GAUGE, l_value, 100.1145321); - TEST_ASSERT(s); +void test_prom_metric_set(void) { + prom_metric_sample_t *s = prom_metric_sample_new(PROM_GAUGE, l_value, 100.1145321); + TEST_ASSERT(s); - pms_set(s, 99.91); - TEST_ASSERT_EQUAL_DOUBLE(99.91, s->r_value); + prom_metric_sample_set(s, 99.91); + TEST_ASSERT_EQUAL_DOUBLE(99.91, s->r_value); - pms_set(s, 0.20453210000000865); - TEST_ASSERT_EQUAL_DOUBLE(0.20453210000000865, s->r_value); + prom_metric_sample_set(s, 0.20453210000000865); + TEST_ASSERT_EQUAL_DOUBLE(0.20453210000000865, s->r_value); - pms_destroy(s); + prom_metric_sample_destroy(s); + s = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_pms_add); - RUN_TEST(test_pms_sub); - RUN_TEST(test_prom_metric_set); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_metric_sample_add); + RUN_TEST(test_prom_metric_sample_sub); + RUN_TEST(test_prom_metric_set); + return UNITY_END(); } diff --git a/prom/test/prom_metric_test.c b/prom/test/prom_metric_test.c index 8bf0d6a..be4ce0c 100644 --- a/prom/test/prom_metric_test.c +++ b/prom/test/prom_metric_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,35 +16,30 @@ #include "prom_test_helpers.h" -void -test_metric_with_no_labels(void) { - prom_metric_t *metric = prom_metric_new(PROM_GAUGE, "test_counter", - "counter under test", 0, NULL); - pms_t *sample = pms_from_labels(metric, NULL); - pms_set(sample, 1.0); - sample = pms_from_labels(metric, NULL); - TEST_ASSERT_EQUAL_DOUBLE(1.0, (_Atomic double)sample->r_value); - prom_metric_destroy(metric); - metric = NULL; +void test_metric_with_no_labels(void) { + prom_metric_t *metric = prom_metric_new(PROM_GAUGE, "test_counter", "counter under test", 0, NULL); + prom_metric_sample_t *sample = prom_metric_sample_from_labels(metric, NULL); + prom_metric_sample_set(sample, 1.0); + sample = prom_metric_sample_from_labels(metric, NULL); + TEST_ASSERT_EQUAL_DOUBLE(1.0, (_Atomic double)sample->r_value); + prom_metric_destroy(metric); + metric = NULL; } -void -test_metric_sample_from_labels(void) { - prom_metric_t *metric = prom_metric_new(PROM_GAUGE, "test_metric", - "test counter", 2, (const char *[]) {"foo", "bar"}); - const char *values[] = {"bing", "bang"}; - pms_t *sample = pms_from_labels(metric, values); - pms_set(sample, 1.0); - sample = pms_from_labels(metric, values); - TEST_ASSERT_EQUAL_DOUBLE(1.0, (_Atomic double)sample->r_value); - prom_metric_destroy(metric); - metric = NULL; +void test_metric_sample_from_labels(void) { + prom_metric_t *metric = prom_metric_new(PROM_GAUGE, "test_metric", "test counter", 2, (const char *[]){"foo", "bar"}); + const char *values[] = {"bing", "bang"}; + prom_metric_sample_t *sample = prom_metric_sample_from_labels(metric, values); + prom_metric_sample_set(sample, 1.0); + sample = prom_metric_sample_from_labels(metric, values); + TEST_ASSERT_EQUAL_DOUBLE(1.0, (_Atomic double)sample->r_value); + prom_metric_destroy(metric); + metric = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_metric_with_no_labels); - RUN_TEST(test_metric_sample_from_labels); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_metric_with_no_labels); + RUN_TEST(test_metric_sample_from_labels); + return UNITY_END(); } diff --git a/prom/test/prom_process_limits_test.c b/prom/test/prom_process_limits_test.c index adcb071..a2fd4b5 100644 --- a/prom/test/prom_process_limits_test.c +++ b/prom/test/prom_process_limits_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,50 +18,198 @@ #include <stdlib.h> #include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> - -#include "prom_gauge.h" - -#include "prom_metric_sample_t.h" -#include "prom_process_collector_t.h" +#include "prom_map_i.h" #include "prom_process_limits_i.h" +#include "prom_process_limits_t.h" #include "unity.h" -const char *path = "../test/fixtures/limits"; - -void -test_ppc_limits(void) { - prom_metric_t *m[PM_COUNT]; - memset(m, 0, sizeof(m)); - TEST_ASSERT_NULL(m[PM_MAX_FDS]); - TEST_ASSERT_EQUAL_INT(1 << PM_MAX_FDS, ppc_limits_new(m, NULL)); - TEST_ASSERT_NOT_NULL(m[PM_MAX_FDS]); - - prom_metric_t *n[PM_COUNT]; - memset(n, 0, sizeof(n)); - TEST_ASSERT_NULL(n[PM_MAX_FDS]); - TEST_ASSERT_EQUAL_INT(1 << PM_MAX_FDS, ppc_limits_new(n, NULL)); - TEST_ASSERT_NOT_NULL(n[PM_MAX_FDS]); - TEST_ASSERT_TRUE(m[PM_MAX_FDS] != n[PM_MAX_FDS]); - - int fd[FD_COUNT]; - fd[FD_LIMITS] = open(path, O_RDONLY, 0666); - TEST_ASSERT_TRUE(fd[FD_LIMITS] >= 0); - TEST_ASSERT_EQUAL_INT(1 << PM_MAX_FDS, ppc_limits_update(fd, m, NULL)); - pms_t *sample = pms_from_labels(m[PM_MAX_FDS], NULL); - TEST_ASSERT_EQUAL_INT(1048576, sample->r_value); - - prom_gauge_destroy(m[PM_MAX_FDS]); - prom_gauge_destroy(n[PM_MAX_FDS]); - close(fd[FD_LIMITS]); +const char *path = "/code/prom/test/fixtures/limits"; + +void test_prom_process_limits_file_parsing(void) { + prom_process_limits_file_t *f = prom_process_limits_file_new(path); + char *result = strstr(f->buf, "Max realtime timeout"); + TEST_ASSERT_NOT_NULL(result); + + prom_map_t *m = prom_process_limits(f); + if (!m) TEST_FAIL(); + + TEST_ASSERT_EQUAL_INT(16, prom_map_size(m)); + + prom_process_limits_row_t *row = (prom_process_limits_row_t *)prom_map_get(m, "Max cpu time"); + if (!row) TEST_FAIL(); + TEST_ASSERT_EQUAL_INT(-1, row->soft); + TEST_ASSERT_EQUAL_INT(-1, row->hard); + TEST_ASSERT_EQUAL_STRING("Max cpu time", row->limit); + TEST_ASSERT_EQUAL_STRING("seconds", row->units); + + row = (prom_process_limits_row_t *)prom_map_get(m, "Max file size"); + TEST_ASSERT_EQUAL_INT(-1, row->soft); + TEST_ASSERT_EQUAL_INT(-1, row->hard); + TEST_ASSERT_EQUAL_STRING("Max file size", row->limit); + TEST_ASSERT_EQUAL_STRING("bytes", row->units); + + row = (prom_process_limits_row_t *)prom_map_get(m, "Max data size"); + TEST_ASSERT_EQUAL_INT(-1, row->soft); + TEST_ASSERT_EQUAL_INT(-1, row->hard); + TEST_ASSERT_EQUAL_STRING("Max data size", row->limit); + TEST_ASSERT_EQUAL_STRING("bytes", row->units); + + row = (prom_process_limits_row_t *)prom_map_get(m, "Max stack size"); + TEST_ASSERT_EQUAL_INT(8388608, row->soft); + TEST_ASSERT_EQUAL_INT(-1, row->hard); + TEST_ASSERT_EQUAL_STRING("Max stack size", row->limit); + TEST_ASSERT_EQUAL_STRING("bytes", row->units); + + row = (prom_process_limits_row_t *)prom_map_get(m, "Max processes"); + TEST_ASSERT_EQUAL_INT(-1, row->soft); + TEST_ASSERT_EQUAL_INT(-1, row->hard); + TEST_ASSERT_EQUAL_STRING("Max processes", row->limit); + TEST_ASSERT_EQUAL_STRING("processes", row->units); + + row = (prom_process_limits_row_t *)prom_map_get(m, "Max pending signals"); + TEST_ASSERT_EQUAL_INT(23701, row->soft); + TEST_ASSERT_EQUAL_INT(23701, row->hard); + TEST_ASSERT_EQUAL_STRING("Max pending signals", row->limit); + TEST_ASSERT_EQUAL_STRING("signals", row->units); + + prom_map_destroy(m); + m = NULL; + prom_process_limits_file_destroy(f); + f = NULL; +} + +void test_prom_process_limits_rdp_next_token(void) { + prom_process_limits_file_t f = {.size = 4, .index = 0, .buf = " \t!"}; + prom_process_limits_file_t *fp = &f; + prom_process_limits_rdp_next_token(fp); + + TEST_ASSERT_EQUAL_INT(2, fp->index); + TEST_ASSERT_EQUAL_INT('!', fp->buf[fp->index]); +} + +void test_prom_process_limits_rdp_match(void) { + prom_process_limits_file_t f = {.size = 4, .index = 0, .buf = "foo"}; + prom_process_limits_file_t *fp = &f; + + TEST_ASSERT_TRUE(prom_process_limits_rdp_match(fp, "foo")); +} + +void test_prom_process_limits_rdp_hard_limit(void) { + // Test unlimited value + prom_process_limits_file_t f = {.size = 13, .index = 0, .buf = "unlimited "}; + prom_process_limits_file_t *fp = &f; + + prom_process_limits_current_row_t *cr = prom_process_limits_current_row_new(); + prom_map_t *m = prom_map_new(); + + TEST_ASSERT_TRUE(prom_process_limits_rdp_hard_limit(fp, m, cr)); + TEST_ASSERT_EQUAL_INT(-1, cr->hard); + + prom_process_limits_current_row_clear(cr); + + // Test int value + fp->buf = "123 "; + fp->size = 6; + fp->index = 0; + + TEST_ASSERT_TRUE(prom_process_limits_rdp_hard_limit(fp, m, cr)); + TEST_ASSERT_EQUAL_INT(123, cr->hard); + + prom_map_destroy(m); + m = NULL; + prom_process_limits_current_row_destroy(cr); + cr = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_ppc_limits); - return UNITY_END(); +void test_prom_process_limits_rdp_word(void) { + // Test unlimited value + prom_process_limits_file_t f = {.size = 13, .index = 0, .buf = "unlimited "}; + prom_process_limits_file_t *fp = &f; + + prom_process_limits_current_row_t *cr = prom_process_limits_current_row_new(); + prom_map_t *m = prom_map_new(); + + TEST_ASSERT_TRUE(prom_process_limits_rdp_word(fp, m, cr)); + TEST_ASSERT_EQUAL_INT(9, fp->index); + + prom_map_destroy(m); + m = NULL; + prom_process_limits_current_row_destroy(cr); + cr = NULL; +} + +void test_prom_process_limits_rdp_word_and_space(void) { + prom_process_limits_file_t f = {.size = 8, .index = 0, .buf = "foo bar"}; + prom_process_limits_file_t *fp = &f; + + prom_process_limits_current_row_t *cr = prom_process_limits_current_row_new(); + prom_map_t *m = prom_map_new(); + + TEST_ASSERT_TRUE(prom_process_limits_rdp_word_and_space(fp, m, cr)); + TEST_ASSERT_EQUAL_INT(4, fp->index); + TEST_ASSERT_EQUAL_INT('b', fp->buf[fp->index]); + + prom_map_destroy(m); + m = NULL; + prom_process_limits_current_row_destroy(cr); + cr = NULL; +} + +void test_prom_process_limits_rdp_limit(void) { + prom_process_limits_file_t f = {.size = 16, .index = 0, .buf = "Max cpu time "}; + prom_process_limits_file_t *fp = &f; + + prom_process_limits_current_row_t *cr = prom_process_limits_current_row_new(); + prom_map_t *m = prom_map_new(); + + TEST_ASSERT_TRUE(prom_process_limits_rdp_limit(fp, m, cr)); + TEST_ASSERT_EQUAL_INT(12, fp->index); + TEST_ASSERT_EQUAL_INT(' ', fp->buf[fp->index]); + TEST_ASSERT_EQUAL_STRING("Max cpu time", cr->limit); + + prom_map_destroy(m); + m = NULL; + prom_process_limits_current_row_destroy(cr); + cr = NULL; +} + +void test_prom_process_limits_rdp_letter(void) { + prom_process_limits_file_t f = {.size = 4, .index = 0, .buf = "foo"}; + prom_process_limits_file_t *fp = &f; + + prom_process_limits_current_row_t *cr = prom_process_limits_current_row_new(); + prom_map_t *m = prom_map_new(); + + TEST_ASSERT_TRUE(prom_process_limits_rdp_letter(fp, m, cr)); + + fp->size = 1; + fp->index = 0; + fp->buf = ""; + + TEST_ASSERT_FALSE(prom_process_limits_rdp_letter(fp, m, cr)); + + fp->size = 2; + fp->index = 0; + fp->buf = "2"; + + TEST_ASSERT_FALSE(prom_process_limits_rdp_letter(fp, m, cr)); + + prom_map_destroy(m); + m = NULL; + prom_process_limits_current_row_destroy(cr); + cr = NULL; +} + +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_process_limits_rdp_next_token); + RUN_TEST(test_prom_process_limits_rdp_match); + RUN_TEST(test_prom_process_limits_rdp_hard_limit); + RUN_TEST(test_prom_process_limits_rdp_word); + RUN_TEST(test_prom_process_limits_rdp_word_and_space); + RUN_TEST(test_prom_process_limits_rdp_limit); + RUN_TEST(test_prom_process_limits_rdp_letter); + + RUN_TEST(test_prom_process_limits_file_parsing); + return UNITY_END(); } diff --git a/prom/test/prom_procfs_test.c b/prom/test/prom_procfs_test.c new file mode 100644 index 0000000..656684e --- /dev/null +++ b/prom/test/prom_procfs_test.c @@ -0,0 +1,31 @@ +/** + * Copyright 2019-2020 DigitalOcean Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "prom_test_helpers.h" + +void test_prom_procfs_buf(void) { + prom_procfs_buf_t *buf = prom_procfs_buf_new("/proc/1/limits"); + TEST_ASSERT_NOT_NULL(buf); + TEST_ASSERT_NOT_NULL(strstr(buf->buf, "Max realtime timeout")); + prom_procfs_buf_destroy(buf); + buf = NULL; +} + +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_procfs_buf); + return UNITY_END(); +} diff --git a/prom/test/prom_string_builder_test.c b/prom/test/prom_string_builder_test.c index 694f2dc..45a8de2 100644 --- a/prom/test/prom_string_builder_test.c +++ b/prom/test/prom_string_builder_test.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,48 +16,48 @@ #include "prom_test_helpers.h" -void -test_psb_add_str(void) { - psb_t *sb = psb_new(); - psb_add_str(sb, "fooooooooooooooooooooooooooooooooo"); - psb_add_str(sb, " baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"); - TEST_ASSERT_EQUAL_STRING(psb_str(sb), - "fooooooooooooooooooooooooooooooooo baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"); +void test_prom_string_builder_add_str(void) { + prom_string_builder_t *sb = prom_string_builder_new(); + prom_string_builder_add_str(sb, "fooooooooooooooooooooooooooooooooo"); + prom_string_builder_add_str(sb, " baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"); + TEST_ASSERT_EQUAL_STRING(prom_string_builder_str(sb), + "fooooooooooooooooooooooooooooooooo baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"); - psb_destroy(sb); + prom_string_builder_destroy(sb); + sb = NULL; } -void -test_psb_add_char(void) { - psb_t *sb = psb_new(); - const char *foobar = "foo bar"; - for (int i = 0; i < strlen(foobar); i++) { - psb_add_char(sb, foobar[i]); - } - TEST_ASSERT_EQUAL_STRING(psb_str(sb), "foo bar"); +void test_prom_string_builder_add_char(void) { + prom_string_builder_t *sb = prom_string_builder_new(); + const char *foobar = "foo bar"; + for (int i = 0; i < strlen(foobar); i++) { + prom_string_builder_add_char(sb, foobar[i]); + } + TEST_ASSERT_EQUAL_STRING(prom_string_builder_str(sb), "foo bar"); - psb_destroy(sb); + prom_string_builder_destroy(sb); + sb = NULL; } -void -test_psb_dump(void) { - psb_t *sb = psb_new(); - const char *original = "foo bar"; - psb_add_str(sb, original); - const char *result = psb_dump(sb); - psb_clear(sb); - TEST_ASSERT(original != result); - TEST_ASSERT_EQUAL_STRING(original, result); - - psb_destroy(sb); - free((char *) result); +void test_prom_string_builder_dump(void) { + prom_string_builder_t *sb = prom_string_builder_new(); + const char *original = "foo bar"; + prom_string_builder_add_str(sb, original); + const char *result = prom_string_builder_dump(sb); + prom_string_builder_clear(sb); + TEST_ASSERT(original != result); + TEST_ASSERT_EQUAL_STRING(original, result); + + prom_string_builder_destroy(sb); + free((char *)result); + result = NULL; + sb = NULL; } -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(test_psb_add_str); - RUN_TEST(test_psb_add_char); - RUN_TEST(test_psb_dump); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(test_prom_string_builder_add_str); + RUN_TEST(test_prom_string_builder_add_char); + RUN_TEST(test_prom_string_builder_dump); + return UNITY_END(); } diff --git a/prom/test/prom_test_helpers.h b/prom/test/prom_test_helpers.h index 30dbb2c..4948c4c 100644 --- a/prom/test/prom_test_helpers.h +++ b/prom/test/prom_test_helpers.h @@ -19,8 +19,13 @@ #include "prom_metric_sample_t.h" #include "prom_metric_t.h" #include "prom_process_fds_i.h" +#include "prom_process_fds_t.h" #include "prom_process_limits_i.h" +#include "prom_process_limits_t.h" #include "prom_process_stat_i.h" #include "prom_process_stat_t.h" -#include "prom_string_builder.h" +#include "prom_procfs_i.h" +#include "prom_procfs_t.h" +#include "prom_string_builder_i.h" +#include "prom_string_builder_t.h" #include "unity.h" diff --git a/promhttp/CMakeLists.txt b/promhttp/CMakeLists.txt index 4a4a24b..5a14903 100644 --- a/promhttp/CMakeLists.txt +++ b/promhttp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9.1) +cmake_minimum_required(VERSION 3.14.5) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) @@ -10,21 +10,21 @@ execute_process( execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f1 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\1/g" OUTPUT_VARIABLE MajorVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f2 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\2/" OUTPUT_VARIABLE MinorVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f3 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\3/" OUTPUT_VARIABLE PatchVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) @@ -38,20 +38,15 @@ set(prom_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/../prom/include) set(public_files ${public_dir}/promhttp.h) set(private_files ${private_dir}/promhttp.c) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../prom/build /opt/local/lib ) +link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../prom/build) include(FindThreads) add_library(promhttp SHARED) -set_target_properties( - promhttp PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} -) target_include_directories( promhttp - PUBLIC ${public_dir} /usr/include /usr/include/microhttpd /opt/local/include ${prom_include_dir} + PUBLIC ${public_dir} /usr/include ${prom_include_dir} PRIVATE ${private_dir} ) @@ -76,12 +71,12 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${MajorVersion}) set(CPACK_PACKAGE_VERSION_MINOR ${MinorVersion}) set(CPACK_PACKAGE_VERSION_PATCH ${PatchVersion}) set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../README.md) -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C based lightweight Server library to expose metrics via HTTP using the Prometheus exposition format") -set(CPACK_PACKAGE_HOMEPAGE_URL https://github.com/jelmd/libprom) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A library providing a lightweight HTTP Server for Prometheus metric scraping") +set(CPACK_PACKAGE_HOMEPAGE_URL https://github.internal.digitalocean.com/timeseries/prometheus-client-c) set(CPACK_DEBIAN_PACKAGE_DEPENDS "libprom-dev (= ${Version})") set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmicrohttpd-dev") include(CPack) include(GNUInstallDirs) -install(TARGETS promhttp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libprom) +install(TARGETS promhttp ARCHIVE) +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/promhttp/include/promhttp.h b/promhttp/include/promhttp.h index 3385ba9..fc47523 100644 --- a/promhttp/include/promhttp.h +++ b/promhttp/include/promhttp.h @@ -1,6 +1,5 @@ /* Copyright 2019-2020 DigitalOcean Inc. - Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,7 +20,7 @@ * References: * * MHD_FLAG: https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dconst * * MHD_AcceptPolicyCallback: - * https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#index-MHD_005fResult + * https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#index-_002aMHD_005fAcceptPolicyCallback */ #include <string.h> @@ -30,30 +29,20 @@ #include "prom_collector_registry.h" /** - * @brief Sets the active registry for metric scraping. - * @param registry The target prom registry to generate the report to send in - * Prometheus exposition format. If NULL is passed, the default registry will - * be used. - * @note The registry MUST be initialized. + * @brief Sets the active registry for metric scraping. + * + * @param active_registery The target prom_collector_registry_t*. If null is passed, the default registry is used. + * The registry MUST be initialized. */ -void promhttp_set_active_collector_registry(pcr_t *registry); +void promhttp_set_active_collector_registry(prom_collector_registry_t *active_registry); /** - * @brief Start a daemon in the background and return a reference to it. + * @brief Starts a daemon in the background and returns a pointer to an HMD_Daemon. * * References: * * https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dinit * - * @return A reference to the started daemon. - */ -struct MHD_Daemon *promhttp_start_daemon(unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls); - -/** - * @brief Shutdown the given HTTP daemon. This is actually just a 1:1 wrapper - * around MHD_stop_daemon(daemon). Thus applications using just - * promhttp_start_daemon() and promhttp_stop_daemon() do not need to be linked - * against libmicrohttpd (against libpromhttp, only) and thus have only a - * loose/indirect dependency to libmicrohttpd, what may ease app maintenance. - * @param daemon The daemon to stop. + * @return struct MHD_Daemon* */ -void promhttp_stop_daemon(struct MHD_Daemon *daemon); +struct MHD_Daemon *promhttp_start_daemon(unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, + void *apc_cls); diff --git a/promhttp/src/promhttp.c b/promhttp/src/promhttp.c index 886d3ad..d94a53e 100644 --- a/promhttp/src/promhttp.c +++ b/promhttp/src/promhttp.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,71 +18,48 @@ #include "microhttpd.h" #include "prom.h" -#include "prom_log.h" -pcr_t *PROM_ACTIVE_REGISTRY; +prom_collector_registry_t *PROM_ACTIVE_REGISTRY; -void -promhttp_set_active_collector_registry(pcr_t *registry) { - PROM_ACTIVE_REGISTRY = (registry == NULL) - ? PROM_COLLECTOR_REGISTRY - : registry; - if (PROM_ACTIVE_REGISTRY == NULL) - PROM_WARN("No registry set to answer http requests", ""); +void promhttp_set_active_collector_registry(prom_collector_registry_t *active_registry) { + if (!active_registry) { + PROM_ACTIVE_REGISTRY = PROM_COLLECTOR_REGISTRY_DEFAULT; + } else { + PROM_ACTIVE_REGISTRY = active_registry; + } } -#if MHD_VERSION >= 0x00097500 - enum MHD_Result -#else - int -#endif -promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, - const char *method, const char *version, const char *upload_data, - size_t *upload_data_size, void **con_cls) -{ - char *body; - struct MHD_Response *response; - enum MHD_ResponseMemoryMode mode = MHD_RESPMEM_PERSISTENT; - unsigned int status = MHD_HTTP_BAD_REQUEST; - -#if MHD_VERSION >= 0x00097500 - enum MHD_Result ret; -#else - int ret; -#endif - - if (strcmp(method, "GET") != 0) { - body = "Invalid HTTP Method\n"; - } else if (strcmp(url, "/") == 0) { - body = "<html><body>See <a href='/metrics'>/metrics</a>.\r\n"; - status = MHD_HTTP_OK; - } else if (strcmp(url, "/metrics") == 0) { - body = pcr_bridge(PROM_ACTIVE_REGISTRY); - mode = MHD_RESPMEM_MUST_FREE; - status = MHD_HTTP_OK; - } else { - body = "Bad Request\n"; - } - - response = MHD_create_response_from_buffer(strlen(body), body, mode); - if (response == NULL) { - if (mode == MHD_RESPMEM_MUST_FREE) - free(body); - ret = MHD_NO; - } else { - ret = MHD_queue_response(connection, status, response); - MHD_destroy_response(response); - } - return ret; -} - -struct MHD_Daemon * -promhttp_start_daemon(unsigned int flags, unsigned short port, - MHD_AcceptPolicyCallback apc, void *apc_cls) -{ - return MHD_start_daemon(flags, port, apc, apc_cls, &promhttp_handler, NULL, MHD_OPTION_END); +int promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method, + const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) { + if (strcmp(method, "GET") != 0) { + char *buf = "Invalid HTTP Method\n"; + struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT); + int ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response); + MHD_destroy_response(response); + return ret; + } + if (strcmp(url, "/") == 0) { + char *buf = "OK\n"; + struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT); + int ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + MHD_destroy_response(response); + return ret; + } + if (strcmp(url, "/metrics") == 0) { + const char *buf = prom_collector_registry_bridge(PROM_ACTIVE_REGISTRY); + struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_MUST_FREE); + int ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + MHD_destroy_response(response); + return ret; + } + char *buf = "Bad Request\n"; + struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT); + int ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response); + MHD_destroy_response(response); + return ret; } -void promhttp_stop_daemon(struct MHD_Daemon *daemon) { - MHD_stop_daemon(daemon); +struct MHD_Daemon *promhttp_start_daemon(unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, + void *apc_cls) { + return MHD_start_daemon(flags, port, apc, apc_cls, &promhttp_handler, NULL, MHD_OPTION_END); } diff --git a/promtest/CMakeLists.txt b/promtest/CMakeLists.txt index f2d46f2..fa5d8b2 100644 --- a/promtest/CMakeLists.txt +++ b/promtest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9.1) +cmake_minimum_required(VERSION 3.14.5) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) @@ -10,27 +10,48 @@ execute_process( execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f1 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\1/g" OUTPUT_VARIABLE MajorVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f2 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\2/" OUTPUT_VARIABLE MinorVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION - COMMAND cut -f3 -d. + COMMAND sed --regexp-extended "s/([0-9]+)\.([0-9])+\.([0-9]+)/\\3/" OUTPUT_VARIABLE PatchVersion OUTPUT_STRIP_TRAILING_WHITESPACE ) project(promtest VERSION ${Version} LANGUAGES C) +set(prom_deb ${CMAKE_CURRENT_SOURCE_DIR}/../prom/libprom-dev-${Version}-Linux.deb) +set(promhttp_deb ${CMAKE_CURRENT_SOURCE_DIR}/../promhttp/libpromhttp-dev-${Version}-Linux.deb) + +execute_process( + COMMAND dpkg -i ${prom_deb} + RESULT_VARIABLE prom_install_result +) + +if(${prom_install_result} GREATER 0) + message(FATAL_ERROR "failed to install ${prom_deb}") +endif() + +execute_process( + COMMAND dpkg -i ${promhttp_deb} + RESULT_VARIABLE promhttp_install_result +) + +if(${promhttp_install_result} GREATER 0) + message(FATAL_ERROR "failed to install ${promhttp_deb}") +endif() + enable_testing() set(vendor_dir ${CMAKE_SOURCE_DIR}/../vendor) set(test_dir ${CMAKE_SOURCE_DIR}/test) @@ -95,15 +116,7 @@ add_executable( ${test_dir}/promtest_histogram.h ) target_link_libraries(promtest microhttpd prom promhttp Unity parson Threads::Threads) -target_include_directories(promtest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/../prom/include ${CMAKE_CURRENT_SOURCE_DIR}/../promhttp/include /usr/include/microhttpd /opt/local/include ) - -if (CMAKE_VERSION VERSION_LESS 3.13.0) -# buggy cmake crap has no effect: link_directories( ... ) -# so we use the wooden hammer: -set(CMAKE_C_LINK_FLAGS "-L ${CMAKE_CURRENT_SOURCE_DIR}/../prom/build -L ${CMAKE_CURRENT_SOURCE_DIR}/../promhttp/build") -else() -target_link_directories( promtest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../prom/build ${CMAKE_CURRENT_SOURCE_DIR}/../promhttp/build /opt/local/lib ) -endif() +target_include_directories(promtest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) add_test( NAME promtest COMMAND promtest diff --git a/promtest/prom2json.sh b/promtest/prom2json.sh deleted file mode 100755 index afc80a1..0000000 --- a/promtest/prom2json.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/ksh93 - -# promtest requires the prom2json binary - so fetch it from github if n/a - -SDIR=${.sh.file%/*}/.. -PROM2JSON=${ whence prom2json ; } -[[ -n ${PROM2JSON} || -x ${SDIR}/bin/prom2json ]] && return 0 - -VERSION='1.3.0' -ARCH='amd64' -OS='linux' - -BN="prom2json-${VERSION}.${OS}-${ARCH}" -ARC=https://github.com/prometheus/prom2json/releases/download/v${VERSION}/${BN}.tar.gz -wget -O ${SDIR}/prom2json.tar.gz ${ARC} || return 1 -tar xzf ${SDIR}/prom2json.tar.gz ${BN}/prom2json -[[ -e ${SDIR}/bin ]] || mkdir ${SDIR}/bin -mv ${BN}/prom2json ${SDIR}/bin/ -rmdir ${BN} -rm -f ${SDIR}/prom2json.tar.gz diff --git a/promtest/test/promtest.c b/promtest/test/promtest.c index 68481cf..5f1939e 100644 --- a/promtest/test/promtest.c +++ b/promtest/test/promtest.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,55 +14,16 @@ * limitations under the License. */ -#include <pthread.h> -#include "promhttp.h" - #include "promtest_counter.h" #include "promtest_gauge.h" #include "promtest_histogram.h" #include "promtest_helpers.h" #include "unity.h" -struct MHD_Daemon *promtest_daemon; -pthread_mutex_t smoke_mutex = PTHREAD_MUTEX_INITIALIZER; - -void -setUp(void) { - pthread_mutex_lock(&smoke_mutex); - // Initialize the default collector registry - pcr_default_init(); - // Set the collector registry on the handler to the default registry - promhttp_set_active_collector_registry(NULL); - // Start the HTTP server - unsigned int flags = MHD_USE_SELECT_INTERNALLY; -#ifdef MHD_USE_ERROR_LOG - flags |= MHD_USE_ERROR_LOG -#endif -#ifdef MHD_USE_AUTO - flags |= MHD_USE_AUTO; -#endif - promtest_daemon = promhttp_start_daemon(flags, PORT, NULL, NULL); -} - -void -tearDown(void) { - // Destroy the default registry. This effectively deallocates all metrics - // registered to it, including itself - pcr_destroy(PROM_COLLECTOR_REGISTRY); - PROM_COLLECTOR_REGISTRY = NULL; - - // Stop the HTTP server - if (promtest_daemon != NULL) - MHD_stop_daemon(promtest_daemon); - promtest_daemon = NULL; - pthread_mutex_unlock(&smoke_mutex); -} - -int -main(int argc, const char **argv) { - UNITY_BEGIN(); - RUN_TEST(promtest_counter); - RUN_TEST(promtest_gauge); - RUN_TEST(promtest_histogram); - return UNITY_END(); +int main(int argc, const char **argv) { + UNITY_BEGIN(); + RUN_TEST(promtest_counter); + RUN_TEST(promtest_gauge); + RUN_TEST(promtest_histogram); + return UNITY_END(); } diff --git a/promtest/test/promtest_counter.c b/promtest/test/promtest_counter.c index f97b2d8..5870d7d 100644 --- a/promtest/test/promtest_counter.c +++ b/promtest/test/promtest_counter.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,83 +24,117 @@ #include "promtest_helpers.h" #include "unity.h" -static void *PTC_handler(void *data); +static void *promtest_counter_handler(void *data); static int promtest_parse_counter_output(const char *output, char **value); prom_counter_t *foo_counter; -#define METRIC "foo_counter" // the counter to lookup - /** - * @brief For each thread in a threadpool of 10 we increment a single counter - * 1 million times + * @brief For each thread in a threadpool of 10 we increment a single counter 1 + * million times * * The purpose of this test is to check for deadlock and race conditions */ -void -promtest_counter(void) { - // Set the counter - foo_counter = pcr_must_register_metric(prom_counter_new(METRIC , - "counter for foo", 0, NULL)); - - if (foo_counter == NULL || promtest_daemon == NULL) - TEST_FAIL_MESSAGE("failed to setup promtest_counter"); - - void *retvals[PROMTEST_THREAD_POOL_SIZE]; - pthread_t thread_pool[PROMTEST_THREAD_POOL_SIZE]; - - // Start each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (pthread_create(&(thread_pool[i]), NULL, PTC_handler, NULL)) - TEST_FAIL_MESSAGE("failed to create thread"); - } - - // Join each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (pthread_join(thread_pool[i], (void **) &(retvals[i]))) - TEST_FAIL_MESSAGE("thread failed to join"); - } - - // verify clean exit for each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (*((int *)retvals[i]) != 0) - TEST_FAIL_MESSAGE("thread did not exit properly"); - } - - // scrape the endpoint - FILE *f = popen("prom2json " ENDPOINT , "r"); - if (f == NULL) - TEST_FAIL_MESSAGE("prom2json pipe setup failed"); - promtest_popen_buf_t *buf = promtest_popen_buf_new(f); - if (promtest_popen_buf_read(buf)) - TEST_FAIL_MESSAGE("failed to scrape endpoint"); - - const char *output = strdup(buf->buf); - if (promtest_popen_buf_destroy(buf)) - TEST_FAIL_MESSAGE("failed to duplicate buf"); - - // Parse the output - char *value = (char *) malloc(sizeof(char) * 100); - if (promtest_parse_counter_output(output, &value)) - TEST_FAIL_MESSAGE("failed to parse output"); - - // Assert - TEST_ASSERT_EQUAL_STRING_MESSAGE("5e+06", value, - "expected for " METRIC_LABEL_SCRAPE "_" METRIC); - - free(value); +void promtest_counter(void) { + if (promtest_counter_setup()) { + TEST_FAIL_MESSAGE("failed to setup promtest_counter"); + } + + void *retvals[PROMTEST_THREAD_POOL_SIZE]; + pthread_t thread_pool[PROMTEST_THREAD_POOL_SIZE]; + + // Start each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (pthread_create(&(thread_pool[i]), NULL, promtest_counter_handler, NULL)) { + TEST_FAIL_MESSAGE("failed to create thread"); + } + } + + // Join each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (pthread_join(thread_pool[i], (void **)&(retvals[i]))) { + TEST_FAIL_MESSAGE("thread failed to join"); + } + } + + // verify clean exit for each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (*((int *)retvals[i]) != 0) { + TEST_FAIL_MESSAGE("thread did not exit properly"); + } + } + + // scrape the endpoint + FILE *f = popen("prom2json http://0.0.0.0:8000/metrics", "r"); + if (f == NULL) { + TEST_FAIL_MESSAGE("shell out failed"); + } + promtest_popen_buf_t *buf = promtest_popen_buf_new(f); + if (promtest_popen_buf_read(buf)) { + TEST_FAIL_MESSAGE("failed to scrape endpoint"); + } + + const char *output = strdup(buf->buf); + if (promtest_popen_buf_destroy(buf)) { + TEST_FAIL_MESSAGE("failed to duplicate buf"); + } + + // Parse the output + char *value = (char *)malloc(sizeof(char) * 100); + if (promtest_parse_counter_output(output, &value)) { + TEST_FAIL_MESSAGE("failed to parse output"); + } + + // Assert + TEST_ASSERT_EQUAL_STRING("5e+06", value); + if (promtest_counter_teardown()) { + TEST_FAIL_MESSAGE("failed to teardown promtest_counter"); + } + + free(value); +} + +int promtest_counter_setup(void) { + // Initialize the default collector registry + prom_collector_registry_default_init(); + + // Set the counter + foo_counter = + prom_collector_registry_must_register_metric(prom_counter_new("foo_counter", "counter for foo", 0, NULL)); + + // Set the collector registry on the handler to the default registry + promhttp_set_active_collector_registry(NULL); + + // Start the HTTP server + promtest_daemon = promhttp_start_daemon(MHD_USE_SELECT_INTERNALLY, 8000, NULL, NULL); + + if (promtest_daemon == NULL) + return 1; + else + return 0; +} + +int promtest_counter_teardown(void) { + // Destroy the default registry. This effectively deallocates all metrics + // registered to it, including itself + prom_collector_registry_destroy(PROM_COLLECTOR_REGISTRY_DEFAULT); + PROM_COLLECTOR_REGISTRY_DEFAULT = NULL; + + // Stop the HTTP server + MHD_stop_daemon(promtest_daemon); + + return 0; } /** * @brief The entrypoint to a worker thread within the prom_counter_test */ -static void * -PTC_handler(void *data) { - for (int i = 0; i < 1000000; i++) { - prom_counter_inc(foo_counter, NULL); - } - int *retval = (int *) malloc(sizeof(int)); - *retval = 0; - return (void *) retval; +static void *promtest_counter_handler(void *data) { + for (int i = 0; i < 1000000; i++) { + prom_counter_inc(foo_counter, NULL); + } + int *retval = (int *)malloc(sizeof(int)); + *retval = 0; + return (void *)retval; } /** @@ -109,45 +142,42 @@ PTC_handler(void *data) { * * We must past a pointer to a char* so the value gets updated */ -static int -promtest_parse_counter_output(const char *output, char **value) { - // Parse the JSON output - JSON_Value *root = json_parse_string(output); - if (json_value_get_type(root) != JSONArray) - TEST_FAIL_MESSAGE("JSON: root container is not an []"); - *value = NULL; - - JSON_Array *collection = json_value_get_array(root); - if (collection == NULL) - TEST_FAIL_MESSAGE("JSON: Failed to extract root [] elements"); - - for (int i = 0; i < json_array_get_count(collection); i++) { - JSON_Object *obj = json_array_get_object(collection, i); - if (obj == NULL) - TEST_FAIL_MESSAGE("JSON: root [] element is not an {}"); - const char *name = json_object_get_string(obj, "name"); - if (strcmp(name, METRIC_LABEL_SCRAPE "_" METRIC)) - continue; - - *value = ""; - JSON_Array *samples = json_object_dotget_array(obj, "metrics"); - if (samples == NULL) - TEST_FAIL_MESSAGE("JSON: root [] element contains no metric []"); - if (json_array_get_count(samples) < 1) - TEST_FAIL_MESSAGE("JSON: metric [] contains no sample"); - JSON_Object *sample = json_array_get_object(samples, 0); - if (sample == NULL) - TEST_FAIL_MESSAGE("JSON: failed to get first metric sample"); - *value = (char *) json_object_get_string(sample, "value"); - if (*value == NULL) { - TEST_FAIL_MESSAGE("JSON: failed to extract metric sample[0] value"); - *value = ""; - } - break; - } - if (*value == NULL) - TEST_FAIL_MESSAGE("JSON: metric '" METRIC_LABEL_SCRAPE "_" METRIC - "' not found"); - - return (strlen(*value) == 0) ? 1 : 0; +static int promtest_parse_counter_output(const char *output, char **value) { + // Parse the JSON output + JSON_Value *root = json_parse_string(output); + if (json_value_get_type(root) != JSONArray) { + TEST_FAIL_MESSAGE("JSON Parse error...expected JSONArray type"); + } + + JSON_Array *collection = json_value_get_array(root); + if (collection == NULL) { + TEST_FAIL_MESSAGE("Failed to extract array from JSON_Value"); + } + + for (int i = 0; i < json_array_get_count(collection); i++) { + JSON_Object *obj = json_array_get_object(collection, i); + if (obj == NULL) { + TEST_FAIL_MESSAGE("failed to retrieve single object within JSON_Array"); + } + const char *name = json_object_get_string(obj, "name"); + if (strcmp(name, "foo_counter")) { + continue; + } + JSON_Array *samples = json_object_dotget_array(obj, "metrics"); + if (samples == NULL) { + TEST_FAIL_MESSAGE("failed to retrieve metrics from JSON_Object"); + } + if (json_array_get_count(samples) < 1) { + TEST_FAIL_MESSAGE("No samples found"); + } + JSON_Object *sample = json_array_get_object(samples, 0); + if (sample == NULL) { + TEST_FAIL_MESSAGE("failed to get metric sample"); + } + *value = (char *)json_object_get_string(sample, "value"); + } + if (strlen(*value) == 0) { + return 1; + } + return 0; } diff --git a/promtest/test/promtest_counter.h b/promtest/test/promtest_counter.h index c95163b..b93facb 100644 --- a/promtest/test/promtest_counter.h +++ b/promtest/test/promtest_counter.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +20,10 @@ #define PROMTEST_COUNTER_H extern prom_counter_t *foo_counter; + +int promtest_counter_setup(void); +int promtest_counter_teardown(void); + void promtest_counter(void); #endif // PROMTEST_COUNTER_H diff --git a/promtest/test/promtest_gauge.c b/promtest/test/promtest_gauge.c index 4b5e1fe..5d0e397 100644 --- a/promtest/test/promtest_gauge.c +++ b/promtest/test/promtest_gauge.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,82 +24,117 @@ #include "promtest_helpers.h" #include "unity.h" -static void *PTG_handler(void *data); +static void *promtest_gauge_handler(void *data); static int promtest_parse_gauge_output(const char *output, char **value); prom_gauge_t *foo_gauge; -#define METRIC "foo_gauge" // metric to lookup - /** - * @brief For each thread in a threadpool of 10 we increment a single gauge - * 1 million times + * @brief For each thread in a threadpool of 10 we increment a single gauge 1 + * million times * * The purpose of this test is to check for deadlock and race conditions */ -void -promtest_gauge(void) { - // Set the gauge - foo_gauge = pcr_must_register_metric(prom_gauge_new(METRIC, - "gauge for foo", 0, NULL)); - - if (foo_gauge == NULL || promtest_daemon == NULL) - TEST_FAIL_MESSAGE("failed to setup promtest_gauge"); - - void *retvals[PROMTEST_THREAD_POOL_SIZE]; - pthread_t thread_pool[PROMTEST_THREAD_POOL_SIZE]; - - // Start each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (pthread_create(&(thread_pool[i]), NULL, PTG_handler, NULL)) - TEST_FAIL_MESSAGE("failed to create thread"); - } - - // Join each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (pthread_join(thread_pool[i], (void **) &(retvals[i]))) - TEST_FAIL_MESSAGE("thread failed to join"); - } - - // verify clean exit for each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (*((int *) retvals[i]) != 0) - TEST_FAIL_MESSAGE("thread did not exit properly"); - } - - // scrape the endpoint - FILE *f = popen("prom2json " ENDPOINT , "r"); - if (f == NULL) - TEST_FAIL_MESSAGE("prom2json pipe setup failed"); - promtest_popen_buf_t *buf = promtest_popen_buf_new(f); - if (promtest_popen_buf_read(buf)) - TEST_FAIL_MESSAGE("failed to scrape endpoint"); - - const char *output = strdup(buf->buf); - if (promtest_popen_buf_destroy(buf)) - TEST_FAIL_MESSAGE("failed to duplicate buf"); - - // Parse the output - char *value = (char *) malloc(sizeof(char) * 100); - if (promtest_parse_gauge_output(output, &value)) - TEST_FAIL_MESSAGE("failed to parse output"); - - // Assert - TEST_ASSERT_EQUAL_STRING_MESSAGE("5e+06", value, - "expected for " METRIC_LABEL_SCRAPE "_" METRIC); - - free(value); +void promtest_gauge(void) { + if (promtest_gauge_setup()) { + TEST_FAIL_MESSAGE("failed to setup promtest_gauge"); + } + + void *retvals[PROMTEST_THREAD_POOL_SIZE]; + pthread_t thread_pool[PROMTEST_THREAD_POOL_SIZE]; + + // Start each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (pthread_create(&(thread_pool[i]), NULL, promtest_gauge_handler, NULL)) { + TEST_FAIL_MESSAGE("failed to create thread"); + } + } + + // Join each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (pthread_join(thread_pool[i], (void **)&(retvals[i]))) { + TEST_FAIL_MESSAGE("thread failed to join"); + } + } + + // verify clean exit for each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (*((int *)retvals[i]) != 0) { + TEST_FAIL_MESSAGE("thread did not exit properly"); + } + } + + // scrape the endpoint + FILE *f = popen("prom2json http://0.0.0.0:8000/metrics", "r"); + if (f == NULL) { + TEST_FAIL_MESSAGE("shell out failed"); + } + promtest_popen_buf_t *buf = promtest_popen_buf_new(f); + if (promtest_popen_buf_read(buf)) { + TEST_FAIL_MESSAGE("failed to scrape endpoint"); + } + + const char *output = strdup(buf->buf); + if (promtest_popen_buf_destroy(buf)) { + TEST_FAIL_MESSAGE("failed to duplicate buf"); + } + + // Parse the output + char *value = (char *)malloc(sizeof(char) * 100); + if (promtest_parse_gauge_output(output, &value)) { + TEST_FAIL_MESSAGE("failed to parse output"); + } + + // Assert + TEST_ASSERT_EQUAL_STRING("5e+06", value); + if (promtest_gauge_teardown()) { + TEST_FAIL_MESSAGE("failed to teardown promtest_gauge"); + } + + free(value); +} + +int promtest_gauge_setup(void) { + // Initialize the default collector registry + prom_collector_registry_default_init(); + + // Set the gauge + foo_gauge = prom_collector_registry_must_register_metric(prom_gauge_new("foo_gauge", "gauge for foo", 0, NULL)); + + // Set the collector registry on the handler to the default registry + promhttp_set_active_collector_registry(NULL); + + // Start the HTTP server + promtest_daemon = promhttp_start_daemon(MHD_USE_SELECT_INTERNALLY, 8000, NULL, NULL); + + if (promtest_daemon == NULL) + return 1; + else + return 0; +} + +int promtest_gauge_teardown(void) { + // Destroy the default registry. This effectively deallocates all metrics + // registered to it, including itself + prom_collector_registry_destroy(PROM_COLLECTOR_REGISTRY_DEFAULT); + + PROM_COLLECTOR_REGISTRY_DEFAULT = NULL; + + // Stop the HTTP server + MHD_stop_daemon(promtest_daemon); + + return 0; } /** * @brief The entrypoint to a worker thread within the prom_gauge_test */ -static void * -PTG_handler(void *data) { - for (int i = 0; i < 1000000; i++) - prom_gauge_inc(foo_gauge, NULL); - int *retval = (int *) malloc(sizeof(int)); - *retval = 0; - return (void *) retval; +static void *promtest_gauge_handler(void *data) { + for (int i = 0; i < 1000000; i++) { + prom_gauge_inc(foo_gauge, NULL); + } + int *retval = (int *)malloc(sizeof(int)); + *retval = 0; + return (void *)retval; } /** @@ -108,45 +142,42 @@ PTG_handler(void *data) { * * We must past a pointer to a char* so the value gets updated */ -static int -promtest_parse_gauge_output(const char *output, char **value) { - // Parse the JSON output - JSON_Value *root = json_parse_string(output); - if (json_value_get_type(root) != JSONArray) - TEST_FAIL_MESSAGE("JSON: root container is not an []"); - - JSON_Array *collection = json_value_get_array(root); - if (collection == NULL) - TEST_FAIL_MESSAGE("JSON: Failed to extract root [] elements"); - *value = NULL; - - for (int i = 0; i < json_array_get_count(collection); i++) { - JSON_Object *obj = json_array_get_object(collection, i); - if (obj == NULL) - TEST_FAIL_MESSAGE("JSON: root [] element is not an {}"); - const char *name = json_object_get_string(obj, "name"); - if (strcmp(name, METRIC_LABEL_SCRAPE "_" METRIC)) - continue; - - *value = ""; - JSON_Array *samples = json_object_dotget_array(obj, "metrics"); - if (samples == NULL) - TEST_FAIL_MESSAGE("JSON: root [] element contains no metric []"); - if (json_array_get_count(samples) < 1) - TEST_FAIL_MESSAGE("JSON: metric [] contains no sample"); - JSON_Object *sample = json_array_get_object(samples, 0); - if (sample == NULL) - TEST_FAIL_MESSAGE("JSON: failed to get first metric sample"); - *value = (char *) json_object_get_string(sample, "value"); - if (*value == NULL) { - TEST_FAIL_MESSAGE("JSON: failed to extract metric sample[0] value"); - *value = ""; - } - break; - } - if (*value == NULL) - TEST_FAIL_MESSAGE("JSON: metric '" METRIC_LABEL_SCRAPE "_" METRIC - "' not found"); - - return (strlen(*value) == 0) ? 1 : 0; +static int promtest_parse_gauge_output(const char *output, char **value) { + // Parse the JSON output + JSON_Value *root = json_parse_string(output); + if (json_value_get_type(root) != JSONArray) { + TEST_FAIL_MESSAGE("JSON Parse error...expected JSONArray type"); + } + + JSON_Array *collection = json_value_get_array(root); + if (collection == NULL) { + TEST_FAIL_MESSAGE("Failed to extract array from JSON_Value"); + } + + for (int i = 0; i < json_array_get_count(collection); i++) { + JSON_Object *obj = json_array_get_object(collection, i); + if (obj == NULL) { + TEST_FAIL_MESSAGE("failed to retrieve single object within JSON_Array"); + } + const char *name = json_object_get_string(obj, "name"); + if (strcmp(name, "foo_gauge")) { + continue; + } + JSON_Array *samples = json_object_dotget_array(obj, "metrics"); + if (samples == NULL) { + TEST_FAIL_MESSAGE("failed to retrieve metrics from JSON_Object"); + } + if (json_array_get_count(samples) < 1) { + TEST_FAIL_MESSAGE("No samples found"); + } + JSON_Object *sample = json_array_get_object(samples, 0); + if (sample == NULL) { + TEST_FAIL_MESSAGE("failed to get metric sample"); + } + *value = (char *)json_object_get_string(sample, "value"); + } + if (strlen(*value) == 0) { + return 1; + } + return 0; } diff --git a/promtest/test/promtest_gauge.h b/promtest/test/promtest_gauge.h index 2b67141..b418ef7 100644 --- a/promtest/test/promtest_gauge.h +++ b/promtest/test/promtest_gauge.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +20,10 @@ #define PROMTEST_GAUGE_H extern prom_gauge_t *foo_gauge; + +int promtest_gauge_setup(void); +int promtest_gauge_teardown(void); + void promtest_gauge(void); #endif // PROMTEST_GAUGE_H diff --git a/promtest/test/promtest_helpers.c b/promtest/test/promtest_helpers.c index 51fd1ad..d658d0f 100644 --- a/promtest/test/promtest_helpers.c +++ b/promtest/test/promtest_helpers.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,48 +21,43 @@ #include "prom.h" -promtest_popen_buf_t * -promtest_popen_buf_new(FILE *f) { - promtest_popen_buf_t *self = (promtest_popen_buf_t *) - malloc(sizeof(promtest_popen_buf_t)); - self->buf = malloc(32); - self->size = 32; - self->allocated = 32; - self->f = f; - return self; +struct MHD_Daemon *promtest_daemon; + +promtest_popen_buf_t *promtest_popen_buf_new(FILE *f) { + promtest_popen_buf_t *self = (promtest_popen_buf_t *)malloc(sizeof(promtest_popen_buf_t)); + self->buf = malloc(32); + self->size = 32; + self->allocated = 32; + self->f = f; + return self; } -int -promtest_popen_buf_ensure_space(promtest_popen_buf_t *self) { - if (self->allocated >= self->size + 1) - return 0; - while (self->allocated < self->size + 1) - self->allocated <<= 1; - self->buf = (char *) prom_realloc(self->buf, self->allocated); - return 0; +int promtest_popen_buf_ensure_space(promtest_popen_buf_t *self) { + if (self->allocated >= self->size + 1) return 0; + while (self->allocated < self->size + 1) self->allocated <<= 1; + self->buf = (char *)prom_realloc(self->buf, self->allocated); + return 0; } -int -promtest_popen_buf_destroy(promtest_popen_buf_t *self) { - if (self == NULL) - return 0; - free((void *)self->buf); - self->buf = NULL; - free((void *) self); - return 0; +int promtest_popen_buf_destroy(promtest_popen_buf_t *self) { + if (self == NULL) { + return 0; + } + free((void *)self->buf); + self->buf = NULL; + free((void *)self); + self = NULL; + return 0; } -int -promtest_popen_buf_read(promtest_popen_buf_t *self) { - for (int current_char = fgetc(self->f), i = 0; current_char != EOF; - current_char = fgetc(self->f), i++) - { - promtest_popen_buf_ensure_space(self); - self->buf[i] = current_char; - self->size++; - } - promtest_popen_buf_ensure_space(self); - self->buf[self->size] = '\0'; - self->size++; - return 0; +int promtest_popen_buf_read(promtest_popen_buf_t *self) { + for (int current_char = fgetc(self->f), i = 0; current_char != EOF; current_char = fgetc(self->f), i++) { + promtest_popen_buf_ensure_space(self); + self->buf[i] = current_char; + self->size++; + } + promtest_popen_buf_ensure_space(self); + self->buf[self->size] = '\0'; + self->size++; + return 0; } diff --git a/promtest/test/promtest_helpers.h b/promtest/test/promtest_helpers.h index b1a0708..93beb01 100644 --- a/promtest/test/promtest_helpers.h +++ b/promtest/test/promtest_helpers.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +20,14 @@ #define PROMTTEST_HELPERS_H #define PROMTEST_THREAD_POOL_SIZE 5 -#define PORT 8000 -#define ENDPOINT "http://0.0.0.0:8000/metrics" // keep in sync with PORT extern struct MHD_Daemon *promtest_daemon; typedef struct promtest_popen_buf { - char *buf; - int size; - int allocated; - FILE *f; + char *buf; + int size; + int allocated; + FILE *f; } promtest_popen_buf_t; promtest_popen_buf_t *promtest_popen_buf_new(FILE *f); diff --git a/promtest/test/promtest_histogram.c b/promtest/test/promtest_histogram.c index a3d3754..ac8fd00 100644 --- a/promtest/test/promtest_histogram.c +++ b/promtest/test/promtest_histogram.c @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,84 +24,118 @@ #include "promtest_helpers.h" #include "unity.h" -#define METRIC "foo_histogram" // metric to lookup - -static void *PTH_handler(void *data); +static void *promtest_histogram_handler(void *data); static int promtest_parse_histogram_output(const char *output, char **value); prom_histogram_t *foo_histogram; /** - * @brief For each thread in a threadpool of 10 we increment a single histogram - * 1 million times + * @brief For each thread in a threadpool of 10 we increment a single histogram 1 + * million times * * The purpose of this test is to check for deadlock and race conditions */ -void -promtest_histogram(void) { - // Set the histogram - foo_histogram = pcr_must_register_metric(prom_histogram_new(METRIC , - "histogram for foo", prom_histogram_default_buckets, 0, NULL)); - - if (foo_histogram == NULL || promtest_daemon == NULL) - TEST_FAIL_MESSAGE("failed to setup promtest_histogram"); - - void *retvals[PROMTEST_THREAD_POOL_SIZE]; - pthread_t thread_pool[PROMTEST_THREAD_POOL_SIZE]; - - // Start each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (pthread_create(&(thread_pool[i]), NULL, PTH_handler, NULL)) - TEST_FAIL_MESSAGE("failed to create thread"); - } - - // Join each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (pthread_join(thread_pool[i], (void **) &(retvals[i]))) - TEST_FAIL_MESSAGE("thread failed to join"); - } - - // verify clean exit for each thread - for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { - if (*((int *) retvals[i]) != 0) - TEST_FAIL_MESSAGE("thread did not exit properly"); - } - - // scrape the endpoint - FILE *f = popen("prom2json " ENDPOINT, "r"); - if (f == NULL) - TEST_FAIL_MESSAGE("prom2json pipe setup failed"); - promtest_popen_buf_t *buf = promtest_popen_buf_new(f); - if (promtest_popen_buf_read(buf)) - TEST_FAIL_MESSAGE("failed to scrape endpoint"); - - const char *output = strdup(buf->buf); - if (promtest_popen_buf_destroy(buf)) - TEST_FAIL_MESSAGE("failed to duplicate buf"); - - // Parse the output - char *value = (char *) malloc(sizeof(char) * 100); - if (promtest_parse_histogram_output(output, &value)) - TEST_FAIL_MESSAGE("failed to parse output"); - - // Assert - //TEST_ASSERT_EQUAL_STRING("5e+06", value); - TEST_ASSERT_EQUAL_STRING_MESSAGE("5000000", value, - "expected for " METRIC_LABEL_SCRAPE "_" METRIC); - - free(value); +void promtest_histogram(void) { + if (promtest_histogram_setup()) { + TEST_FAIL_MESSAGE("failed to setup promtest_histogram"); + } + + void *retvals[PROMTEST_THREAD_POOL_SIZE]; + pthread_t thread_pool[PROMTEST_THREAD_POOL_SIZE]; + + // Start each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (pthread_create(&(thread_pool[i]), NULL, promtest_histogram_handler, NULL)) { + TEST_FAIL_MESSAGE("failed to create thread"); + } + } + + // Join each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (pthread_join(thread_pool[i], (void **)&(retvals[i]))) { + TEST_FAIL_MESSAGE("thread failed to join"); + } + } + + // verify clean exit for each thread + for (int i = 0; i < PROMTEST_THREAD_POOL_SIZE; i++) { + if (*((int *)retvals[i]) != 0) { + TEST_FAIL_MESSAGE("thread did not exit properly"); + } + } + + // scrape the endpoint + FILE *f = popen("prom2json http://0.0.0.0:8000/metrics", "r"); + if (f == NULL) { + TEST_FAIL_MESSAGE("shell out failed"); + } + promtest_popen_buf_t *buf = promtest_popen_buf_new(f); + if (promtest_popen_buf_read(buf)) { + TEST_FAIL_MESSAGE("failed to scrape endpoint"); + } + + const char *output = strdup(buf->buf); + if (promtest_popen_buf_destroy(buf)) { + TEST_FAIL_MESSAGE("failed to duplicate buf"); + } + + // Parse the output + char *value = (char *)malloc(sizeof(char) * 100); + if (promtest_parse_histogram_output(output, &value)) { + TEST_FAIL_MESSAGE("failed to parse output"); + } + + // Assert + //TEST_ASSERT_EQUAL_STRING("5e+06", value); + TEST_ASSERT_EQUAL_STRING("5000000", value); + if (promtest_histogram_teardown()) { + TEST_FAIL_MESSAGE("failed to teardown promtest_histogram"); + } + + free(value); +} + +int promtest_histogram_setup(void) { + // Initialize the default collector registry + prom_collector_registry_default_init(); + + // Set the histogram + foo_histogram = + prom_collector_registry_must_register_metric(prom_histogram_new("foo_histogram", "histogram for foo", prom_histogram_default_buckets, 0, NULL)); + + // Set the collector registry on the handler to the default registry + promhttp_set_active_collector_registry(NULL); + + // Start the HTTP server + promtest_daemon = promhttp_start_daemon(MHD_USE_SELECT_INTERNALLY, 8000, NULL, NULL); + + if (promtest_daemon == NULL) + return 1; + else + return 0; +} + +int promtest_histogram_teardown(void) { + // Destroy the default registry. This effectively deallocates all metrics + // registered to it, including itself + prom_collector_registry_destroy(PROM_COLLECTOR_REGISTRY_DEFAULT); + PROM_COLLECTOR_REGISTRY_DEFAULT = NULL; + + // Stop the HTTP server + MHD_stop_daemon(promtest_daemon); + + return 0; } /** * @brief The entrypoint to a worker thread within the prom_histogram_test */ -static void * -PTH_handler(void *data) { - for (int i = 0; i < 1000000; i++) { - prom_histogram_observe(foo_histogram, i/1000.0, NULL); - } - int *retval = (int *) malloc(sizeof(int)); - *retval = 0; - return (void *) retval; +static void *promtest_histogram_handler(void *data) { + for (int i = 0; i < 1000000; i++) { + prom_histogram_observe(foo_histogram, i/1000.0, NULL); + } + int *retval = (int *)malloc(sizeof(int)); + *retval = 0; + return (void *)retval; } /** @@ -110,46 +143,43 @@ PTH_handler(void *data) { * * We must past a pointer to a char* so the value gets updated */ -static int -promtest_parse_histogram_output(const char *output, char **value) { - // Parse the JSON output - JSON_Value *root = json_parse_string(output); - if (json_value_get_type(root) != JSONArray) - TEST_FAIL_MESSAGE("JSON: root container is not an []"); - - JSON_Array *collection = json_value_get_array(root); - if (collection == NULL) - TEST_FAIL_MESSAGE("JSON: Failed to extract root [] elements"); - *value = NULL; - - for (int i = 0; i < json_array_get_count(collection); i++) { - JSON_Object *obj = json_array_get_object(collection, i); - if (obj == NULL) - TEST_FAIL_MESSAGE("JSON: root container is not an []"); - const char *name = json_object_get_string(obj, "name"); - if (strcmp(name, METRIC_LABEL_SCRAPE "_" METRIC)) - continue; - - *value = ""; - JSON_Array *samples = json_object_dotget_array(obj, "metrics"); - if (samples == NULL) - TEST_FAIL_MESSAGE("JSON: root [] element contains no metric []"); - if (json_array_get_count(samples) < 1) - TEST_FAIL_MESSAGE("JSON: metric [] contains no sample"); - JSON_Object *sample = json_array_get_object(samples, 0); - if (sample == NULL) - TEST_FAIL_MESSAGE("JSON: failed to get first metric sample"); - *value = (char *) json_object_get_string(sample, "count"); - if (*value == NULL) { - TEST_FAIL_MESSAGE("JSON: failed to extract metric sample[0] value"); - *value = ""; - } - break; - } - - if (*value == NULL) - TEST_FAIL_MESSAGE("JSON: metric '" METRIC_LABEL_SCRAPE "_" METRIC - "' not found"); - - return (strlen(*value) == 0) ? 1 : 0; +static int promtest_parse_histogram_output(const char *output, char **value) { + // Parse the JSON output + JSON_Value *root = json_parse_string(output); + if (json_value_get_type(root) != JSONArray) { + TEST_FAIL_MESSAGE("JSON Parse error...expected JSONArray type"); + } + + JSON_Array *collection = json_value_get_array(root); + if (collection == NULL) { + TEST_FAIL_MESSAGE("Failed to extract array from JSON_Value"); + } + + for (int i = 0; i < json_array_get_count(collection); i++) { + JSON_Object *obj = json_array_get_object(collection, i); + if (obj == NULL) { + TEST_FAIL_MESSAGE("failed to retrieve single object within JSON_Array"); + } + const char *name = json_object_get_string(obj, "name"); + if (strcmp(name, "foo_histogram")) { + continue; + } + JSON_Array *samples = json_object_dotget_array(obj, "metrics"); + if (samples == NULL) { + TEST_FAIL_MESSAGE("failed to retrieve metrics from JSON_Object"); + } + if (json_array_get_count(samples) < 1) { + TEST_FAIL_MESSAGE("No samples found"); + } + JSON_Object *sample = json_array_get_object(samples, 0); + if (sample == NULL) { + TEST_FAIL_MESSAGE("failed to get metric sample"); + } + *value = (char *)json_object_get_string(sample, "count"); + break; + } + if (strlen(*value) == 0) { + return 1; + } + return 0; } diff --git a/promtest/test/promtest_histogram.h b/promtest/test/promtest_histogram.h index 70fe204..de4ef67 100644 --- a/promtest/test/promtest_histogram.h +++ b/promtest/test/promtest_histogram.h @@ -1,6 +1,5 @@ /** * Copyright 2019-2020 DigitalOcean Inc. - * Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +20,10 @@ #define PROMTEST_HISTOGRAM_H extern prom_histogram_t *foo_histogram; + +int promtest_histogram_setup(void); +int promtest_histogram_teardown(void); + void promtest_histogram(void); #endif // PROMTEST_HISTOGRAM_H |
