@ -68,16 +68,16 @@ func TestCreateAttributes(t *testing.T) {
scope scope
promoteAllResourceAttributes bool
promoteResourceAttributes [ ] string
convert Scope bool
promote Scope bool
ignoreResourceAttributes [ ] string
ignoreAttrs [ ] string
expectedLabels [ ] prompb . Label
} {
{
name : "Successful conversion without resource attribute promotion and without scope convers ion" ,
name : "Successful conversion without resource attribute promotion and without scope promot ion" ,
scope : defaultScope ,
promoteResourceAttributes : nil ,
convert Scope: false ,
promote Scope: false ,
expectedLabels : [ ] prompb . Label {
{
Name : "__name__" ,
@ -102,10 +102,10 @@ func TestCreateAttributes(t *testing.T) {
} ,
} ,
{
name : "Successful conversion without resource attribute promotion and with scope convers ion" ,
name : "Successful conversion without resource attribute promotion and with scope promot ion" ,
scope : defaultScope ,
promoteResourceAttributes : nil ,
convert Scope: true ,
promote Scope: true ,
expectedLabels : [ ] prompb . Label {
{
Name : "__name__" ,
@ -150,10 +150,10 @@ func TestCreateAttributes(t *testing.T) {
} ,
} ,
{
name : "Successful conversion without resource attribute promotion and with scope convers ion, but without scope" ,
name : "Successful conversion without resource attribute promotion and with scope promot ion, but without scope" ,
scope : scope { } ,
promoteResourceAttributes : nil ,
convert Scope: true ,
promote Scope: true ,
expectedLabels : [ ] prompb . Label {
{
Name : "__name__" ,
@ -178,10 +178,10 @@ func TestCreateAttributes(t *testing.T) {
} ,
} ,
{
name : "Successful conversion with some attributes ignored and with scope convers ion" ,
name : "Successful conversion with some attributes ignored and with scope promot ion" ,
scope : defaultScope ,
promoteResourceAttributes : nil ,
convert Scope: true ,
promote Scope: true ,
ignoreAttrs : [ ] string { "metric-attr-other" } ,
expectedLabels : [ ] prompb . Label {
{
@ -223,10 +223,10 @@ func TestCreateAttributes(t *testing.T) {
} ,
} ,
{
name : "Successful conversion with resource attribute promotion and with scope convers ion" ,
name : "Successful conversion with resource attribute promotion and with scope promot ion" ,
scope : defaultScope ,
promoteResourceAttributes : [ ] string { "non-existent-attr" , "existent-attr" } ,
convert Scope: true ,
promote Scope: true ,
expectedLabels : [ ] prompb . Label {
{
Name : "__name__" ,
@ -275,10 +275,10 @@ func TestCreateAttributes(t *testing.T) {
} ,
} ,
{
name : "Successful conversion with resource attribute promotion and with scope convers ion, conflicting resource attributes are ignored" ,
name : "Successful conversion with resource attribute promotion and with scope promot ion, conflicting resource attributes are ignored" ,
scope : defaultScope ,
promoteResourceAttributes : [ ] string { "non-existent-attr" , "existent-attr" , "metric-attr" , "job" , "instance" } ,
convert Scope: true ,
promote Scope: true ,
expectedLabels : [ ] prompb . Label {
{
Name : "__name__" ,
@ -327,10 +327,10 @@ func TestCreateAttributes(t *testing.T) {
} ,
} ,
{
name : "Successful conversion with resource attribute promotion and with scope convers ion, attributes are only promoted once" ,
name : "Successful conversion with resource attribute promotion and with scope promot ion, attributes are only promoted once" ,
scope : defaultScope ,
promoteResourceAttributes : [ ] string { "existent-attr" , "existent-attr" } ,
convert Scope: true ,
promote Scope: true ,
expectedLabels : [ ] prompb . Label {
{
Name : "__name__" ,
@ -379,10 +379,10 @@ func TestCreateAttributes(t *testing.T) {
} ,
} ,
{
name : "Successful conversion promoting all resource attributes and with scope convers ion" ,
name : "Successful conversion promoting all resource attributes and with scope promot ion" ,
scope : defaultScope ,
promoteAllResourceAttributes : true ,
convert Scope: true ,
promote Scope: true ,
expectedLabels : [ ] prompb . Label {
{
Name : "__name__" ,
@ -439,10 +439,10 @@ func TestCreateAttributes(t *testing.T) {
} ,
} ,
{
name : "Successful conversion promoting all resource attributes and with scope convers ion, ignoring 'service.instance.id'" ,
name : "Successful conversion promoting all resource attributes and with scope promot ion, ignoring 'service.instance.id'" ,
scope : defaultScope ,
promoteAllResourceAttributes : true ,
convert Scope: true ,
promote Scope: true ,
ignoreResourceAttributes : [ ] string {
"service.instance.id" ,
} ,
@ -506,7 +506,7 @@ func TestCreateAttributes(t *testing.T) {
PromoteResourceAttributes : tc . promoteResourceAttributes ,
IgnoreResourceAttributes : tc . ignoreResourceAttributes ,
} ) ,
Convert ScopeMetadata: tc . convert Scope,
Promote ScopeMetadata: tc . promote Scope,
}
lbls := createAttributes ( resource , attrs , tc . scope , settings , tc . ignoreAttrs , false , model . MetricNameLabel , "test_metric" )
@ -551,11 +551,11 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
name string
metric func ( ) pmetric . Metric
scope scope
convert Scope bool
promote Scope bool
want func ( ) map [ uint64 ] * prompb . TimeSeries
} {
{
name : "summary with start time and without scope convers ion" ,
name : "summary with start time and without scope promot ion" ,
metric : func ( ) pmetric . Metric {
metric := pmetric . NewMetric ( )
metric . SetName ( "test_summary" )
@ -568,7 +568,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
return metric
} ,
scope : defaultScope ,
convert Scope: false ,
promote Scope: false ,
want : func ( ) map [ uint64 ] * prompb . TimeSeries {
countLabels := [ ] prompb . Label {
{ Name : model . MetricNameLabel , Value : "test_summary" + countStr } ,
@ -602,7 +602,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
} ,
} ,
{
name : "summary with start time and with scope convers ion" ,
name : "summary with start time and with scope promot ion" ,
metric : func ( ) pmetric . Metric {
metric := pmetric . NewMetric ( )
metric . SetName ( "test_summary" )
@ -615,7 +615,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
return metric
} ,
scope : defaultScope ,
convert Scope: true ,
promote Scope: true ,
want : func ( ) map [ uint64 ] * prompb . TimeSeries {
scopeLabels := [ ] prompb . Label {
{
@ -674,7 +674,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
} ,
} ,
{
name : "summary without start time and without scope convers ion" ,
name : "summary without start time and without scope promot ion" ,
metric : func ( ) pmetric . Metric {
metric := pmetric . NewMetric ( )
metric . SetName ( "test_summary" )
@ -685,7 +685,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
return metric
} ,
convert Scope: false ,
promote Scope: false ,
want : func ( ) map [ uint64 ] * prompb . TimeSeries {
countLabels := [ ] prompb . Label {
{ Name : model . MetricNameLabel , Value : "test_summary" + countStr } ,
@ -720,7 +720,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
metric . Summary ( ) . DataPoints ( ) ,
pcommon . NewResource ( ) ,
Settings {
Convert ScopeMetadata: tt . convert Scope,
Promote ScopeMetadata: tt . promote Scope,
ExportCreatedMetric : true ,
} ,
metric . Name ( ) ,
@ -751,11 +751,11 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
name string
metric func ( ) pmetric . Metric
scope scope
convert Scope bool
promote Scope bool
want func ( ) map [ uint64 ] * prompb . TimeSeries
} {
{
name : "histogram with start time and without scope convers ion" ,
name : "histogram with start time and without scope promot ion" ,
metric : func ( ) pmetric . Metric {
metric := pmetric . NewMetric ( )
metric . SetName ( "test_hist" )
@ -768,7 +768,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
return metric
} ,
scope : defaultScope ,
convert Scope: false ,
promote Scope: false ,
want : func ( ) map [ uint64 ] * prompb . TimeSeries {
countLabels := [ ] prompb . Label {
{ Name : model . MetricNameLabel , Value : "test_hist" + countStr } ,
@ -803,7 +803,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
} ,
} ,
{
name : "histogram with start time and with scope convers ion" ,
name : "histogram with start time and with scope promot ion" ,
metric : func ( ) pmetric . Metric {
metric := pmetric . NewMetric ( )
metric . SetName ( "test_hist" )
@ -816,7 +816,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
return metric
} ,
scope : defaultScope ,
convert Scope: true ,
promote Scope: true ,
want : func ( ) map [ uint64 ] * prompb . TimeSeries {
scopeLabels := [ ] prompb . Label {
{
@ -920,7 +920,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
pcommon . NewResource ( ) ,
Settings {
ExportCreatedMetric : true ,
Convert ScopeMetadata: tt . convert Scope,
Promote ScopeMetadata: tt . promote Scope,
} ,
metric . Name ( ) ,
tt . scope ,