diff --git a/.chloggen/sqlserver-add-address-resource-attr.yaml b/.chloggen/sqlserver-add-address-resource-attr.yaml new file mode 100644 index 000000000000..3a2f3776f9b2 --- /dev/null +++ b/.chloggen/sqlserver-add-address-resource-attr.yaml @@ -0,0 +1,30 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: receiver/sqlserverreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add `server.address` and `server.port` resource attributes to SQL server receiver. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35183] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + The new resource attributes are added to the SQL server receiver to distinguish metrics coming from different SQL server instances. + - `server.address`: The address of the SQL server host, enabled by default. + - `server.port`: The port of the SQL server host, disabled by default. + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/receiver/sqlserverreceiver/config_test.go b/receiver/sqlserverreceiver/config_test.go index 28cff062fe89..220f41b60ea2 100644 --- a/receiver/sqlserverreceiver/config_test.go +++ b/receiver/sqlserverreceiver/config_test.go @@ -112,6 +112,12 @@ func TestLoadConfig(t *testing.T) { SqlserverComputerName: metadata.ResourceAttributeConfig{ Enabled: true, }, + ServerAddress: metadata.ResourceAttributeConfig{ + Enabled: true, + }, + ServerPort: metadata.ResourceAttributeConfig{ + Enabled: true, + }, }, } expected.ComputerName = "CustomServer" diff --git a/receiver/sqlserverreceiver/documentation.md b/receiver/sqlserverreceiver/documentation.md index ef2412548b77..2c627e6e0199 100644 --- a/receiver/sqlserverreceiver/documentation.md +++ b/receiver/sqlserverreceiver/documentation.md @@ -323,6 +323,8 @@ This metric is only available when the receiver is configured to directly connec | Name | Description | Values | Enabled | | ---- | ----------- | ------ | ------- | +| server.address | The address of the SQL server host. | Any Str | true | +| server.port | The port of the SQL server host. | Any Int | false | | sqlserver.computer.name | The name of the SQL Server instance being monitored. | Any Str | false | | sqlserver.database.name | The name of the SQL Server database. | Any Str | true | | sqlserver.instance.name | The name of the SQL Server instance being monitored. | Any Str | false | diff --git a/receiver/sqlserverreceiver/factory.go b/receiver/sqlserverreceiver/factory.go index 2613c875a0cd..295cf8163d52 100644 --- a/receiver/sqlserverreceiver/factory.go +++ b/receiver/sqlserverreceiver/factory.go @@ -98,13 +98,11 @@ func setupSQLServerScrapers(params receiver.Settings, cfg *Config) []*sqlServerS id := component.NewIDWithName(metadata.Type, fmt.Sprintf("query-%d: %s", i, query)) sqlServerScraper := newSQLServerScraper(id, query, - cfg.InstanceName, - cfg.ControllerConfig, - params.Logger, sqlquery.TelemetryConfig{}, dbProviderFunc, sqlquery.NewDbClient, - metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, params)) + params, + cfg) scrapers = append(scrapers, sqlServerScraper) } diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_config.go b/receiver/sqlserverreceiver/internal/metadata/generated_config.go index d1f0e534f840..4f60f5b6394d 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_config.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_config.go @@ -171,6 +171,8 @@ func (rac *ResourceAttributeConfig) Unmarshal(parser *confmap.Conf) error { // ResourceAttributesConfig provides config for sqlserver resource attributes. type ResourceAttributesConfig struct { + ServerAddress ResourceAttributeConfig `mapstructure:"server.address"` + ServerPort ResourceAttributeConfig `mapstructure:"server.port"` SqlserverComputerName ResourceAttributeConfig `mapstructure:"sqlserver.computer.name"` SqlserverDatabaseName ResourceAttributeConfig `mapstructure:"sqlserver.database.name"` SqlserverInstanceName ResourceAttributeConfig `mapstructure:"sqlserver.instance.name"` @@ -178,6 +180,12 @@ type ResourceAttributesConfig struct { func DefaultResourceAttributesConfig() ResourceAttributesConfig { return ResourceAttributesConfig{ + ServerAddress: ResourceAttributeConfig{ + Enabled: true, + }, + ServerPort: ResourceAttributeConfig{ + Enabled: false, + }, SqlserverComputerName: ResourceAttributeConfig{ Enabled: false, }, diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_config_test.go b/receiver/sqlserverreceiver/internal/metadata/generated_config_test.go index 39593a8dfca6..8350e236c9cc 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_config_test.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_config_test.go @@ -54,6 +54,8 @@ func TestMetricsBuilderConfig(t *testing.T) { SqlserverUserConnectionCount: MetricConfig{Enabled: true}, }, ResourceAttributes: ResourceAttributesConfig{ + ServerAddress: ResourceAttributeConfig{Enabled: true}, + ServerPort: ResourceAttributeConfig{Enabled: true}, SqlserverComputerName: ResourceAttributeConfig{Enabled: true}, SqlserverDatabaseName: ResourceAttributeConfig{Enabled: true}, SqlserverInstanceName: ResourceAttributeConfig{Enabled: true}, @@ -93,6 +95,8 @@ func TestMetricsBuilderConfig(t *testing.T) { SqlserverUserConnectionCount: MetricConfig{Enabled: false}, }, ResourceAttributes: ResourceAttributesConfig{ + ServerAddress: ResourceAttributeConfig{Enabled: false}, + ServerPort: ResourceAttributeConfig{Enabled: false}, SqlserverComputerName: ResourceAttributeConfig{Enabled: false}, SqlserverDatabaseName: ResourceAttributeConfig{Enabled: false}, SqlserverInstanceName: ResourceAttributeConfig{Enabled: false}, @@ -131,6 +135,8 @@ func TestResourceAttributesConfig(t *testing.T) { { name: "all_set", want: ResourceAttributesConfig{ + ServerAddress: ResourceAttributeConfig{Enabled: true}, + ServerPort: ResourceAttributeConfig{Enabled: true}, SqlserverComputerName: ResourceAttributeConfig{Enabled: true}, SqlserverDatabaseName: ResourceAttributeConfig{Enabled: true}, SqlserverInstanceName: ResourceAttributeConfig{Enabled: true}, @@ -139,6 +145,8 @@ func TestResourceAttributesConfig(t *testing.T) { { name: "none_set", want: ResourceAttributesConfig{ + ServerAddress: ResourceAttributeConfig{Enabled: false}, + ServerPort: ResourceAttributeConfig{Enabled: false}, SqlserverComputerName: ResourceAttributeConfig{Enabled: false}, SqlserverDatabaseName: ResourceAttributeConfig{Enabled: false}, SqlserverInstanceName: ResourceAttributeConfig{Enabled: false}, diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_metrics.go b/receiver/sqlserverreceiver/internal/metadata/generated_metrics.go index 5dbd00c81e1d..f9a1fe28d852 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_metrics.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_metrics.go @@ -1553,6 +1553,18 @@ func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, opt resourceAttributeIncludeFilter: make(map[string]filter.Filter), resourceAttributeExcludeFilter: make(map[string]filter.Filter), } + if mbc.ResourceAttributes.ServerAddress.MetricsInclude != nil { + mb.resourceAttributeIncludeFilter["server.address"] = filter.CreateFilter(mbc.ResourceAttributes.ServerAddress.MetricsInclude) + } + if mbc.ResourceAttributes.ServerAddress.MetricsExclude != nil { + mb.resourceAttributeExcludeFilter["server.address"] = filter.CreateFilter(mbc.ResourceAttributes.ServerAddress.MetricsExclude) + } + if mbc.ResourceAttributes.ServerPort.MetricsInclude != nil { + mb.resourceAttributeIncludeFilter["server.port"] = filter.CreateFilter(mbc.ResourceAttributes.ServerPort.MetricsInclude) + } + if mbc.ResourceAttributes.ServerPort.MetricsExclude != nil { + mb.resourceAttributeExcludeFilter["server.port"] = filter.CreateFilter(mbc.ResourceAttributes.ServerPort.MetricsExclude) + } if mbc.ResourceAttributes.SqlserverComputerName.MetricsInclude != nil { mb.resourceAttributeIncludeFilter["sqlserver.computer.name"] = filter.CreateFilter(mbc.ResourceAttributes.SqlserverComputerName.MetricsInclude) } diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_metrics_test.go b/receiver/sqlserverreceiver/internal/metadata/generated_metrics_test.go index 3eb894f64965..eba420b43a22 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_metrics_test.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_metrics_test.go @@ -170,6 +170,8 @@ func TestMetricsBuilder(t *testing.T) { mb.RecordSqlserverUserConnectionCountDataPoint(ts, 1) rb := mb.NewResourceBuilder() + rb.SetServerAddress("server.address-val") + rb.SetServerPort(11) rb.SetSqlserverComputerName("sqlserver.computer.name-val") rb.SetSqlserverDatabaseName("sqlserver.database.name-val") rb.SetSqlserverInstanceName("sqlserver.instance.name-val") diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_resource.go b/receiver/sqlserverreceiver/internal/metadata/generated_resource.go index 4a56be86bc64..0c93b65171b4 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_resource.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_resource.go @@ -21,6 +21,20 @@ func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder { } } +// SetServerAddress sets provided value as "server.address" attribute. +func (rb *ResourceBuilder) SetServerAddress(val string) { + if rb.config.ServerAddress.Enabled { + rb.res.Attributes().PutStr("server.address", val) + } +} + +// SetServerPort sets provided value as "server.port" attribute. +func (rb *ResourceBuilder) SetServerPort(val int64) { + if rb.config.ServerPort.Enabled { + rb.res.Attributes().PutInt("server.port", val) + } +} + // SetSqlserverComputerName sets provided value as "sqlserver.computer.name" attribute. func (rb *ResourceBuilder) SetSqlserverComputerName(val string) { if rb.config.SqlserverComputerName.Enabled { diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_resource_test.go b/receiver/sqlserverreceiver/internal/metadata/generated_resource_test.go index 4d9fe066072b..b33314d8d821 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_resource_test.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_resource_test.go @@ -13,6 +13,8 @@ func TestResourceBuilder(t *testing.T) { t.Run(tt, func(t *testing.T) { cfg := loadResourceAttributesConfig(t, tt) rb := NewResourceBuilder(cfg) + rb.SetServerAddress("server.address-val") + rb.SetServerPort(11) rb.SetSqlserverComputerName("sqlserver.computer.name-val") rb.SetSqlserverDatabaseName("sqlserver.database.name-val") rb.SetSqlserverInstanceName("sqlserver.instance.name-val") @@ -22,9 +24,9 @@ func TestResourceBuilder(t *testing.T) { switch tt { case "default": - assert.Equal(t, 1, res.Attributes().Len()) + assert.Equal(t, 2, res.Attributes().Len()) case "all_set": - assert.Equal(t, 3, res.Attributes().Len()) + assert.Equal(t, 5, res.Attributes().Len()) case "none_set": assert.Equal(t, 0, res.Attributes().Len()) return @@ -32,7 +34,17 @@ func TestResourceBuilder(t *testing.T) { assert.Failf(t, "unexpected test case: %s", tt) } - val, ok := res.Attributes().Get("sqlserver.computer.name") + val, ok := res.Attributes().Get("server.address") + assert.True(t, ok) + if ok { + assert.EqualValues(t, "server.address-val", val.Str()) + } + val, ok = res.Attributes().Get("server.port") + assert.Equal(t, tt == "all_set", ok) + if ok { + assert.EqualValues(t, 11, val.Int()) + } + val, ok = res.Attributes().Get("sqlserver.computer.name") assert.Equal(t, tt == "all_set", ok) if ok { assert.EqualValues(t, "sqlserver.computer.name-val", val.Str()) diff --git a/receiver/sqlserverreceiver/internal/metadata/testdata/config.yaml b/receiver/sqlserverreceiver/internal/metadata/testdata/config.yaml index f40796045269..a418c0122f8d 100644 --- a/receiver/sqlserverreceiver/internal/metadata/testdata/config.yaml +++ b/receiver/sqlserverreceiver/internal/metadata/testdata/config.yaml @@ -56,6 +56,10 @@ all_set: sqlserver.user.connection.count: enabled: true resource_attributes: + server.address: + enabled: true + server.port: + enabled: true sqlserver.computer.name: enabled: true sqlserver.database.name: @@ -119,6 +123,10 @@ none_set: sqlserver.user.connection.count: enabled: false resource_attributes: + server.address: + enabled: false + server.port: + enabled: false sqlserver.computer.name: enabled: false sqlserver.database.name: @@ -127,6 +135,14 @@ none_set: enabled: false filter_set_include: resource_attributes: + server.address: + enabled: true + metrics_include: + - regexp: ".*" + server.port: + enabled: true + metrics_include: + - regexp: ".*" sqlserver.computer.name: enabled: true metrics_include: @@ -141,6 +157,14 @@ filter_set_include: - regexp: ".*" filter_set_exclude: resource_attributes: + server.address: + enabled: true + metrics_exclude: + - strict: "server.address-val" + server.port: + enabled: true + metrics_exclude: + - regexp: ".*" sqlserver.computer.name: enabled: true metrics_exclude: diff --git a/receiver/sqlserverreceiver/metadata.yaml b/receiver/sqlserverreceiver/metadata.yaml index 3d1e48e29bed..f2a66b0a7bea 100644 --- a/receiver/sqlserverreceiver/metadata.yaml +++ b/receiver/sqlserverreceiver/metadata.yaml @@ -22,6 +22,14 @@ resource_attributes: description: The name of the SQL Server instance being monitored. enabled: false type: string + server.address: + description: The address of the SQL server host. + enabled: true + type: string + server.port: + description: The port of the SQL server host. + enabled: false + type: int attributes: page.operations: diff --git a/receiver/sqlserverreceiver/scraper.go b/receiver/sqlserverreceiver/scraper.go index c00b34316a51..9309a0e8322f 100644 --- a/receiver/sqlserverreceiver/scraper.go +++ b/receiver/sqlserverreceiver/scraper.go @@ -14,7 +14,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/scraper" "go.uber.org/zap" @@ -29,9 +29,8 @@ const ( type sqlServerScraperHelper struct { id component.ID + config *Config sqlQuery string - instanceName string - scrapeCfg scraperhelper.ControllerConfig clientProviderFunc sqlquery.ClientProviderFunc dbProviderFunc sqlquery.DbProviderFunc logger *zap.Logger @@ -45,24 +44,21 @@ var _ scraper.Metrics = (*sqlServerScraperHelper)(nil) func newSQLServerScraper(id component.ID, query string, - instanceName string, - scrapeCfg scraperhelper.ControllerConfig, - logger *zap.Logger, telemetry sqlquery.TelemetryConfig, dbProviderFunc sqlquery.DbProviderFunc, clientProviderFunc sqlquery.ClientProviderFunc, - mb *metadata.MetricsBuilder, + params receiver.Settings, + cfg *Config, ) *sqlServerScraperHelper { return &sqlServerScraperHelper{ id: id, + config: cfg, sqlQuery: query, - instanceName: instanceName, - scrapeCfg: scrapeCfg, - logger: logger, + logger: params.Logger, telemetry: telemetry, dbProviderFunc: dbProviderFunc, clientProviderFunc: clientProviderFunc, - mb: mb, + mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, params), } } @@ -85,11 +81,11 @@ func (s *sqlServerScraperHelper) ScrapeMetrics(ctx context.Context) (pmetric.Met var err error switch s.sqlQuery { - case getSQLServerDatabaseIOQuery(s.instanceName): + case getSQLServerDatabaseIOQuery(s.config.InstanceName): err = s.recordDatabaseIOMetrics(ctx) - case getSQLServerPerformanceCounterQuery(s.instanceName): + case getSQLServerPerformanceCounterQuery(s.config.InstanceName): err = s.recordDatabasePerfCounterMetrics(ctx) - case getSQLServerPropertiesQuery(s.instanceName): + case getSQLServerPropertiesQuery(s.config.InstanceName): err = s.recordDatabaseStatusMetrics(ctx) default: return pmetric.Metrics{}, fmt.Errorf("Attempted to get metrics from unsupported query: %s", s.sqlQuery) @@ -138,6 +134,8 @@ func (s *sqlServerScraperHelper) recordDatabaseIOMetrics(ctx context.Context) er rb.SetSqlserverComputerName(row[computerNameKey]) rb.SetSqlserverDatabaseName(row[databaseNameKey]) rb.SetSqlserverInstanceName(row[instanceNameKey]) + rb.SetServerAddress(s.config.Server) + rb.SetServerPort(int64(s.config.Port)) val, err = strconv.ParseFloat(row[readLatencyMsKey], 64) if err != nil { @@ -199,6 +197,8 @@ func (s *sqlServerScraperHelper) recordDatabasePerfCounterMetrics(ctx context.Co rb := s.mb.NewResourceBuilder() rb.SetSqlserverComputerName(row[computerNameKey]) rb.SetSqlserverInstanceName(row[instanceNameKey]) + rb.SetServerAddress(s.config.Server) + rb.SetServerPort(int64(s.config.Port)) switch row[counterKey] { case batchRequestRate: @@ -287,6 +287,8 @@ func (s *sqlServerScraperHelper) recordDatabaseStatusMetrics(ctx context.Context rb := s.mb.NewResourceBuilder() rb.SetSqlserverComputerName(row[computerNameKey]) rb.SetSqlserverInstanceName(row[instanceNameKey]) + rb.SetServerAddress(s.config.Server) + rb.SetServerPort(int64(s.config.Port)) errs = append(errs, s.mb.RecordSqlserverDatabaseCountDataPoint(now, row[dbOnline], metadata.AttributeDatabaseStatusOnline)) errs = append(errs, s.mb.RecordSqlserverDatabaseCountDataPoint(now, row[dbRestoring], metadata.AttributeDatabaseStatusRestoring)) diff --git a/receiver/sqlserverreceiver/scraper_test.go b/receiver/sqlserverreceiver/scraper_test.go index 2a505bc6ddaa..d6919357c0f6 100644 --- a/receiver/sqlserverreceiver/scraper_test.go +++ b/receiver/sqlserverreceiver/scraper_test.go @@ -51,6 +51,7 @@ func TestEmptyScrape(t *testing.T) { cfg.Port = 1433 cfg.Server = "0.0.0.0" cfg.MetricsBuilderConfig.ResourceAttributes.SqlserverInstanceName.Enabled = true + cfg.MetricsBuilderConfig.ResourceAttributes.ServerPort.Enabled = true assert.NoError(t, cfg.Validate()) // Ensure there aren't any scrapers when all metrics are disabled. @@ -72,6 +73,7 @@ func TestSuccessfulScrape(t *testing.T) { cfg.Port = 1433 cfg.Server = "0.0.0.0" cfg.MetricsBuilderConfig.ResourceAttributes.SqlserverInstanceName.Enabled = true + cfg.MetricsBuilderConfig.ResourceAttributes.ServerPort.Enabled = true assert.NoError(t, cfg.Validate()) enableAllScraperMetrics(cfg) @@ -85,7 +87,7 @@ func TestSuccessfulScrape(t *testing.T) { defer assert.NoError(t, scraper.Shutdown(context.Background())) scraper.client = mockClient{ - instanceName: scraper.instanceName, + instanceName: scraper.config.InstanceName, SQL: scraper.sqlQuery, } @@ -94,11 +96,11 @@ func TestSuccessfulScrape(t *testing.T) { var expectedFile string switch scraper.sqlQuery { - case getSQLServerDatabaseIOQuery(scraper.instanceName): + case getSQLServerDatabaseIOQuery(scraper.config.InstanceName): expectedFile = filepath.Join("testdata", "expectedDatabaseIO.yaml") - case getSQLServerPerformanceCounterQuery(scraper.instanceName): + case getSQLServerPerformanceCounterQuery(scraper.config.InstanceName): expectedFile = filepath.Join("testdata", "expectedPerfCounters.yaml") - case getSQLServerPropertiesQuery(scraper.instanceName): + case getSQLServerPropertiesQuery(scraper.config.InstanceName): expectedFile = filepath.Join("testdata", "expectedProperties.yaml") } @@ -122,6 +124,7 @@ func TestScrapeInvalidQuery(t *testing.T) { cfg.Port = 1433 cfg.Server = "0.0.0.0" cfg.MetricsBuilderConfig.ResourceAttributes.SqlserverInstanceName.Enabled = true + cfg.MetricsBuilderConfig.ResourceAttributes.ServerPort.Enabled = true assert.NoError(t, cfg.Validate()) @@ -135,7 +138,7 @@ func TestScrapeInvalidQuery(t *testing.T) { defer assert.NoError(t, scraper.Shutdown(context.Background())) scraper.client = mockClient{ - instanceName: scraper.instanceName, + instanceName: scraper.config.InstanceName, SQL: "Invalid SQL query", } diff --git a/receiver/sqlserverreceiver/testdata/config.yaml b/receiver/sqlserverreceiver/testdata/config.yaml index 783bfbb17ae7..3a9f6b2961ec 100644 --- a/receiver/sqlserverreceiver/testdata/config.yaml +++ b/receiver/sqlserverreceiver/testdata/config.yaml @@ -10,3 +10,5 @@ sqlserver/named: enabled: true sqlserver.instance.name: enabled: true + server.port: + enabled: true diff --git a/receiver/sqlserverreceiver/testdata/expectedDatabaseIO.yaml b/receiver/sqlserverreceiver/testdata/expectedDatabaseIO.yaml index aa49684770bb..b8d6909a8aff 100644 --- a/receiver/sqlserverreceiver/testdata/expectedDatabaseIO.yaml +++ b/receiver/sqlserverreceiver/testdata/expectedDatabaseIO.yaml @@ -7,6 +7,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -137,6 +143,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -267,6 +279,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -397,6 +415,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -527,6 +551,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -657,6 +687,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -787,6 +823,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -917,6 +959,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -1047,6 +1095,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -1177,6 +1231,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -1307,6 +1367,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -1437,6 +1503,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -1567,6 +1639,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -1697,6 +1775,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. @@ -1827,6 +1911,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of bytes of I/O on this file. diff --git a/receiver/sqlserverreceiver/testdata/expectedPerfCounters.yaml b/receiver/sqlserverreceiver/testdata/expectedPerfCounters.yaml index 676dcd7397df..6a4f5cedbdd8 100644 --- a/receiver/sqlserverreceiver/testdata/expectedPerfCounters.yaml +++ b/receiver/sqlserverreceiver/testdata/expectedPerfCounters.yaml @@ -4,6 +4,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: Pages found in the buffer pool without having to read from disk. @@ -22,6 +28,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of processes that are currently blocked @@ -40,6 +52,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: Number of users connected to the SQL Server. @@ -58,6 +76,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: Number of lock requests resulting in a wait. @@ -76,6 +100,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of read operations that were throttled in the last second @@ -94,6 +124,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of write operations that were throttled in the last second @@ -112,6 +148,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of write operations that were throttled in the last second @@ -130,6 +172,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of read operations that were throttled in the last second @@ -148,6 +196,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: Number of batch requests received by SQL Server. @@ -166,6 +220,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: Number of SQL compilations needed. @@ -184,6 +244,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: 8cac97ac9b8f + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: Number of SQL recompilations needed. diff --git a/receiver/sqlserverreceiver/testdata/expectedProperties.yaml b/receiver/sqlserverreceiver/testdata/expectedProperties.yaml index face46b337c8..147d49bf0ddf 100644 --- a/receiver/sqlserverreceiver/testdata/expectedProperties.yaml +++ b/receiver/sqlserverreceiver/testdata/expectedProperties.yaml @@ -4,6 +4,12 @@ resourceMetrics: - key: sqlserver.instance.name value: stringValue: ad8fb2b53dce + - key: server.address + value: + stringValue: 0.0.0.0 + - key: server.port + value: + intValue: "1433" scopeMetrics: - metrics: - description: The number of databases