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

Add metrics datastream for Azure Functions #7130

Merged
merged 19 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a15b275
Initial commit to add a datastream for Azure Functions metrics
devamanv Jul 24, 2023
d1ebc3b
Add all the required metrics and field mappings
devamanv Jul 25, 2023
1c266e5
Update changelog with the link to the metrics PR
devamanv Jul 25, 2023
0096853
Put back the logs datastream entry in the changelog.yml file
devamanv Jul 25, 2023
843df5f
Add Kibana Dashboards for Azure Functions and add the missing metric …
devamanv Aug 6, 2023
8519ebb
Update docs with info related to metrics datastream
devamanv Aug 9, 2023
f2d771d
Update dashboards with axes labels and add event.kind field for pipel…
devamanv Aug 13, 2023
93e05a8
Change the metric naming structure and adjust dashboards and field ma…
devamanv Aug 13, 2023
14d160d
Add dashboard screenshots, metric_type fields and update docs
devamanv Aug 20, 2023
d0616a5
Sync the ECS version in metrics datastream with the logs datastream
devamanv Aug 22, 2023
82cba15
Remove the empty _dev/test folder
devamanv Aug 23, 2023
6bc1b13
Fix the package version in changelog and a few panels in the dashboard
devamanv Aug 23, 2023
4ceb12c
Add a sample event and change the metric type of a field from counter…
devamanv Aug 24, 2023
7e4237f
Remove the description and the type field from ECS fields
devamanv Aug 24, 2023
5dbfc12
Add metric_type and rename field names to fix static checks
devamanv Aug 24, 2023
fdc69d4
Update README.md based on the field name changes
devamanv Aug 24, 2023
cb5a9be
Change the metric_type for gen_*_collection.total fields to counter
devamanv Aug 24, 2023
6e57a58
Remove whitespace from dasboard name and rename a panel
devamanv Aug 25, 2023
62bb7d4
Rename function execution count panel name
devamanv Aug 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/azure_functions/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# newer versions go on top
- version: "0.0.1"
- version: "0.1.1"
changes:
- description: Add Azure Functions metrics data stream
type: enhancement
link: https://github.com/elastic/integrations/pull/7130
- version: "0.1.0"
changes:
- description: Add Azure Functions logs data stream
type: enhancement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,45 @@ streams:
title: Azure Functions logs
description: Collect Azure Functions logs using azure-eventhub input
vars:
- name: eventhub
type: text
title: Event Hub
multi: false
required: true
show_user: true
description: >-
Elastic recommends using one event hub for each integration. Visit [Create an event hub](https://docs.elastic.co/integrations/azure#create-an-event-hub) to learn more. Use event hub names up to 30 characters long to avoid compatibility issues.
- name: consumer_group
type: text
title: Consumer Group
multi: false
required: true
show_user: true
default: $Default
- name: connection_string
type: password
title: Connection String
multi: false
required: true
show_user: true
description: >-
The connection string required to communicate with Event Hubs. See [Get an Event Hubs connection string](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-get-connection-string) to learn more.
- name: storage_account
type: text
title: Storage Account
multi: false
required: true
show_user: true
description: >-
The name of the storage account where the consumer group's state/offsets will be stored and updated.
- name: storage_account_key
type: password
title: Storage Account Key
multi: false
required: true
show_user: true
description: >-
The storage account key, this key will be used to authorize access to data in your storage account.
Comment on lines +10 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are moving these vars from the "integration package scope" to the "data stream scope", we should test the upgrade path from 0.1.0 to the new version.

I know this is integration is experimental, but we should see what's the user experience in this use case.

Copy link
Contributor Author

@devamanv devamanv Aug 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to test the upgrade from 0.0.1 to a new version, including the installations of assets. I was able to ingest logs after the upgrade in ES. So, this should be good enough to go ahead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool.

Did the upgrade kept all the integration settings values like event hub name, connection string, etc. from the integration scope to data stream scope?

- name: preserve_original_event
required: true
show_user: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dynamic_fields:
event.ingested: ".*"
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
metricsets: ["monitor"]
default_resource_type: "Microsoft.Web/sites"
add_cloud_metadata: true
period: {{period}}
{{#if client_id}}
client_id: {{client_id}}
{{/if}}
{{#if client_secret}}
client_secret: {{client_secret}}
{{/if}}
{{#if tenant_id}}
tenant_id: {{tenant_id}}
{{/if}}
{{#if subscription_id}}
subscription_id: {{subscription_id}}
{{/if}}
{{#if refresh_list_interval}}
refresh_list_interval: {{refresh_list_interval}}
{{/if}}
{{#if resource_manager_endpoint}}
resource_manager_endpoint: {{resource_manager_endpoint}}
{{/if}}
{{#if active_directory_endpoint}}
active_directory_endpoint: {{active_directory_endpoint}}
{{/if}}

resources:
{{#if resource_groups}}
{{#each resource_groups}}
- resource_group: "{{this}}"
resource_type: "Microsoft.Web/sites"
metrics:
- name: ["FunctionExecutionCount", "FunctionExecutionUnits", "AppConnections", "AverageMemoryWorkingSet", "BytesReceived", "BytesSent", "CurrentAssemblies", "Gen0Collections", "Gen1Collections", "Gen2Collections", "Handles", "HealthCheckStatus", "Http2xx", "Http3xx", "Http4xx", "Http5xx", "HttpResponseTime", "IoOtherBytesPerSecond", "IoOtherOperationsPerSecond", "IoReadBytesPerSecond", "IoReadOperationsPerSecond", "IoWriteBytesPerSecond", "IoWriteOperationsPerSecond", "MemoryWorkingSet", "Requests", "RequestsInApplicationQueue", "Threads", "TotalAppDomains", "TotalAppDomainsUnloaded"]
namespace: "Microsoft.Web/sites"
timegrain: "PT5M"
ignore_unsupported: true
- name: ["FileSystemUsage"]
namespace: "Microsoft.Web/sites"
timegrain: "PT6H"
ignore_unsupported: true
{{/each}}
{{/if}}
{{#if resource_ids}}
{{#each resource_ids}}
- resource_id: "{{this}}"
metrics:
- name: ["FunctionExecutionCount", "FunctionExecutionUnits", "AppConnections", "AverageMemoryWorkingSet", "BytesReceived", "BytesSent", "CurrentAssemblies", "Gen0Collections", "Gen1Collections", "Gen2Collections", "Handles", "HealthCheckStatus", "Http2xx", "Http3xx", "Http4xx", "Http5xx", "HttpResponseTime", "IoOtherBytesPerSecond", "IoOtherOperationsPerSecond", "IoReadBytesPerSecond", "IoReadOperationsPerSecond", "IoWriteBytesPerSecond", "IoWriteOperationsPerSecond", "MemoryWorkingSet", "Requests", "RequestsInApplicationQueue", "Threads", "TotalAppDomains", "TotalAppDomainsUnloaded"]
namespace: "Microsoft.Web/sites"
timegrain: "PT5M"
ignore_unsupported: true
- name: ["FileSystemUsage"]
namespace: "Microsoft.Web/sites"
timegrain: "PT6H"
ignore_unsupported: true
{{/each}}
{{/if}}
{{#unless resource_ids }}
{{#unless resource_groups }}
- resource_query: "resourceType eq 'Microsoft.Web/sites'"
metrics:
- name: ["FunctionExecutionCount", "FunctionExecutionUnits", "AppConnections", "AverageMemoryWorkingSet", "BytesReceived", "BytesSent", "CurrentAssemblies", "Gen0Collections", "Gen1Collections", "Gen2Collections", "Handles", "HealthCheckStatus", "Http2xx", "Http3xx", "Http4xx", "Http5xx", "HttpResponseTime", "IoOtherBytesPerSecond", "IoOtherOperationsPerSecond", "IoReadBytesPerSecond", "IoReadOperationsPerSecond", "IoWriteBytesPerSecond", "IoWriteOperationsPerSecond", "MemoryWorkingSet", "Requests", "RequestsInApplicationQueue", "Threads", "TotalAppDomains", "TotalAppDomainsUnloaded"]
namespace: "Microsoft.Web/sites"
timegrain: "PT5M"
ignore_unsupported: true
- name: ["FileSystemUsage"]
namespace: "Microsoft.Web/sites"
timegrain: "PT6H"
ignore_unsupported: true
{{/unless}}
{{/unless}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
description: Pipeline for parsing Azure Functions metrics.
processors:
- set:
field: ecs.version
value: "8.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the ECS version to the latest stable version. Also, make sure both the logs and metrics datastream have a sets the same ECS version.

- rename:
field: azure.monitor
target_field: azure.metrics
ignore_missing: true
on_failure:
- set:
field: error.message
value: '{{ _ingest.on_failure_message }}'
183 changes: 183 additions & 0 deletions packages/azure_functions/data_stream/metrics/fields/agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
- name: cloud
title: Cloud
group: 2
description: Fields related to the cloud or infrastructure the events are coming from.
footnote: 'Examples: If Metricbeat is running on an EC2 host and fetches data from its host, the cloud info contains the data about this machine. If Metricbeat runs on a remote machine outside the cloud and fetches data from a service running in the cloud, the field contains cloud data from the machine the service is running on.'
type: group
fields:
- name: account.id
level: extended
type: keyword
ignore_above: 1024
description: 'The cloud account or organization id used to identify different entities in a multi-tenant environment.

Examples: AWS account id, Google Cloud ORG Id, or other unique identifier.'
example: 666777888999
- name: availability_zone
level: extended
type: keyword
ignore_above: 1024
description: Availability zone in which this host is running.
example: us-east-1c
- name: instance.id
level: extended
type: keyword
ignore_above: 1024
description: Instance ID of the host machine.
example: i-1234567890abcdef0
- name: instance.name
level: extended
type: keyword
ignore_above: 1024
description: Instance name of the host machine.
- name: machine.type
level: extended
type: keyword
ignore_above: 1024
description: Machine type of the host machine.
example: t2.medium
- name: provider
level: extended
type: keyword
ignore_above: 1024
description: Name of the cloud provider. Example values are aws, azure, gcp, or digitalocean.
example: aws
- name: region
level: extended
type: keyword
ignore_above: 1024
description: Region in which this host is running.
example: us-east-1
- name: project.id
type: keyword
description: Name of the project in Google Cloud.
- name: image.id
type: keyword
description: Image ID for the cloud instance.
- name: container
title: Container
group: 2
description: 'Container fields are used for meta information about the specific container that is the source of information.

These fields help correlate data based containers from any runtime.'
type: group
fields:
- name: labels
level: extended
type: object
object_type: keyword
description: Image labels.
- name: host
title: Host
group: 2
description: 'A host is defined as a general computing instance.

ECS host.* fields should be populated with details about the host on which the event happened, or from which the measurement was taken. Host types include hardware, virtual machines, Docker containers, and Kubernetes nodes.'
type: group
fields:
- name: architecture
level: core
type: keyword
ignore_above: 1024
description: Operating system architecture.
example: x86_64
- name: domain
level: extended
type: keyword
ignore_above: 1024
description: 'Name of the domain of which the host is a member.

For example, on Windows this could be the host''s Active Directory domain or NetBIOS domain name. For Linux this could be the domain of the host''s LDAP provider.'
example: CONTOSO
default_field: false
- name: hostname
level: core
type: keyword
ignore_above: 1024
description: 'Hostname of the host.

It normally contains what the `hostname` command returns on the host machine.'
- name: id
level: core
type: keyword
ignore_above: 1024
description: 'Unique host id.

As hostname is not always unique, use values that are meaningful in your environment.

Example: The current usage of `beat.name`.'
- name: ip
level: core
type: ip
description: Host ip addresses.
- name: mac
level: core
type: keyword
ignore_above: 1024
description: Host mac addresses.
- name: name
level: core
type: keyword
ignore_above: 1024
description: 'Name of the host.

It can contain what `hostname` returns on Unix systems, the fully qualified domain name, or a name specified by the user. The sender decides which value to use.'
- name: os.family
level: extended
type: keyword
ignore_above: 1024
description: OS family (such as redhat, debian, freebsd, windows).
example: debian
- name: os.kernel
level: extended
type: keyword
ignore_above: 1024
description: Operating system kernel version as a raw string.
example: 4.4.0-112-generic
- name: os.name
level: extended
type: keyword
ignore_above: 1024
multi_fields:
- name: text
type: text
norms: false
default_field: false
description: Operating system name, without the version.
example: Mac OS X
- name: os.platform
level: extended
type: keyword
ignore_above: 1024
description: Operating system platform (such centos, ubuntu, windows).
example: darwin
- name: os.version
level: extended
type: keyword
ignore_above: 1024
description: Operating system version as a raw string.
example: 10.14.1
- name: type
level: core
type: keyword
ignore_above: 1024
description: 'Type of host.

For Cloud providers this can be the machine type like `t2.medium`. If vm, this could be the container, for example, or other information meaningful in your environment.'
- name: containerized
type: boolean
description: >
If the host is a container.

- name: os.build
type: keyword
example: "18D109"
description: >
OS build information.

- name: os.codename
type: keyword
example: "stretch"
description: >
OS codename, if any.

Comment on lines +1 to +183
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check if we can leverage ECS for these fields definition.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we switch to the ECS definition for these fields? They look the same.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- name: data_stream.type
type: constant_keyword
description: Data stream type.
- name: data_stream.dataset
type: constant_keyword
description: Data stream dataset name.
- name: data_stream.namespace
type: constant_keyword
description: Data stream namespace.
- name: dataset.type
type: constant_keyword
description: Dataset type.
- name: dataset.name
type: constant_keyword
description: Dataset name.
- name: dataset.namespace
type: constant_keyword
description: Dataset namespace.
- name: '@timestamp'
type: date
description: Event timestamp.
17 changes: 17 additions & 0 deletions packages/azure_functions/data_stream/metrics/fields/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- name: ecs.version
external: ecs
- name: service.address
type: keyword
description: Service address
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no need to add description for ECS fields as they are generated at build time. Also this would override the already present description of the ECS field.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aliabbas-elastic - The next question is why we need to define a type for the ECS field. @devamanv we need to reference the ECS field here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. Yes, we should remove the description and the type fields, and add the missing externalfield. Will make this change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@muthu-mps, Is there a ECS field mapping guideline document, which captures the correct way to map ECS fields?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lalit-satapathy - I don't find a guidelines document for mapping ECS fields. I do see the service.address is mapped directly in some and referencing ECS in some integrations.

- name: service.type
external: ecs
- name: container.id
external: ecs
- name: container.name
external: ecs
- name: container.runtime
external: ecs
- name: container.image.name
external: ecs
- name: host
external: ecs
Loading