Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize label names to comply with Prometheus requirements #1253

Merged
merged 3 commits into from
Aug 31, 2020

Conversation

tomkerkhove
Copy link
Owner

Signed-off-by: Tom Kerkhove [email protected]

Config:

metrics:
  - name: promitor_demo_app_insights
    resourceType: Generic
    azureMetricConfiguration:
      metricName: dependencies/duration
      dimension:
        name: dependency/type
      aggregation:
        type: Average
    resources:
    - resourceUri: Microsoft.Insights/Components/docker-hub-metrics
      resourceGroupName: docker-hub-metrics

Output:

# HELP promitor_demo_app_insights Average dependency duration per dependency type
# TYPE promitor_demo_app_insights gauge
promitor_demo_app_insights{resource_group="docker-hub-metrics",subscription_id="0f9d7fea-99e8-4768-8672-06a28514f77e",resource_uri="subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/docker-hub-metrics/providers/Microsoft.Insights/Components/docker-hub-metrics",instance_name="Microsoft.Insights/Components/docker-hub-metrics",dependency_type="Http"} 500.5 1598877315829

Fixes #1248

@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Aug 31, 2020
@promitor-bot
Copy link

Docker image for this PR was built and is available on Docker Hub.

You can pull it locally via the CLI:

docker pull tomkerkhove/promitor-agent-scraper-ci:pr1253-linux

Want to verify the new version? Run it locally:

docker run -d -p 8999:80 --name promitor-agent-scraper-pr1253-linux \
                         --env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
                         --env-file C:/Promitor/az-mon-auth.creds \
                         --volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml  \
                         --volume C:/Promitor/runtime-config.yaml:/config/runtime.yaml \
                         tomkerkhove/promitor-agent-scraper-ci:pr1253-linux

You can find a CI version of our Helm chart on hub.helm.sh

@tomkerkhove tomkerkhove merged commit d423406 into master Aug 31, 2020
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed 🔍 Ready for Review Pull Request is not reviewed yet labels Aug 31, 2020
@renebarbosafl
Copy link

Not working at all.

System.InvalidOperationException: Unable to resolve service for type 'Prometheus.Client.Abstractions.IMetricFactory' while attempting to activate 'Promitor.Integrations.Sinks.Prometheus.RuntimeMetricsCollector'.

@tomkerkhove
Copy link
Owner Author

This is odd. All was fine on my machine. Ugh, sorry. I'll check asap.

@tomkerkhove tomkerkhove deleted the label-with-slash branch September 1, 2020 08:26
@tomkerkhove
Copy link
Owner Author

Works fine for me here:

# HELP promitor_demo_app_insights Average dependency duration per dependency type
# TYPE promitor_demo_app_insights gauge
promitor_demo_app_insights{resource_group="docker-hub-metrics",subscription_id="0f9d7fea-99e8-4768-8672-06a28514f77e",resource_uri="subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/docker-hub-metrics/providers/Microsoft.Insights/Components/docker-hub-metrics",instance_name="Microsoft.Insights/Components/docker-hub-metrics",dependency_type="Http"} 756.5 1598949661465

Logs:

⚡ tkerkhove@CLT-TKERKHOVE  C:\Code                                     [10:40]
❯ docker run -d -p 8765:88 --name promitor-agent-scraper --env-file C:/Promitor/az-mon-auth.creds --volume C:/Code/GitHub/promitor/config/promitor/scraper/:/config/ tomkerkhove/promitor-agent-scraper-ci:pr1253
b2017d8413d2ad0f93dc5a58ad21b616561ec4db236d4a5e4bb7ab07f57f3dfc
⚡ tkerkhove@CLT-TKERKHOVE  C:\Code                                     [10:40]
❯ docker logs b2017d8413d2ad0f93dc5a58ad21b616561ec4db236d4a5e4bb7ab07f57f3dfc -f
██████╗ ██████╗  ██████╗ ███╗   ███╗██╗████████╗ ██████╗ ██████╗
██╔══██╗██╔══██╗██╔═══██╗████╗ ████║██║╚══██╔══╝██╔═══██╗██╔══██╗
██████╔╝██████╔╝██║   ██║██╔████╔██║██║   ██║   ██║   ██║██████╔╝
██╔═══╝ ██╔══██╗██║   ██║██║╚██╔╝██║██║   ██║   ██║   ██║██╔══██╗
██║     ██║  ██║╚██████╔╝██║ ╚═╝ ██║██║   ██║   ╚██████╔╝██║  ██║
╚═╝     ╚═╝  ╚═╝ ╚═════╝ ╚═╝     ╚═╝╚═╝   ╚═╝    ╚═════╝ ╚═╝  ╚═╝
[08:40:53 INF] Using configuration folder '/config/'
[08:40:54 INF] Metrics declaration is using spec version v1
[08:40:55 INF] Scheduled scraping job 0f9d7fea-99e8-4768-8672-06a28514f77e-promitor-sources-promitor_demo_appplan_percentage_cpu-promitor-app-plan-c14e6da5-f809-41eb-8f5f-71dfa787d824 for resource promitor-app-plan which will be reported as metric promitor_demo_appplan_percentage_cpu
[08:40:55 INF] Scheduled scraping job azure_container_registry_total_pull_count_discovered-container-registry-landscape-0267a32a-e699-4f94-8d2b-a70fd67c45ff for resource collection container-registry-landscape which will be reported as metric azure_container_registry_total_pull_count_discovered
[08:40:55 INF] Scheduled scraping job promitor_demo_appplan_percentage_cpu_discovered-app-plan-landscape-5eb66ca4-bbf9-463c-9153-dc5e874aee69 for resource collection app-plan-landscape which will be reported as metric promitor_demo_appplan_percentage_cpu_discovered
[08:40:55 INF] Scheduled scraping job promitor_demo_webapp_cpu_discovery-web-app-landscape-d19da6bf-67fe-4c07-81ac-b5603b914c4e for resource collection web-app-landscape which will be reported as metric promitor_demo_webapp_cpu_discovery
[08:40:55 INF] Scheduled scraping job promitor_demo_function_memory_discovery-function-app-landscape-731e47b1-ceb2-4689-a839-c007e4bab547 for resource collection function-app-landscape which will be reported as metric promitor_demo_function_memory_discovery
[08:40:55 INF] Scheduled scraping job 0f9d7fea-99e8-4768-8672-06a28514f77e-promitor-azure_logic_apps_failed_run-promitor-automation-github-ci-scraper-2b34f07a-9b43-4dc2-a182-eb75d5f9921b for resource promitor-automation-github-ci-scraper which will be reported as metric azure_logic_apps_failed_run
[08:40:55 INF] Scheduled scraping job azure_logic_apps_failed_run_discovery-logic-apps-unfiltered-2a2644f7-2adc-44ef-8f12-1de632337892 for resource collection logic-apps-unfiltered which will be reported as metric azure_logic_apps_failed_run_discovery
[08:40:55 INF] Scheduled scraping job azure_storage_account_capacity_discovery-storage-accounts-168e3e84-23b5-4b5f-b19c-c829f1cd92b7 for resource collection storage-accounts which will be reported as metric azure_storage_account_capacity_discovery
[08:40:55 INF] Scheduled scraping job azure_sql_database_cpu_percent_discovery-sql-databases-a38ef957-3042-4dd3-a7ae-024b4da7ba7c for resource collection sql-databases which will be reported as metric azure_sql_database_cpu_percent_discovery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dimensions dimensions which include / in name are not supported
3 participants